code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import tensorflow as tf
def get_vectors_norm(vectors):
transposed = tf.transpose(vectors)
v_mag = tf.sqrt(tf.math.reduce_sum(transposed * transposed, axis=0))
return tf.transpose(tf.math.divide_no_nan(transposed, v_mag))
class InnerAngleRepresentation:
def __call__(self, p1s: tf.Tensor, p2s: tf.Tens... | [
"tensorflow.transpose",
"tensorflow.reduce_sum",
"tensorflow.acos",
"tensorflow.math.divide_no_nan",
"tensorflow.math.is_nan",
"tensorflow.math.reduce_sum"
] | [((74, 95), 'tensorflow.transpose', 'tf.transpose', (['vectors'], {}), '(vectors)\n', (86, 95), True, 'import tensorflow as tf\n'), ((116, 167), 'tensorflow.math.reduce_sum', 'tf.math.reduce_sum', (['(transposed * transposed)'], {'axis': '(0)'}), '(transposed * transposed, axis=0)\n', (134, 167), True, 'import tensorfl... |
import sys
import contextlib
import functools
import ir_measures
from ir_measures import providers, measures, Metric
from ir_measures.providers.base import Any, Choices, NOT_PROVIDED
class TrectoolsProvider(providers.Provider):
"""
trectools
https://github.com/joaopalotti/trectools
::
@inproceeding... | [
"ir_measures.util.QrelsConverter",
"ir_measures.providers.base.Choices",
"ir_measures.providers.base.Any",
"ir_measures.Metric",
"ir_measures.util.flatten_measures",
"pandas.DataFrame",
"ir_measures.util.RunConverter"
] | [((1297, 1340), 'ir_measures.util.flatten_measures', 'ir_measures.util.flatten_measures', (['measures'], {}), '(measures)\n', (1330, 1340), False, 'import ir_measures\n'), ((1516, 1539), 'pandas.DataFrame', 'pd.DataFrame', (['tmp_qrels'], {}), '(tmp_qrels)\n', (1528, 1539), True, 'import pandas as pd\n'), ((5369, 5390)... |
import pandas as pd
import inspect
import unittest
import numpy as np
'''
The general.unique take a array-like object and return the unique values in it. To test this we simply pass in different lists where some
of the values are not unique, and check if general.unique returns the right values.
From documentation:... | [
"unittest.main",
"pandas.unique"
] | [((1924, 1939), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1937, 1939), False, 'import unittest\n'), ((1226, 1251), 'pandas.unique', 'pd.unique', (['self.sequence1'], {}), '(self.sequence1)\n', (1235, 1251), True, 'import pandas as pd\n'), ((1398, 1423), 'pandas.unique', 'pd.unique', (['self.sequence2'], {}),... |
__author__ = '2063602T'
from django.conf.urls import patterns, url
from VolunteerMe import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^profile/(?P<username>[\W\-]+)/$',
views.profile,
... | [
"django.conf.urls.url"
] | [((149, 185), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index'], {'name': '"""index"""'}), "('^$', views.index, name='index')\n", (152, 185), False, 'from django.conf.urls import patterns, url\n'), ((211, 283), 'django.conf.urls.url', 'url', (['"""^profile/(?P<username>[\\\\W\\\\-]+)/$"""', 'views.profile'], ... |
import functools
import os
import re
import typing as tp
import xonsh.platform as xp
import xonsh.tools as xt
from xonsh.built_ins import XSH
from xonsh.completer import Completer
from xonsh.completers.tools import (
RichCompletion,
contextual_command_completer,
get_filter_function,
non_exclusive_compl... | [
"xonsh.built_ins.XSH.env.get",
"re.compile",
"os.path.join",
"xonsh.tools.executables_in",
"xonsh.parsers.completion_context.CompletionContext",
"os.path.isdir",
"os.path.basename",
"xonsh.completers.tools.RichCompletion",
"functools.lru_cache",
"xonsh.completers.tools.get_filter_function",
"xon... | [((867, 901), 'xonsh.built_ins.XSH.commands_cache.iter_commands', 'XSH.commands_cache.iter_commands', ([], {}), '()\n', (899, 901), False, 'from xonsh.built_ins import XSH\n'), ((1297, 1318), 'os.path.basename', 'os.path.basename', (['cmd'], {}), '(cmd)\n', (1313, 1318), False, 'import os\n'), ((1326, 1345), 'os.path.i... |
from __future__ import print_function
import sys, os, datetime, json
sys.path.append(os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'lib')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'env/Lib/site-packages')))
import httplib, urllib
import time
from base64 ... | [
"datetime.datetime.utcfromtimestamp",
"os.path.dirname",
"httplib.HTTPSConnection",
"datetime.datetime.utcnow"
] | [((2618, 2661), 'httplib.HTTPSConnection', 'httplib.HTTPSConnection', (['ALERT_LOGIC_API_CD'], {}), '(ALERT_LOGIC_API_CD)\n', (2641, 2661), False, 'import httplib, urllib\n'), ((3059, 3102), 'httplib.HTTPSConnection', 'httplib.HTTPSConnection', (['ALERT_LOGIC_API_CD'], {}), '(ALERT_LOGIC_API_CD)\n', (3082, 3102), False... |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB authors.
#
# 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... | [
"edb.ir.utils.collapse_type_intersection",
"edb.errors.QueryError",
"edb.errors.InternalServerError"
] | [((27253, 27368), 'edb.errors.QueryError', 'errors.QueryError', (['"""could not determine the cardinality of set produced by expression"""'], {'context': 'ir.context'}), "(\n 'could not determine the cardinality of set produced by expression',\n context=ir.context)\n", (27270, 27368), False, 'from edb import erro... |
# -*- coding: utf-8 -*-
# Authors: <NAME> <<EMAIL>>
import unittest
from .. import SingleElementinaSortedArray
class test_SingleElementinaSortedArray(unittest.TestCase):
solution = SingleElementinaSortedArray.Solution()
def test_singleNonDuplicate(self):
self.assertEqual(self.solution.singleNonDup... | [
"unittest.main"
] | [((493, 508), 'unittest.main', 'unittest.main', ([], {}), '()\n', (506, 508), False, 'import unittest\n')] |
import json
import unittest
from coba.environments.formats import EnvironmentFileFmtV1
from coba.environments.core import SimulatedEnvironment
class EnvironmentFileFmtV1_Tests(unittest.TestCase):
def test_one_simulation(self):
json_txt = """{
"simulations" : [
{ "OpenmlSimulat... | [
"unittest.main",
"json.loads",
"coba.environments.formats.EnvironmentFileFmtV1"
] | [((6495, 6510), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6508, 6510), False, 'import unittest\n'), ((412, 432), 'json.loads', 'json.loads', (['json_txt'], {}), '(json_txt)\n', (422, 432), False, 'import json\n'), ((749, 769), 'json.loads', 'json.loads', (['json_txt'], {}), '(json_txt)\n', (759, 769), False,... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 22 06:55:02 2021
@author: david
"""
import os
import pickle
import sys
import matplotlib.cm
import networkx as nx
import pandas as pd
from Patent2Net.P2N_Config import LoadConfig
from Patent2Net.P2N_Lib import LoadBiblioFile, UrlPatent, UrlApplicantBuild, UrlInventorBu... | [
"Patent2Net.P2N_Lib.UrlApplicantBuild",
"os.listdir",
"Patent2Net.P2N_Lib.UrlPatent",
"Patent2Net.P2N_Lib.UrlIPCRBuild",
"os.rename",
"networkx.DiGraph",
"networkx.spring_layout",
"pickle.load",
"Patent2Net.P2N_Config.LoadConfig",
"networkx.set_node_attributes",
"Patent2Net.P2N_Lib.RenderTemplat... | [((1229, 1241), 'Patent2Net.P2N_Config.LoadConfig', 'LoadConfig', ([], {}), '()\n', (1239, 1241), False, 'from Patent2Net.P2N_Config import LoadConfig\n'), ((61939, 62039), 'Patent2Net.P2N_Lib.RenderTemplate', 'RenderTemplate', (['"""GraphIndex.html"""', "(configFile.ResultPath + '/GraphIndex' + projectName + '.html')"... |
import unittest
import hail as hl
import hail.expr.aggregators as agg
from subprocess import DEVNULL, call as syscall
import numpy as np
from struct import unpack
import hail.utils as utils
from hail.linalg import BlockMatrix
from math import sqrt
from .utils import resource, doctest_resource, startTestHailContext, st... | [
"hail.utils.range_matrix_table",
"hail.float32",
"hail.de_novo",
"subprocess.call",
"hail.utils.uri_path",
"hail.export_gen",
"hail.realized_relationship_matrix",
"hail.locus_interval",
"hail.mendel_errors",
"hail.case",
"hail.is_nan",
"numpy.diag",
"hail.hwe_normalized_pca",
"hail.len",
... | [((3082, 3153), 'hail.identity_by_descent', 'hl.identity_by_descent', (['dataset', "dataset['dummy_maf']"], {'min': '(0.0)', 'max': '(1.0)'}), "(dataset, dataset['dummy_maf'], min=0.0, max=1.0)\n", (3104, 3153), True, 'import hail as hl\n'), ((3364, 3402), 'hail.impute_sex', 'hl.impute_sex', (['ds.GT'], {'include_par':... |
import zmq
import time
import threading
import json
name = 'bob'
def cluster_manager (context, join_uri):
nodes = [name]
join_sock = context.socket (zmq.REP)
join_sock.bind (join_uri)
while True:
message = join_sock.recv ()
req = json.loads (message)
if 'type' in req and req['... | [
"threading.Thread",
"json.loads",
"json.dumps",
"zmq.Context"
] | [((503, 517), 'zmq.Context', 'zmq.Context', (['(1)'], {}), '(1)\n', (514, 517), False, 'import zmq\n'), ((529, 597), 'threading.Thread', 'threading.Thread', ([], {'target': 'cluster_manager', 'args': "(ctx, 'tcp://*:5560')"}), "(target=cluster_manager, args=(ctx, 'tcp://*:5560'))\n", (545, 597), False, 'import threadin... |
# Generated by Django 3.2.9 on 2021-11-24 09:04
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('patients', '0013_invoice'),
]
operations = [
migrations.RemoveField(
model_name='invoice',
name='appointment',
),
... | [
"django.db.migrations.RemoveField"
] | [((217, 281), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""invoice"""', 'name': '"""appointment"""'}), "(model_name='invoice', name='appointment')\n", (239, 281), False, 'from django.db import migrations\n')] |
import re
REGEX = re.compile(r'(\d+)\,(\d+)\s\-\>\s(\d+)\,(\d+)')
TEST_DATA = """0,9 -> 5,9
8,0 -> 0,8
9,4 -> 3,4
2,2 -> 2,1
7,0 -> 7,4
6,4 -> 2,0
0,9 -> 2,9
3,4 -> 1,4
0,0 -> 8,8
5,5 -> 8,2"""
def get_map_readings(filename):
with open('input.txt') as file:
return file.read()
def parse_readings(raw_read... | [
"re.match",
"re.compile"
] | [((19, 75), 're.compile', 're.compile', (['"""(\\\\d+)\\\\,(\\\\d+)\\\\s\\\\-\\\\>\\\\s(\\\\d+)\\\\,(\\\\d+)"""'], {}), "('(\\\\d+)\\\\,(\\\\d+)\\\\s\\\\-\\\\>\\\\s(\\\\d+)\\\\,(\\\\d+)')\n", (29, 75), False, 'import re\n'), ((455, 477), 're.match', 're.match', (['REGEX', 'entry'], {}), '(REGEX, entry)\n', (463, 477), ... |
from unittest import TestCase
from tests import get_data
from pytezos.michelson.micheline import michelson_to_micheline
from pytezos.michelson.formatter import micheline_to_michelson
class MichelsonCodingTestKT1Cx5(TestCase):
def setUp(self):
self.maxDiff = None
def test_michelson_parse_code_KT... | [
"pytezos.michelson.formatter.micheline_to_michelson",
"tests.get_data"
] | [((351, 436), 'tests.get_data', 'get_data', ([], {'path': '"""contracts/KT1Cx5ohe4r8QgtP647eidHgZBJhr9L5DSJA/code_KT1Cx5.json"""'}), "(path='contracts/KT1Cx5ohe4r8QgtP647eidHgZBJhr9L5DSJA/code_KT1Cx5.json'\n )\n", (359, 436), False, 'from tests import get_data\n'), ((690, 768), 'tests.get_data', 'get_data', ([], {'p... |
import pygame
def get_window_size(screen_size):
size = (0.225 * screen_size[0], 0.75 * screen_size[1])
return size
def get_position(screen_size):
position = (10 + 0.75 * screen_size[0], 5 + 0.0 * screen_size[1])
return position
class Information(pygame.sprite.Sprite):
def __init__(self, screen... | [
"pygame.Color"
] | [((624, 650), 'pygame.Color', 'pygame.Color', (['"""dodgerblue"""'], {}), "('dodgerblue')\n", (636, 650), False, 'import pygame\n')] |
from unittest import result
from unittest.util import strclass
from blessings import Terminal
from pygments import formatters, highlight
try:
# Python 2
text_type = unicode
from pygments.lexers import PythonTracebackLexer as Lexer
except NameError:
# Python 3
text_type = str
from pygments.lexer... | [
"pygments.formatters.Terminal256Formatter",
"blessings.Terminal",
"pygments.highlight",
"unittest.util.strclass",
"pygments.lexers.Python3TracebackLexer"
] | [((600, 633), 'pygments.formatters.Terminal256Formatter', 'formatters.Terminal256Formatter', ([], {}), '()\n', (631, 633), False, 'from pygments import formatters, highlight\n'), ((646, 653), 'pygments.lexers.Python3TracebackLexer', 'Lexer', ([], {}), '()\n', (651, 653), True, 'from pygments.lexers import Python3Traceb... |
from django.shortcuts import render,redirect
from Nucleo.models import Viaje,Tramo,Reservacion
from datetime import datetime,timedelta
from django.contrib.auth.decorators import user_passes_test
# Create your views here.
def CancelarReserva(request, reserva):
res = Reservacion.objects.get(id=reserva)
if res.e... | [
"Nucleo.models.Reservacion.objects.get",
"django.shortcuts.redirect"
] | [((272, 307), 'Nucleo.models.Reservacion.objects.get', 'Reservacion.objects.get', ([], {'id': 'reserva'}), '(id=reserva)\n', (295, 307), False, 'from Nucleo.models import Viaje, Tramo, Reservacion\n'), ((486, 499), 'django.shortcuts.redirect', 'redirect', (['"""/"""'], {}), "('/')\n", (494, 499), False, 'from django.sh... |
# Generated by Django 3.0.3 on 2020-03-03 15:15
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='AdList',
fields=[
('id', models.AutoField(a... | [
"django.db.models.FloatField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((302, 395), '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", (318, 395), False, 'from django.db import migrations, models\... |
from pyinspect import Report
from pyinspect._colors import orange, mocassin
from rich.bar import Bar
from rich.color import Color
from .note import Note
from ._metadata import make_note_metadata
class Todo(Note):
def __init__(self, note_name, raise_error=True):
"""
A special type of note for ... | [
"rich.bar.Bar",
"rich.color.Color.from_rgb",
"pyinspect.Report"
] | [((1099, 1190), 'pyinspect.Report', 'Report', ([], {'title': 'f"""Todo list: [b]{self.name}"""', 'show_info': '(True)', 'color': 'orange', 'accent': 'orange'}), "(title=f'Todo list: [b]{self.name}', show_info=True, color=orange,\n accent=orange)\n", (1105, 1190), False, 'from pyinspect import Report\n'), ((1467, 149... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 31 23:27:51 2018
@author: Yulab
"""
import tensorflow as tf
import VGG_utils
#%%
def VGG16(x, n_classes, is_pretrain=True, keep_prob=0.5, seed=1):
x = VGG_utils.conv('conv1_1', x, 64, is_pretrain=is_pretrain, seed=seed)
x = VGG_utils.conv('conv1_2', x, 64, ... | [
"VGG_utils.conv",
"VGG_utils.pool",
"VGG_utils.FC_layer",
"tensorflow.name_scope"
] | [((210, 278), 'VGG_utils.conv', 'VGG_utils.conv', (['"""conv1_1"""', 'x', '(64)'], {'is_pretrain': 'is_pretrain', 'seed': 'seed'}), "('conv1_1', x, 64, is_pretrain=is_pretrain, seed=seed)\n", (224, 278), False, 'import VGG_utils\n'), ((287, 355), 'VGG_utils.conv', 'VGG_utils.conv', (['"""conv1_2"""', 'x', '(64)'], {'is... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: hzsunshx
# Created: 2015-02-03 14:41
"""
demo google main page
"""
import os
import flask
app = flask.Flask(__name__)
@app.route('/search')
def search():
query = flask.request.args.get('q')
words = []
for c in 'abcdefg':
words.append(que... | [
"flask.render_template",
"flask.request.args.get",
"os.getenv",
"flask.Flask",
"flask.jsonify"
] | [((158, 179), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (169, 179), False, 'import flask\n'), ((229, 256), 'flask.request.args.get', 'flask.request.args.get', (['"""q"""'], {}), "('q')\n", (251, 256), False, 'import flask\n'), ((337, 368), 'flask.jsonify', 'flask.jsonify', (["{'words': words}"],... |
# Auto generated configuration file
# using:
# Revision: 1.381.2.7
# Source: /local/reps/CMSSW/CMSSW/Configuration/PyReleaseValidation/python/ConfigBuilder.py,v
# with command line options: Configuration/GenProduction/python/EightTeV/Hadronizer_MgmMatchTuneZ2star_8TeV_madgraph_tauola_cff.py --step GEN --beamspot Rea... | [
"FWCore.ParameterSet.Config.Schedule",
"FWCore.ParameterSet.Config.untracked.string",
"FWCore.ParameterSet.VarParsing.VarParsing",
"Configuration.AlCa.GlobalTag.GlobalTag",
"FWCore.ParameterSet.Config.untracked.int32",
"FWCore.ParameterSet.Config.Process",
"FWCore.ParameterSet.Config.untracked.vstring",... | [((712, 734), 'FWCore.ParameterSet.VarParsing.VarParsing', 'VarParsing', (['"""analysis"""'], {}), "('analysis')\n", (722, 734), False, 'from FWCore.ParameterSet.VarParsing import VarParsing\n'), ((772, 790), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""ANA"""'], {}), "('ANA')\n", (783, 790), True, 'impor... |
from time import sleep
for i in range(10, -1, -1):
print(1)
sleep(0.5)
print('BUMM BUMM') | [
"time.sleep"
] | [((69, 79), 'time.sleep', 'sleep', (['(0.5)'], {}), '(0.5)\n', (74, 79), False, 'from time import sleep\n')] |
from django.contrib import admin
from bootcamp.articles.models import Article, ArticleComment, Tag
admin.site.register(Article)
admin.site.register(ArticleComment)
admin.site.register(Tag) | [
"django.contrib.admin.site.register"
] | [((100, 128), 'django.contrib.admin.site.register', 'admin.site.register', (['Article'], {}), '(Article)\n', (119, 128), False, 'from django.contrib import admin\n'), ((129, 164), 'django.contrib.admin.site.register', 'admin.site.register', (['ArticleComment'], {}), '(ArticleComment)\n', (148, 164), False, 'from django... |
from pydub import AudioSegment
sound = AudioSegment.from_file("C:/Users/AR064679/Documents/thesis/final R/videoAnalysis/processed/ashwin")
sound.export("C:/Users/AR064679/Documents/thesis/final r/videoAnalysis/processed/", format="mp3", bitrate="128k") | [
"pydub.AudioSegment.from_file"
] | [((39, 148), 'pydub.AudioSegment.from_file', 'AudioSegment.from_file', (['"""C:/Users/AR064679/Documents/thesis/final R/videoAnalysis/processed/ashwin"""'], {}), "(\n 'C:/Users/AR064679/Documents/thesis/final R/videoAnalysis/processed/ashwin'\n )\n", (61, 148), False, 'from pydub import AudioSegment\n')] |
# Generated by Django 3.0.3 on 2020-09-07 15:19
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Actor',
fields=[
... | [
"django.db.models.DateField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((1516, 1586), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'through': '"""movies.MovieActor"""', 'to': '"""movies.Actor"""'}), "(through='movies.MovieActor', to='movies.Actor')\n", (1538, 1586), False, 'from django.db import migrations, models\n'), ((334, 427), 'django.db.models.AutoField', 'mo... |
import json
from os import (makedirs as os_makedirs,
path as os_path,
sep as os_sep)
from gbpacman.utils import get_global_logger
logger = get_global_logger()
def load_json(json_file) -> dict:
with open(json_file, 'r') as file:
return json.load(file)
def is_key_points_to... | [
"os.makedirs",
"os.path.join",
"json.load",
"os.path.dirname",
"os.path.isdir",
"os.path.basename",
"os.path.abspath",
"gbpacman.utils.get_global_logger"
] | [((172, 191), 'gbpacman.utils.get_global_logger', 'get_global_logger', ([], {}), '()\n', (189, 191), False, 'from gbpacman.utils import get_global_logger\n'), ((2812, 2837), 'os.path.abspath', 'os_path.abspath', (['__file__'], {}), '(__file__)\n', (2827, 2837), True, 'from os import makedirs as os_makedirs, path as os_... |
from flask import Blueprint, render_template, request, flash, redirect, url_for, jsonify, make_response
from app.users.models import Users, UsersSchema
from werkzeug.security import generate_password_hash, check_password_hash
from flask_restful import Resource, Api
import flask_restful
import jwt
from jwt import ... | [
"jwt.decode",
"app.users.models.UsersSchema",
"flask_restful.Api",
"datetime.datetime.utcnow",
"flask.jsonify",
"functools.wraps",
"datetime.timedelta",
"flask.request.get_json",
"app.users.models.Users.query.filter_by",
"app.users.models.Users.query.all",
"flask.Blueprint",
"flask.request.hea... | [((486, 514), 'flask.Blueprint', 'Blueprint', (['"""users"""', '__name__'], {}), "('users', __name__)\n", (495, 514), False, 'from flask import Blueprint, render_template, request, flash, redirect, url_for, jsonify, make_response\n'), ((607, 620), 'app.users.models.UsersSchema', 'UsersSchema', ([], {}), '()\n', (618, 6... |
import arpy
# from subprocess import Popen
# auto push to git
arpy.task("push", ["git add .", "git commit -m 'updates'", "git push origin master"], ".", ignorelist=[".git"])
| [
"arpy.task"
] | [((62, 177), 'arpy.task', 'arpy.task', (['"""push"""', '[\'git add .\', "git commit -m \'updates\'", \'git push origin master\']', '"""."""'], {'ignorelist': "['.git']"}), '(\'push\', [\'git add .\', "git commit -m \'updates\'",\n \'git push origin master\'], \'.\', ignorelist=[\'.git\'])\n', (71, 177), False, 'impo... |
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout
from keras.layers import LSTM
from keras.callbacks import ModelCheckpoint
from random import randint
from keras.utils import np_utils
import sys
inp = sys.argv[1]
outFile = sys.argv[2]
with open(inp) as f:
... | [
"numpy.reshape",
"keras.callbacks.ModelCheckpoint",
"numpy.log",
"numpy.asarray",
"numpy.argmax",
"keras.models.Sequential",
"numpy.exp",
"keras.layers.LSTM",
"numpy.random.multinomial",
"keras.utils.np_utils.to_categorical",
"numpy.sum",
"keras.layers.Activation",
"keras.layers.Dense",
"k... | [((753, 792), 'numpy.reshape', 'np.reshape', (['dataX', '(n_patterns, seq, 1)'], {}), '(dataX, (n_patterns, seq, 1))\n', (763, 792), True, 'import numpy as np\n'), ((823, 853), 'keras.utils.np_utils.to_categorical', 'np_utils.to_categorical', (['dataY'], {}), '(dataY)\n', (846, 853), False, 'from keras.utils import np_... |
from django.contrib import admin
from django.urls import path, include
from . import views
urlpatterns = [
path("",views.home_page,name="home_page"),
path("shirts",views.shirts_page,name="Shirt"),
path("sports-wear",views.sports_wear_page,name="Sport Wear"),
path("outwear",views.outwear_page,name="Out... | [
"django.urls.path"
] | [((113, 156), 'django.urls.path', 'path', (['""""""', 'views.home_page'], {'name': '"""home_page"""'}), "('', views.home_page, name='home_page')\n", (117, 156), False, 'from django.urls import path, include\n'), ((160, 207), 'django.urls.path', 'path', (['"""shirts"""', 'views.shirts_page'], {'name': '"""Shirt"""'}), "... |
'''
testcode2
---------
A framework for regression testing numerical programs.
:copyright: (c) 2012 <NAME>.
:license: modified BSD; see LICENSE for more details.
'''
import glob
import os
import pipes
import shutil
import subprocess
import sys
import warnings
try:
import yaml
_HAVE_YAML = True
except Import... | [
"testcode2.validation.compare_data",
"testcode2.dir_lock.DirLock",
"testcode2.compatibility.compat_any",
"sys.exc_info",
"testcode2.queues.ClusterQueueJob",
"testcode2.util.testcode_filename",
"sys.path.append",
"os.path.exists",
"testcode2.util.dict_table_string",
"testcode2.util.extract_tagged_d... | [((695, 713), 'testcode2.dir_lock.DirLock', 'dir_lock.DirLock', ([], {}), '()\n', (711, 713), True, 'import testcode2.dir_lock as dir_lock\n'), ((3897, 3969), 'testcode2.util.testcode_filename', 'util.testcode_filename', (["FILESTEM['test']", 'self.test_id', 'input_file', 'args'], {}), "(FILESTEM['test'], self.test_id,... |
import logging
from multiprocessing.managers import SyncManager
from typing import List, Tuple, cast, Union
import numpy as np
import tensorflow as tf
import gpbasics.DataHandling.DataInput as di
import gpbasics.KernelBasics.Kernel as k
import gpbasics.global_parameters as global_param
import gpminference.ChangePoint... | [
"logging.debug",
"gpminference.ChangePointDetection.BaseKernelSCPD.WhiteNoiseCPD",
"gpbasics.Statistics.GaussianProcess.BlockwiseGaussianProcess",
"logging.info",
"tensorflow.reduce_min",
"gpbasics.KernelBasics.Operators.ChangePointOperator",
"gpbasics.global_parameters.ensure_init",
"gpbasics.global_... | [((946, 972), 'gpbasics.global_parameters.ensure_init', 'global_param.ensure_init', ([], {}), '()\n', (970, 972), True, 'import gpbasics.global_parameters as global_param\n'), ((4492, 4906), 'gpminference.KernelSearch.ParallelApproach.ParallelKernelSearch', 'pks.ParallelKernelSearch', (['self.strategy_type', 'strategy_... |
import logging
def is_type_list(obj_type):
return str(obj_type) == "<class 'list'>"
# Helper function that decides whether input_list is 2d array as expected.
# 1. input_list must be a list.
# 2. Every element of the input_list must be a list and has a same length.
# 3. Every element of the element of the input... | [
"logging.error"
] | [((605, 664), 'logging.error', 'logging.error', (['"""Given input is not an array : """', 'input_list'], {}), "('Given input is not an array : ', input_list)\n", (618, 664), False, 'import logging\n'), ((2112, 2171), 'logging.error', 'logging.error', (['"""Given input is not an array : """', 'input_list'], {}), "('Give... |
from argmagic import argmagic
def main(name: str, other: str):
print("Hello", name, "I am", other)
argmagic(main, positional=["name"])
| [
"argmagic.argmagic"
] | [((107, 142), 'argmagic.argmagic', 'argmagic', (['main'], {'positional': "['name']"}), "(main, positional=['name'])\n", (115, 142), False, 'from argmagic import argmagic\n')] |
"""
Classification dataset routines.
"""
__all__ = ['img_normalization']
import numpy as np
def img_normalization(img,
mean_rgb,
std_rgb):
"""
Normalization as in the ImageNet-1K validation procedure.
Parameters
----------
img : np.array
i... | [
"numpy.array"
] | [((590, 620), 'numpy.array', 'np.array', (['mean_rgb', 'np.float32'], {}), '(mean_rgb, np.float32)\n', (598, 620), True, 'import numpy as np\n'), ((643, 672), 'numpy.array', 'np.array', (['std_rgb', 'np.float32'], {}), '(std_rgb, np.float32)\n', (651, 672), True, 'import numpy as np\n')] |
import sys
sys.path.append('../../src')
import argparse
from collections import defaultdict
import datetime
import functools
import logging
import operator
import os
from pyschedule import Scenario, solvers, plotters, alt
class NoSolutionError(RuntimeError):
pass
class AnlagenDescriptor(object):
def __init... | [
"os.path.exists",
"pyschedule.Scenario",
"logging.debug",
"logging.info",
"pyschedule.solvers.mip.solve",
"operator.or_",
"collections.defaultdict",
"pyschedule.solvers.ortools.solve",
"sys.path.append"
] | [((11, 39), 'sys.path.append', 'sys.path.append', (['"""../../src"""'], {}), "('../../src')\n", (26, 39), False, 'import sys\n'), ((995, 1048), 'pyschedule.Scenario', 'Scenario', (['self._name'], {'horizon': 'self._duration_in_units'}), '(self._name, horizon=self._duration_in_units)\n', (1003, 1048), False, 'from pysch... |
import jax
from evosax import Strategies
from evosax.problems import ClassicFitness
def test_strategy_ask(strategy_name):
# Loop over all strategies and test ask API
rng = jax.random.PRNGKey(0)
popsize = 20
strategy = Strategies[strategy_name](popsize=popsize, num_dims=2)
params = strategy.default... | [
"evosax.problems.ClassicFitness",
"jax.random.PRNGKey"
] | [((182, 203), 'jax.random.PRNGKey', 'jax.random.PRNGKey', (['(0)'], {}), '(0)\n', (200, 203), False, 'import jax\n'), ((595, 616), 'jax.random.PRNGKey', 'jax.random.PRNGKey', (['(0)'], {}), '(0)\n', (613, 616), False, 'import jax\n'), ((850, 890), 'evosax.problems.ClassicFitness', 'ClassicFitness', (['"""rosenbrock"""'... |
import os
import shutil
import requests
from textwrap import dedent
##############################################################################
# Utilities
##############################################################################
border = "=" * 79
endc = "\033[0m"
bcolors = dict(
blue="\033[94m",
gree... | [
"textwrap.dedent",
"requests.get",
"os.path.isfile",
"os.path.isdir",
"shutil.rmtree",
"os.remove"
] | [((647, 658), 'textwrap.dedent', 'dedent', (['msg'], {}), '(msg)\n', (653, 658), False, 'from textwrap import dedent\n'), ((979, 1003), 'os.path.isfile', 'os.path.isfile', (['filepath'], {}), '(filepath)\n', (993, 1003), False, 'import os\n'), ((1013, 1032), 'os.remove', 'os.remove', (['filepath'], {}), '(filepath)\n',... |
"""
Generic Data Source Class
DataSource is the root class for all other podpac defined data sources,
including user defined data sources.
"""
from __future__ import division, unicode_literals, print_function, absolute_import
from collections import OrderedDict
from copy import deepcopy
import warnings
import logging... | [
"logging.getLogger",
"traitlets.default",
"podpac.core.utils.common_doc",
"traitlets.Dict",
"traitlets.Instance",
"traitlets.List",
"numpy.isin",
"traitlets.Enum",
"numpy.array",
"traitlets.validate",
"podpac.core.coordinates.utils.make_coord_delta_array",
"podpac.core.node.COMMON_NODE_DOC.cop... | [((824, 851), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (841, 851), False, 'import logging\n'), ((5883, 5905), 'podpac.core.node.COMMON_NODE_DOC.copy', 'COMMON_NODE_DOC.copy', ([], {}), '()\n', (5903, 5905), False, 'from podpac.core.node import COMMON_NODE_DOC\n'), ((5981, 6008), 'po... |
import random
# Enemy Class
class Enemy():
def __init__(self, name, strength, defense, health, exp):
self.health = health
self.name = name
self.strength = strength
self.defense = defense
self.exp = exp
def attack(self, other):
# Roll For Enemy Attack
... | [
"random.randint"
] | [((332, 354), 'random.randint', 'random.randint', (['(1)', '(100)'], {}), '(1, 100)\n', (346, 354), False, 'import random\n'), ((467, 499), 'random.randint', 'random.randint', (['(1)', 'self.strength'], {}), '(1, self.strength)\n', (481, 499), False, 'import random\n')] |
# 0205.py
import cv2
from matplotlib import pyplot as plt
imageFile = './data/lena.jpg'
imgGray = cv2.imread(imageFile, cv2.IMREAD_GRAYSCALE)
plt.figure(figsize = (6, 6))
plt.subplots_adjust(left = 0, right = 1, bottom = 0, top = 1)
plt.imshow(imgGray, cmap = 'gray')
##plt.axis('tight')
plt.axis('off')
... | [
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axis",
"cv2.imread",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.show"
] | [((104, 147), 'cv2.imread', 'cv2.imread', (['imageFile', 'cv2.IMREAD_GRAYSCALE'], {}), '(imageFile, cv2.IMREAD_GRAYSCALE)\n', (114, 147), False, 'import cv2\n'), ((151, 177), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 6)'}), '(figsize=(6, 6))\n', (161, 177), True, 'from matplotlib import pyplot as ... |
"""
GraphSense API
GraphSense API # noqa: E501
The version of the OpenAPI document: 0.4.5
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import graphsense
from graphsense.model.tx_eth import TxEth
globals()['TxEth'] = TxEth
from graphsense.model.txs_eth import TxsEth
... | [
"unittest.main"
] | [((684, 699), 'unittest.main', 'unittest.main', ([], {}), '()\n', (697, 699), False, 'import unittest\n')] |
import json
from datetime import date, datetime
import requests
from .utilities import test_utility
def json_serial(obj):
"""JSON serializer for objects not serializable by default json code"""
if isinstance(obj, (datetime, date)):
return obj.isoformat()
raise TypeError ("Type %s not serializabl... | [
"json.dumps"
] | [((868, 912), 'json.dumps', 'json.dumps', (['self.result'], {'default': 'json_serial'}), '(self.result, default=json_serial)\n', (878, 912), False, 'import json\n')] |
from django.db import models
from embed_video.fields import EmbedVideoField
class Item(models.Model):
video = EmbedVideoField() # same like models.URLField()
| [
"embed_video.fields.EmbedVideoField"
] | [((115, 132), 'embed_video.fields.EmbedVideoField', 'EmbedVideoField', ([], {}), '()\n', (130, 132), False, 'from embed_video.fields import EmbedVideoField\n')] |
import requests
import time
import datetime
import pandas as pd
start_date = '2017/04/01'
end_date = '2020/04/01'
start_timestamp = datetime.datetime.strptime(start_date, "%Y/%m/%d").timestamp()
end_timestamp = datetime.datetime.strptime(end_date, "%Y/%m/%d").timestamp() + 3600 * 23
timeTo = end_timestamp
data = []
w... | [
"pandas.DataFrame",
"time.localtime",
"datetime.datetime.strptime",
"requests.get"
] | [((711, 729), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (723, 729), True, 'import pandas as pd\n'), ((452, 540), 'requests.get', 'requests.get', (['"""https://min-api.cryptocompare.com/data/v2/histohour"""'], {'params': 'payload'}), "('https://min-api.cryptocompare.com/data/v2/histohour', params=\... |
"""
Stocks Exchange API response parsers
"""
import requests
from pystexchapi.exc import APIResponseParsingException, APIDataException
__all__ = ('APIResponse', 'StockExchangeResponseParser')
class APIResponse(object):
def __init__(self, data, exc=None):
self.data = data
self.exc = exc
clas... | [
"pystexchapi.exc.APIResponseParsingException"
] | [((626, 679), 'pystexchapi.exc.APIResponseParsingException', 'APIResponseParsingException', ([], {'exc': 'e', 'response': 'response'}), '(exc=e, response=response)\n', (653, 679), False, 'from pystexchapi.exc import APIResponseParsingException, APIDataException\n')] |
import pytest
from regcore_read.views import search_utils
def inner_fn(request, search_args):
# We'd generally return a Response here, but we're mocking
return search_args
@pytest.mark.parametrize('page_size', ('-10', '0', '200', 'abcd', '---'))
def test_invalid_page_size(page_size, rf):
"""Invalid pag... | [
"regcore_read.views.search_utils.requires_search_args",
"pytest.mark.parametrize"
] | [((186, 258), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""page_size"""', "('-10', '0', '200', 'abcd', '---')"], {}), "('page_size', ('-10', '0', '200', 'abcd', '---'))\n", (209, 258), False, 'import pytest\n'), ((366, 409), 'regcore_read.views.search_utils.requires_search_args', 'search_utils.requires_s... |
from utils import *
from itertools import chain
if __name__ == "__main__":
W, frequencies = load_model("./Results/twitter_sentiment.model")
Xtest = read_data("./Data/testing_data.csv")
Ytest = read_data("./Data/testing_labels.csv")
Ytest = list( chain.from_iterable(Ytest) )
Xtest, Ytest = extract... | [
"itertools.chain.from_iterable"
] | [((265, 291), 'itertools.chain.from_iterable', 'chain.from_iterable', (['Ytest'], {}), '(Ytest)\n', (284, 291), False, 'from itertools import chain\n')] |
import logging
logger = logging.getLogger(__name__)
class Task:
def __init__(self):
"""
Create a task object. A task is one of a list of independent
execution tasks that are submitted to the execution engine
to be executed using the execute() method, commonly in parallel.
... | [
"logging.getLogger"
] | [((26, 53), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (43, 53), False, 'import logging\n')] |
"""
luigi-based pipeline for extracting full-domain 3D fields for single variables
at single timestep from per-core column output from the UCLALES model
"""
from pathlib import Path
import subprocess
import signal
import luigi
import xarray as xr
from ...data.base import (
XArrayTarget,
)
from .common import _fix... | [
"luigi.IntParameter",
"luigi.BoolParameter",
"pathlib.Path",
"subprocess.Popen",
"subprocess.CalledProcessError",
"xarray.concat",
"xarray.decode_cf",
"luigi.Parameter"
] | [((370, 392), 'pathlib.Path', 'Path', (['"""partials_xr/3d"""'], {}), "('partials_xr/3d')\n", (374, 392), False, 'from pathlib import Path\n'), ((832, 902), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'stdout': 'subprocess.PIPE', 'universal_newlines': '(True)'}), '(cmd, stdout=subprocess.PIPE, universal_newlines... |
import pytest
from asn1PERser.codec.per.decoder import decode as per_decoder
from asn1PERser.classes.data.builtin.BooleanType import BooleanType
@pytest.mark.parametrize("schema, encoded, value", [
(BooleanType, '80', BooleanType(value=True)),
(BooleanType, '00', BooleanType(value=False)),
])
def test_boolean... | [
"asn1PERser.classes.data.builtin.BooleanType.BooleanType"
] | [((224, 247), 'asn1PERser.classes.data.builtin.BooleanType.BooleanType', 'BooleanType', ([], {'value': '(True)'}), '(value=True)\n', (235, 247), False, 'from asn1PERser.classes.data.builtin.BooleanType import BooleanType\n'), ((274, 298), 'asn1PERser.classes.data.builtin.BooleanType.BooleanType', 'BooleanType', ([], {'... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-06-10 16:58
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('beer_carousel', '0002_auto_20180605_1010'),
]
operations = [
... | [
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((717, 829), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'to': '"""beer_carousel.BeerContainer"""'}), "(null=True, on_delete=django.db.models.deletion.SET_NULL,\n to='beer_carousel.BeerContainer')\n", (734, 829), False, 'from django.... |
import modelindex
import pytest
from modelindex import Metadata
from modelindex.models.Collection import Collection
from modelindex.models.CollectionList import CollectionList
from modelindex.models.Model import Model
from modelindex.models.ModelList import ModelList
from modelindex.models.Result import Result
from mod... | [
"modelindex.models.Result.Result",
"modelindex.load",
"copy.deepcopy"
] | [((460, 499), 'modelindex.load', 'modelindex.load', (['"""tests/test-mi/03_col"""'], {}), "('tests/test-mi/03_col')\n", (475, 499), False, 'import modelindex\n'), ((532, 549), 'copy.deepcopy', 'copy.deepcopy', (['m1'], {}), '(m1)\n', (545, 549), False, 'import copy\n'), ((1051, 1104), 'modelindex.load', 'modelindex.loa... |
"""High-dimensional output
This module concerns the following use-case: we make a parameter study over some
input parameters x and the domain code yields an output vector y contains many
entries. This is typically the case, when y is function-valued, i.e. depends
on an indenpendent variable t, or even "pixel-valued" o... | [
"numpy.linalg.eigh",
"numpy.mean",
"numpy.empty",
"numpy.diag"
] | [((2200, 2218), 'numpy.mean', 'np.mean', (['ytrain', '(0)'], {}), '(ytrain, 0)\n', (2207, 2218), True, 'import numpy as np\n'), ((2272, 2297), 'numpy.linalg.eigh', 'eigh', (['(self.dy @ self.dy.T)'], {}), '(self.dy @ self.dy.T)\n', (2276, 2297), False, 'from numpy.linalg import eigh\n'), ((2641, 2666), 'numpy.empty', '... |
from typing import Iterable
from collections import namedtuple
import pandas as pd
from ecodam_py.bedgraph import BedGraphAccessor, equalize_loci
from ecodam_py.eco_atac_normalization import normalize_with_site_density, serialize_bedgraph, prepare_site_density_for_norm
EcoDamData = namedtuple("EcoDamData", ["chrom"... | [
"ecodam_py.bedgraph.equalize_loci",
"ecodam_py.eco_atac_normalization.prepare_site_density_for_norm",
"collections.namedtuple"
] | [((287, 346), 'collections.namedtuple', 'namedtuple', (['"""EcoDamData"""', "['chrom', 'naked', 'theo', 'nfr']"], {}), "('EcoDamData', ['chrom', 'naked', 'theo', 'nfr'])\n", (297, 346), False, 'from collections import namedtuple\n'), ((783, 833), 'ecodam_py.eco_atac_normalization.prepare_site_density_for_norm', 'prepar... |
from flask_sqlalchemy import SQLAlchemy
from flask import jsonify
from flask_migrate import Migrate
from flask import render_template
from flask import Flask, session, redirect, url_for, request
import datetime
from flask_login import LoginManager,login_user,UserMixin
from sqlalchemy import create_engine
engine = creat... | [
"flask.render_template",
"flask_login.LoginManager",
"sqlalchemy.orm.sessionmaker",
"app.User",
"flask.Flask",
"flask_login.login_user",
"sqlalchemy.create_engine",
"datetime.datetime.now",
"flask_migrate.Migrate",
"flask_sqlalchemy.SQLAlchemy",
"app.User.query.get",
"flask.jsonify"
] | [((315, 379), 'sqlalchemy.create_engine', 'create_engine', (['"""mysql://root:root@localhost/postdata"""'], {'echo': '(True)'}), "('mysql://root:root@localhost/postdata', echo=True)\n", (328, 379), False, 'from sqlalchemy import create_engine\n'), ((430, 455), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {'bind'... |
from __future__ import annotations
from pathlib import Path
from typer import echo
from ..resolvers import clone_github, clone_local
from .resolver import Resolver
from .runner import Runner
from .variables import get_variables, read_variables
class NooCore:
def __init__(self, allow_shell: bool = False) -> Non... | [
"typer.echo",
"pathlib.Path"
] | [((513, 569), 'typer.echo', 'echo', (['f"""Starting clone process for {spec.name or name}."""'], {}), "(f'Starting clone process for {spec.name or name}.')\n", (517, 569), False, 'from typer import echo\n'), ((1253, 1313), 'typer.echo', 'echo', (['f"""Starting modification for {spec.name or \'unnamed\'}."""'], {}), '(f... |
# this is the test build for msync, master program
import opt1
import opt2
import opt3
print("Choose an option for your next step") #First choice offered
print("1. View Files")
print("2. Search Files")
print("3. Upload Files")
print("4. Exit")
x = 8
while x != 4 :
x = int(input("Enter your choice here : "))
if x... | [
"opt2.searchprint",
"opt1.listprint",
"opt3.updateprint"
] | [((454, 470), 'opt1.listprint', 'opt1.listprint', ([], {}), '()\n', (468, 470), False, 'import opt1\n'), ((679, 697), 'opt2.searchprint', 'opt2.searchprint', ([], {}), '()\n', (695, 697), False, 'import opt2\n'), ((893, 911), 'opt3.updateprint', 'opt3.updateprint', ([], {}), '()\n', (909, 911), False, 'import opt3\n')] |
from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from .models import Boarding
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.views import generic
class IndexView(generic.ListView):
model = Boarding
template_na... | [
"django.shortcuts.render"
] | [((697, 762), 'django.shortcuts.render', 'render', (['request', '"""bookings/search.html"""', "{'boardings': boardings}"], {}), "(request, 'bookings/search.html', {'boardings': boardings})\n", (703, 762), False, 'from django.shortcuts import render\n')] |
import ast
import re
from collections import defaultdict
class AbstractTreeAnalysis():
DEFAULT_REULES = {
"line_length": 79,
"forbid_semicolons": True,
"max_nesting": 1,
"indentation_size": 4,
"methods_per_class": None,
"max_arity": 2,
"forbid_trailing_whit... | [
"ast.parse",
"ast.walk",
"collections.defaultdict",
"re.search"
] | [((428, 445), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (439, 445), False, 'from collections import defaultdict\n'), ((3396, 3411), 'ast.parse', 'ast.parse', (['code'], {}), '(code)\n', (3405, 3411), False, 'import ast\n'), ((855, 869), 'ast.walk', 'ast.walk', (['tree'], {}), '(tree)\n', (86... |
# Copyright (C) 2015 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ycmd... | [
"ycmd.tests.python.PathToTestFile",
"nose.tools.eq_",
"ycmd.tests.test_utils.ErrorMatcher",
"ycmd.tests.test_utils.BuildRequest",
"ycmd.utils.ReadFile"
] | [((1218, 1261), 'ycmd.tests.python.PathToTestFile', 'PathToTestFile', (["test['request']['filename']"], {}), "(test['request']['filename'])\n", (1232, 1261), False, 'from ycmd.tests.python import PathToTestFile, SharedYcmd\n'), ((2657, 2830), 'ycmd.tests.test_utils.BuildRequest', 'BuildRequest', ([], {'completer_target... |
import os
class PathClass:
# -Folders-
relative_path = os.path.dirname(__file__)
debug_path = os.path.join(relative_path, "debug")
data_path = os.path.join(relative_path, "data")
image_path = os.path.join(relative_path, "images")
if not os.path.exists(image_path):
os.makedirs(image_pat... | [
"os.path.dirname",
"os.path.exists",
"os.path.join",
"os.makedirs"
] | [((65, 90), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (80, 90), False, 'import os\n'), ((108, 144), 'os.path.join', 'os.path.join', (['relative_path', '"""debug"""'], {}), "(relative_path, 'debug')\n", (120, 144), False, 'import os\n'), ((161, 196), 'os.path.join', 'os.path.join', (['rel... |
import xlrd
from flask import Flask, request, url_for, redirect
from flask import render_template
from flask import jsonify
app = Flask(__name__)
def calc_info(player):
laps = 59
xl = xlrd.open_workbook(r'times.xlsx')
table = xl.sheets()[0]
start = (player - 1) * laps + 1
end = start + laps
co... | [
"flask.render_template",
"xlrd.open_workbook",
"flask.Flask"
] | [((131, 146), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (136, 146), False, 'from flask import Flask, request, url_for, redirect\n'), ((194, 226), 'xlrd.open_workbook', 'xlrd.open_workbook', (['"""times.xlsx"""'], {}), "('times.xlsx')\n", (212, 226), False, 'import xlrd\n'), ((699, 736), 'xlrd.open_wor... |
import time, hashlib, statistics
my_strings = [str(i) for i in range(0, 1000000)]
def measure_time(strings: list) -> float:
start = time.process_time_ns()
for num in strings:
hashlib.sha1(num.encode()).hexdigest()
end = time.process_time_ns() - start
return end
if __name__ == "__main__":
... | [
"statistics.median",
"time.process_time_ns"
] | [((138, 160), 'time.process_time_ns', 'time.process_time_ns', ([], {}), '()\n', (158, 160), False, 'import time, hashlib, statistics\n'), ((394, 420), 'statistics.median', 'statistics.median', (['timings'], {}), '(timings)\n', (411, 420), False, 'import time, hashlib, statistics\n'), ((242, 264), 'time.process_time_ns'... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import print_function, division
import numpy as np
from numpy.testing import assert_allclose, assert_equal
import os
import tempfile
from astropy.io import fits
from astropy.tests.helper import pytest
from astropy.units import Quantity
from... | [
"numpy.ones_like",
"numpy.ones",
"astropy.tests.helper.pytest.mark.skipif",
"numpy.testing.assert_allclose",
"scipy.ndimage.convolve",
"astropy.coordinates.angles.Angle",
"os.removedirs",
"tempfile.mkdtemp",
"astropy.io.fits.open",
"astropy.units.Quantity"
] | [((684, 719), 'astropy.tests.helper.pytest.mark.skipif', 'pytest.mark.skipif', (['"""not HAS_SCIPY"""'], {}), "('not HAS_SCIPY')\n", (702, 719), False, 'from astropy.tests.helper import pytest\n'), ((1531, 1566), 'astropy.tests.helper.pytest.mark.skipif', 'pytest.mark.skipif', (['"""not HAS_SCIPY"""'], {}), "('not HAS_... |
# -*- coding: utf-8 -*-
import copy
import os
import sys
from typing import List
sys.path.append('../bark')
from bark import bark
from wox import Wox
from .template import *
class Main(Wox):
messages_queue = []
def sendNormalMess(self, title: str, subtitle: str):
message = copy.deepcopy(RESULT_TE... | [
"sys.path.append",
"bark.bark",
"copy.deepcopy"
] | [((82, 108), 'sys.path.append', 'sys.path.append', (['"""../bark"""'], {}), "('../bark')\n", (97, 108), False, 'import sys\n'), ((297, 327), 'copy.deepcopy', 'copy.deepcopy', (['RESULT_TEMPLATE'], {}), '(RESULT_TEMPLATE)\n', (310, 327), False, 'import copy\n'), ((568, 579), 'bark.bark', 'bark', (['param'], {}), '(param... |
import re
import os
import pickle
import time
import datetime
import json
import ipdb
import requests
import pandas as pd
from bs4 import BeautifulSoup
VALID_TAGS = ['div', 'p']
def clean_tag(tag):
return re.sub('<[^<>]*>', ' ', str(tag)).strip()
def clean_html(soup):
doc = ""
for tag in soup.findAll('p... | [
"pandas.read_csv",
"datetime.datetime.strptime",
"json.dumps",
"requests.get",
"time.sleep",
"bs4.BeautifulSoup",
"os.path.isdir",
"os.mkdir",
"datetime.datetime.today",
"datetime.timedelta"
] | [((553, 570), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (565, 570), False, 'import requests\n'), ((1171, 1219), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['"""20180702"""', '"""%Y%m%d"""'], {}), "('20180702', '%Y%m%d')\n", (1197, 1219), False, 'import datetime\n'), ((1235, 1260), 'dat... |
import os, uuid
from azure.storage.queue import (QueueClient,
BinaryBase64EncodePolicy,
BinaryBase64DecodePolicy)
QUEUE_CONNECTION_STRING = os.getenv('QUEUE_CONNECTION_STRING')
def get_queue_client_from_queue_name(queue_name):
queue_client = QueueC... | [
"azure.storage.queue.QueueClient.from_connection_string",
"os.getenv",
"uuid.uuid4"
] | [((207, 243), 'os.getenv', 'os.getenv', (['"""QUEUE_CONNECTION_STRING"""'], {}), "('QUEUE_CONNECTION_STRING')\n", (216, 243), False, 'import os, uuid\n'), ((314, 509), 'azure.storage.queue.QueueClient.from_connection_string', 'QueueClient.from_connection_string', ([], {'conn_str': 'QUEUE_CONNECTION_STRING', 'queue_name... |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from swagger_server.models.base_model_ import Model
from swagger_server import util
class ContextParameters(Model):
"""NOTE: This class is auto generated by the s... | [
"swagger_server.util.deserialize_model"
] | [((1900, 1933), 'swagger_server.util.deserialize_model', 'util.deserialize_model', (['dikt', 'cls'], {}), '(dikt, cls)\n', (1922, 1933), False, 'from swagger_server import util\n')] |
import pandas as pd
import pytest
from app.src.predict import Predict
def test_predict(predict: Predict, x_test: pd.DataFrame):
try:
y_predict = predict.predict(x_test) # noqa
except Exception as exception:
pytest.fail(f'Prediction failed: {exception}')
| [
"pytest.fail"
] | [((238, 284), 'pytest.fail', 'pytest.fail', (['f"""Prediction failed: {exception}"""'], {}), "(f'Prediction failed: {exception}')\n", (249, 284), False, 'import pytest\n')] |
'''
This file defines the Tensorflow computation graph for the ST-ResNet (Deep Spatio-temporal Residual Networks) architecture. The skeleton of the architecture from inputs to outputs in defined here using calls to functions defined in modules.py. Modularity ensures that the functioning of a component can be easily mod... | [
"tensorflow.tile",
"tensorflow.reduce_sum",
"modules.Fusion",
"modules.ResInput",
"tensorflow.Graph",
"tensorflow.pow",
"tensorflow.placeholder",
"tensorflow.concat",
"tensorflow.layers.conv2d",
"tensorflow.train.AdamOptimizer",
"tensorflow.summary.scalar",
"tensorflow.device",
"tensorflow.s... | [((602, 612), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (610, 612), True, 'import tensorflow as tf\n'), ((11422, 11432), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (11430, 11432), True, 'import tensorflow as tf\n'), ((9348, 9420), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[N... |
"""
Optuna example that optimizes multi-layer perceptrons using Catalyst.
In this example, we optimize the validation accuracy of hand-written digit recognition using
Catalyst, and FashionMNIST. We optimize the neural network architecture.
You can run this example as follows, pruning can be turned on and off with the... | [
"catalyst.dl.SupervisedRunner",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.CrossEntropyLoss",
"argparse.ArgumentParser",
"torch.nn.Sequential",
"torch.nn.Flatten",
"catalyst.dl.OptunaPruningCallback",
"optuna.pruners.NopPruner",
"os.getcwd",
"catalyst.dl.AccuracyCallback",
"torch.nn.Linear... | [((1640, 1662), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (1653, 1662), False, 'from torch import nn\n'), ((2245, 2272), 'torch.nn.CrossEntropyLoss', 'torch.nn.CrossEntropyLoss', ([], {}), '()\n', (2270, 2272), False, 'import torch\n'), ((2308, 2326), 'catalyst.dl.SupervisedRunner', 'Sup... |
from django.conf.urls import url
from django.views.i18n import JavaScriptCatalog
from finder import views
urlpatterns = [
url(r'^jsi18n/$', JavaScriptCatalog.as_view(packages=['finder']), name='javascript-catalog'),
url(r'^setlang/$', views.set_language, name='set_language'),
url(r'^api/$', views.api, nam... | [
"django.views.i18n.JavaScriptCatalog.as_view",
"django.conf.urls.url"
] | [((226, 284), 'django.conf.urls.url', 'url', (['"""^setlang/$"""', 'views.set_language'], {'name': '"""set_language"""'}), "('^setlang/$', views.set_language, name='set_language')\n", (229, 284), False, 'from django.conf.urls import url\n'), ((291, 330), 'django.conf.urls.url', 'url', (['"""^api/$"""', 'views.api'], {'... |
# Generated by Django 3.0.7 on 2020-07-09 18:17
import django.contrib.gis.db.models.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('web', '0050_shelter_location'),
]
operations = [
migrations.RemoveField(
model_name='shelter'... | [
"django.db.migrations.RemoveField"
] | [((264, 325), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""shelter"""', 'name': '"""latitude"""'}), "(model_name='shelter', name='latitude')\n", (286, 325), False, 'from django.db import migrations\n'), ((370, 432), 'django.db.migrations.RemoveField', 'migrations.RemoveField', (... |
#! /usr/bin/env python3
from pattern_printer import Paper
paperout = Paper()
paperout.switch2dict()
paperout.paperdict[(1, 1)] = 'a'
paperout.paperdict[(2, 2)] = 'b'
paperout.paperdict[(1, 3)] = 'c'
paperout.paperdict
paperout.switch2list()
paperout.paperlist
print(paperout.sprint())
| [
"pattern_printer.Paper"
] | [((69, 76), 'pattern_printer.Paper', 'Paper', ([], {}), '()\n', (74, 76), False, 'from pattern_printer import Paper\n')] |
#!/usr/bin/python3
'''Advent of Code 2018 Day 24 tests'''
import unittest
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from aoc2018 import day24 # pylint: disable=wrong-import-position
class TestUM(unittest.TestCase):
'''Unit Tests'''
def test_day24par... | [
"aoc2018.day24.runpart2",
"os.path.dirname",
"aoc2018.day24.readinputdata",
"aoc2018.day24.runpart1"
] | [((143, 168), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (158, 168), False, 'import os\n'), ((437, 459), 'aoc2018.day24.readinputdata', 'day24.readinputdata', (['f'], {}), '(f)\n', (456, 459), False, 'from aoc2018 import day24\n'), ((486, 508), 'aoc2018.day24.runpart1', 'day24.runpart1', ... |
from .base_controller import BaseController
from .connection import Connection
from aiohttp import (
web,
ClientSession,
ClientRequest,
ClientResponse,
ClientError,
ClientTimeout,
)
import logging
import asyncio
logger = logging.getLogger("aries_controller.connections")
class ConnectionsCont... | [
"logging.getLogger"
] | [((248, 297), 'logging.getLogger', 'logging.getLogger', (['"""aries_controller.connections"""'], {}), "('aries_controller.connections')\n", (265, 297), False, 'import logging\n')] |
import os
project_path = os.getenv("PROJECT_PATH")
postgres_username = os.getenv("POSTGRES_USERNAME")
postgres_password = os.getenv("<PASSWORD>")
postgres_ipaddress = os.getenv("POSTGRES_IPADDRESS")
minio_access_key = os.getenv("MINIO_ACCESS_KEY")
minio_secret_key = os.getenv("MINIO_SECRET_KEY")
minio_ipaddress = os... | [
"os.path.join",
"os.getenv"
] | [((26, 51), 'os.getenv', 'os.getenv', (['"""PROJECT_PATH"""'], {}), "('PROJECT_PATH')\n", (35, 51), False, 'import os\n'), ((73, 103), 'os.getenv', 'os.getenv', (['"""POSTGRES_USERNAME"""'], {}), "('POSTGRES_USERNAME')\n", (82, 103), False, 'import os\n'), ((124, 147), 'os.getenv', 'os.getenv', (['"""<PASSWORD>"""'], {... |
import click
import json
from collections import defaultdict
import random
import os
import boto3
import imageio
from PIL import ImageFont, ImageDraw, Image
import cv2
import numpy as np
from retry.api import retry_call
def generate_url(s3, bucket_name, key):
return s3.generate_presigned_url(
ClientMetho... | [
"cv2.rectangle",
"click.argument",
"PIL.Image.fromarray",
"boto3.client",
"os.makedirs",
"click.option",
"os.path.join",
"PIL.ImageFont.truetype",
"numpy.ascontiguousarray",
"numpy.array",
"PIL.ImageDraw.Draw",
"os.path.basename",
"click.command",
"random.randint"
] | [((451, 466), 'click.command', 'click.command', ([], {}), '()\n', (464, 466), False, 'import click\n'), ((468, 494), 'click.argument', 'click.argument', (['"""filename"""'], {}), "('filename')\n", (482, 494), False, 'import click\n'), ((496, 524), 'click.argument', 'click.argument', (['"""output_dir"""'], {}), "('outpu... |
"""PAX mechanisms to make PAX functions pure."""
import functools
from types import MethodType
from typing import Any, Callable, Tuple, TypeVar
import jax
from .base import BaseModule
from .threading_local import allow_mutation
T = TypeVar("T")
O = TypeVar("O")
def pure(func: Callable):
"""Make a function pur... | [
"jax.tree_flatten",
"jax.tree_unflatten",
"functools.wraps",
"typing.TypeVar"
] | [((236, 248), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (243, 248), False, 'from typing import Any, Callable, Tuple, TypeVar\n'), ((253, 265), 'typing.TypeVar', 'TypeVar', (['"""O"""'], {}), "('O')\n", (260, 265), False, 'from typing import Any, Callable, Tuple, TypeVar\n'), ((1016, 1037), 'functools.w... |
from os import listdir
from os.path import join
import numpy as np
from cv2 import resize
from imageio import imread
def txt_to_array(path):
with open(path) as file:
return [[float(word.strip()) for word in line.split(' ')] for line in file]
def load_pictures(args):
basedir = args.datadir
downs... | [
"numpy.ceil",
"os.listdir",
"numpy.asarray",
"os.path.join",
"numpy.floor",
"numpy.diag",
"numpy.linalg.norm",
"imageio.imread",
"cv2.resize",
"numpy.arange"
] | [((384, 404), 'os.path.join', 'join', (['basedir', '"""rgb"""'], {}), "(basedir, 'rgb')\n", (388, 404), False, 'from os.path import join\n'), ((421, 442), 'os.path.join', 'join', (['basedir', '"""pose"""'], {}), "(basedir, 'pose')\n", (425, 442), False, 'from os.path import join\n'), ((964, 988), 'numpy.asarray', 'np.a... |
import numpy as np
import torch
from ..callback.progressbar import ProgressBar
from ..common.tools import restore_checkpoint,model_device
from ..common.tools import summary
from ..common.tools import seed_everything
from ..common.tools import AverageMeter
from torch.nn.utils import clip_grad_norm_
from pybert.train.met... | [
"apex.amp.scale_loss",
"pybert.train.metrics.EIM",
"torch.load",
"apex.amp.master_params",
"pybert.train.metrics.REIM",
"pybert.train.metrics.RIIM",
"pybert.train.metrics.Recall",
"torch.no_grad",
"pybert.train.metrics.NDCG",
"torch.cuda.empty_cache",
"torch.cat",
"pybert.train.metrics.MRR"
] | [((2216, 2263), 'torch.load', 'torch.load', (["(resume_path / 'checkpoint_info.bin')"], {}), "(resume_path / 'checkpoint_info.bin')\n", (2226, 2263), False, 'import torch\n'), ((3301, 3306), 'pybert.train.metrics.MRR', 'MRR', ([], {}), '()\n', (3304, 3306), False, 'from pybert.train.metrics import MRR, Recall, NDCG, EI... |
import matplotlib
#matplotlib.style.use('classic')
matplotlib.use('Agg')
import matplotlib.pyplot as pl
import numpy as np
from brian2.units import *
import sys, pickle
with open('data/plst_net_red_arec0.05_affwd0.10_N4993_T50000ms_stdphom_selfrm.p', 'rb') as pfile:
st005_010 = pickle.load(pfile)
st005_010... | [
"numpy.histogram",
"matplotlib.use",
"pickle.load",
"matplotlib.rc",
"matplotlib.pyplot.subplots"
] | [((52, 73), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (66, 73), False, 'import matplotlib\n'), ((1308, 1342), 'matplotlib.rc', 'matplotlib.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (1321, 1342), False, 'import matplotlib\n'), ((288, 306), 'pickle.load', 'pickle.... |
#!/usr/bin/env python3
#
# SPDX-License-Identifier: MIT
"""Generate the FSF license API JSON data from the FSF license list page."""
import argparse
import glob
import html
import io
import json
import os
import re
import urllib.parse
import urllib.request
import lxml.etree
SOURCE_URI = 'https://www.gnu.org/licens... | [
"os.link",
"argparse.ArgumentParser",
"os.makedirs",
"io.StringIO",
"os.path.join",
"html.unescape",
"re.findall",
"json.dump",
"os.remove"
] | [((8449, 8475), 'io.StringIO', 'io.StringIO', (['response_data'], {}), '(response_data)\n', (8460, 8475), False, 'import io\n'), ((10699, 10733), 'os.path.join', 'os.path.join', (['output_dir', '"""schema"""'], {}), "(output_dir, 'schema')\n", (10711, 10733), False, 'import os\n'), ((10738, 10776), 'os.makedirs', 'os.m... |
import logging
import multiprocessing
from processor import Processor
logger = logging.getLogger(__name__)
class StubProcessor(Processor):
def __init__(self, configs):
super().__init__()
self.data_type_configs = configs
def _load_and_process_data(self):
logger.debug("in StubProcesso... | [
"logging.getLogger"
] | [((81, 108), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (98, 108), False, 'import logging\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-01 08:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tracks', '0011_auto_20161129_1442'),
]
operations = [
migrations.AlterField... | [
"django.db.models.DateField"
] | [((403, 421), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (419, 421), False, 'from django.db import migrations, models\n')] |
"""
Summary:
Contains the HeadDataItem class. Used for storing data types, values,
formatting and location of data stored in the head_data dict.
Author:
<NAME>
Created:
01 Apr 2016
Copyright:
<NAME> 2016
TODO:
Updates:
"""
from __future__ import unico... | [
"logging.getLogger",
"ship.utils.utilfunctions.isString",
"ship.utils.utilfunctions.isNumeric"
] | [((373, 400), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (390, 400), False, 'import logging\n'), ((5693, 5711), 'ship.utils.utilfunctions.isString', 'uf.isString', (['value'], {}), '(value)\n', (5704, 5711), True, 'from ship.utils import utilfunctions as uf\n'), ((5980, 5999), 'ship.u... |
from django.core.management.base import BaseCommand, CommandError
from performers.models import Performer
class Command(BaseCommand):
help = ''
def handle(self, *args, **options):
for performer in Performer.objects.all():
self.stdout.write('Loading {}...'.format(performer), ending='')
... | [
"performers.models.Performer.objects.all"
] | [((216, 239), 'performers.models.Performer.objects.all', 'Performer.objects.all', ([], {}), '()\n', (237, 239), False, 'from performers.models import Performer\n')] |
'''
'''
import struct
class Float_Array:
'''
'''
def __init__(self, number_of_floats):
'''
'''
#construct the message format
self.message_constructor = ''
for i in range(number_of_floats):
self.message_constructor += 'f'
#number of bytes for this... | [
"struct.unpack",
"struct.pack"
] | [((451, 498), 'struct.pack', 'struct.pack', (['self.message_constructor', '*message'], {}), '(self.message_constructor, *message)\n', (462, 498), False, 'import struct\n'), ((614, 670), 'struct.unpack', 'struct.unpack', (['self.message_constructor', 'encoded_message'], {}), '(self.message_constructor, encoded_message)\... |
from lexer import Lexer, SymbolTable, libraryIncluded
from tqdm import tqdm
from time import perf_counter
import tracemalloc
import argparse
GlobalVariableTable = SymbolTable()
STORYSCRIPT_INTERPRETER_DEBUG_MODE = True
def parse_string_list(self, command):
res = ""
for i in command:
res += i + " "
res = res[:-1]... | [
"lexer.SymbolTable",
"tracemalloc.start",
"argparse.ArgumentParser",
"tqdm.tqdm",
"time.perf_counter",
"os.getcwd",
"tracemalloc.stop",
"tracemalloc.get_traced_memory",
"traceback.print_exc",
"lexer.Lexer"
] | [((164, 177), 'lexer.SymbolTable', 'SymbolTable', ([], {}), '()\n', (175, 177), False, 'from lexer import Lexer, SymbolTable, libraryIncluded\n'), ((721, 740), 'tracemalloc.start', 'tracemalloc.start', ([], {}), '()\n', (738, 740), False, 'import tracemalloc\n'), ((755, 769), 'time.perf_counter', 'perf_counter', ([], {... |
##original script found here, modified https://stackoverflow.com/questions/36503042/how-to-get-taxonomic-specific-ids-for-kingdom-phylum-class-order-family-gen
import csv
import re
from ete3 import NCBITaxa
ncbi = NCBITaxa()
def get_desired_ranks(taxid, desired_ranks):
#print taxid
lineage = ncbi.get_lineage... | [
"csv.DictWriter",
"re.findall",
"ete3.NCBITaxa"
] | [((216, 226), 'ete3.NCBITaxa', 'NCBITaxa', ([], {}), '()\n', (224, 226), False, 'from ete3 import NCBITaxa\n'), ((709, 738), 're.findall', 're.findall', (['"""\'(.*?)\'"""', 'buffer'], {}), '("\'(.*?)\'", buffer)\n', (719, 738), False, 'import re\n'), ((1133, 1195), 'csv.DictWriter', 'csv.DictWriter', (['csvfile'], {'d... |
import torch
from torch import nn, Tensor
from torch.nn.utils.rnn import PackedSequence
from sklearn import metrics
import numpy as np
from tqdm import tqdm
from typing import Optional
from collections import OrderedDict
class LSTM_CNN2(nn.Module):
def __init__(self, input_dim=390, hidden_dim=8, lstm_layers=1):
... | [
"torch.nn.MaxPool1d",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.LSTM",
"torch.nn.Flatten",
"torch.nn.init.xavier_uniform_",
"torch.sigmoid",
"numpy.floor",
"torch.nn.LayerNorm",
"torch.nn.init.zeros_",
"torch.nn.functional.dropout",
"torch.nn.utils.rnn.PackedSequence",
"torch.nn.init.or... | [((2436, 2460), 'torch.nn.Dropout', 'nn.Dropout', (['self.dropout'], {}), '(self.dropout)\n', (2446, 2460), False, 'from torch import nn, Tensor\n'), ((3749, 3775), 'torch.nn.Dropout', 'nn.Dropout', (['self.drop_conv'], {}), '(self.drop_conv)\n', (3759, 3775), False, 'from torch import nn, Tensor\n'), ((3797, 3830), 't... |
import os
import tempfile
import pytest
pygraphviz = pytest.importorskip("pygraphviz")
import easygraph as eg
from easygraph.utils import nodes_equal, edges_equal
class TestAGraph:
def build_graph(self, G):
edges = [("A", "B"), ("A", "C"), ("A", "C"), ("B", "C"), ("A", "D")]
G.add_edges_from(ed... | [
"easygraph.utils.edges_equal",
"easygraph.read_dot",
"os.close",
"easygraph.to_agraph",
"pytest.importorskip",
"easygraph.utils.nodes_equal",
"os.unlink",
"easygraph.Graph",
"easygraph.from_agraph",
"easygraph.write_dot",
"tempfile.mkstemp"
] | [((54, 87), 'pytest.importorskip', 'pytest.importorskip', (['"""pygraphviz"""'], {}), "('pygraphviz')\n", (73, 87), False, 'import pytest\n'), ((454, 485), 'easygraph.utils.nodes_equal', 'nodes_equal', (['G1.nodes', 'G2.nodes'], {}), '(G1.nodes, G2.nodes)\n', (465, 485), False, 'from easygraph.utils import nodes_equal,... |
import datetime
import time
import os
import re
import socket
host_name = socket.gethostname()
def unix_time(dt):
epoch = datetime.datetime.utcfromtimestamp(0)
delta = dt - epoch
return delta.total_seconds()
def sec_from_epoch2datetime(seconds):
return datetime.datetime.fromtimestamp(seconds)
def ge... | [
"datetime.datetime.utcfromtimestamp",
"datetime.datetime.fromtimestamp",
"time.sleep",
"datetime.datetime.now",
"os.popen",
"re.findall",
"socket.gethostname"
] | [((75, 95), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (93, 95), False, 'import socket\n'), ((128, 165), 'datetime.datetime.utcfromtimestamp', 'datetime.datetime.utcfromtimestamp', (['(0)'], {}), '(0)\n', (162, 165), False, 'import datetime\n'), ((272, 312), 'datetime.datetime.fromtimestamp', 'dateti... |
# Import libraries
from flask import Flask, request, render_template
from flask import Flask,render_template, request
import pickle
import torch
#from generate import generate_images
import pprint
app = Flask(__name__)
@app.route('/',methods=["GET", "POST"])
def home(name=None):
return r... | [
"flask.render_template",
"flask.Flask",
"pickle.load",
"flask.request.form.get",
"torch.randn"
] | [((215, 230), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (220, 230), False, 'from flask import Flask, render_template, request\n'), ((319, 347), 'flask.render_template', 'render_template', (['"""home.html"""'], {}), "('home.html')\n", (334, 347), False, 'from flask import Flask, render_template, reques... |
# encoding: utf-8
import ckan.plugins.toolkit as tk
from ckan import model
_permissions_map = {
'metadata': {
'view': [
'metadata_record_list',
'metadata_record_show',
'metadata_collection_show',
'organization_show',
'infrastructure_show',
... | [
"ckan.plugins.toolkit.get_action",
"ckan.model.repo.commit"
] | [((4830, 4849), 'ckan.model.repo.commit', 'model.repo.commit', ([], {}), '()\n', (4847, 4849), False, 'from ckan import model\n'), ((4988, 5026), 'ckan.plugins.toolkit.get_action', 'tk.get_action', (['"""permission_delete_all"""'], {}), "('permission_delete_all')\n", (5001, 5026), True, 'import ckan.plugins.toolkit as ... |
import collections
import sys
import unicodedata
USAGE = "usage: {prog} [--help] < INPUT > OUTPUT"
HELP = """The program reads UTF-8 text from stdin and writes to stdout information
about each character, one per line.
The output has 5 tab-separated columns:
1 - the character itself, if printable, or an escaped re... | [
"unicodedata.category",
"collections.namedtuple",
"unicodedata.name",
"sys.exit"
] | [((695, 761), 'collections.namedtuple', 'collections.namedtuple', (['"""UCInfo"""', '"""printable code octets cat name"""'], {}), "('UCInfo', 'printable code octets cat name')\n", (717, 761), False, 'import collections\n'), ((892, 915), 'unicodedata.category', 'unicodedata.category', (['c'], {}), '(c)\n', (912, 915), F... |
import ujson
class TestAccount:
def test_get_account_without_auth(self, test_server):
res = test_server.get("/account")
assert res.status_code == 401
def test_get_info(self, test_server, create_account_jwt):
res = test_server.get(
"/account", headers={"Authorization": f"Be... | [
"ujson.dumps"
] | [((898, 918), 'ujson.dumps', 'ujson.dumps', (['payload'], {}), '(payload)\n', (909, 918), False, 'import ujson\n'), ((1461, 1481), 'ujson.dumps', 'ujson.dumps', (['payload'], {}), '(payload)\n', (1472, 1481), False, 'import ujson\n'), ((1790, 1810), 'ujson.dumps', 'ujson.dumps', (['payload'], {}), '(payload)\n', (1801,... |