code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env mayapy
#
# Copyright 2021 Autodesk
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"maya.api.OpenMaya.MFnDagNode",
"unittest.main",
"mayaUsd.lib.PrimUpdater.Register",
"maya.cmds.playbackOptions",
"pxr.Tf.Type.FindByName",
"fixturesUtils.setUpClass",
"pxr.Sdf.CopySpec",
"mayaUsd.lib.PrimUpdaterManager.mergeToUsd",
"maya.cmds.ls",
"pxr.Usd.SchemaRegistry",
"mayaUsd.ufe.getStage... | [((12801, 12827), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (12814, 12827), False, 'import unittest\n'), ((1392, 1427), 'maya.cmds.parent', 'cmds.parent', (['rigNode', 'parentDagPath'], {}), '(rigNode, parentDagPath)\n', (1403, 1427), False, 'from maya import cmds\n'), ((1453, 147... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-18 10:55
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('shop', '0017_auto_20171217_2255'),
]
operations = [
migrations.RemoveField(
... | [
"django.db.migrations.RemoveField"
] | [((289, 352), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""soldvehicles"""', 'name': '"""photo"""'}), "(model_name='soldvehicles', name='photo')\n", (311, 352), False, 'from django.db import migrations\n')] |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:owefsad
# software: PyCharm
# project: lingzhi-webapi
import logging
from dongtai.endpoint import UserEndPoint, R
from dongtai.utils import const
from iast.utils import get_model_field
from dongtai.models.agent import IastAgent
from django.forms.models import mod... | [
"dongtai.models.agent.IastAgent.objects.filter",
"django.utils.translation.gettext_lazy",
"django.forms.models.model_to_dict"
] | [((618, 640), 'django.utils.translation.gettext_lazy', '_', (['"""The name of agent"""'], {}), "('The name of agent')\n", (619, 640), True, 'from django.utils.translation import gettext_lazy as _\n'), ((683, 703), 'django.utils.translation.gettext_lazy', '_', (['"""The id of agent"""'], {}), "('The id of agent')\n", (6... |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: ppx
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class Sample(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffe... | [
"flatbuffers.table.Table",
"flatbuffers.encode.Get",
"flatbuffers.util.BufferHasIdentifier",
"flatbuffers.number_types.UOffsetTFlags.py_type",
"flatbuffers.compat.import_numpy"
] | [((156, 170), 'flatbuffers.compat.import_numpy', 'import_numpy', ([], {}), '()\n', (168, 170), False, 'from flatbuffers.compat import import_numpy\n'), ((288, 351), 'flatbuffers.encode.Get', 'flatbuffers.encode.Get', (['flatbuffers.packer.uoffset', 'buf', 'offset'], {}), '(flatbuffers.packer.uoffset, buf, offset)\n', (... |
import os
import sys
import pyperclip
def find_file(directory, file_name):
for root, dirs, files in os.walk(directory):
for basename in files:
if file_name in basename:
extension = basename.split('.')
extension = extension[len(extension) - 1]
fl_... | [
"os.path.abspath",
"pyperclip.copy",
"os.walk"
] | [((106, 124), 'os.walk', 'os.walk', (['directory'], {}), '(directory)\n', (113, 124), False, 'import os\n'), ((1852, 1871), 'pyperclip.copy', 'pyperclip.copy', (['out'], {}), '(out)\n', (1866, 1871), False, 'import pyperclip\n'), ((617, 642), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (63... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
PointsAlongGeometry.py
---------------------
Date : August 2016
Copyright : (C) 2016 by <NAME>
Email : <EMAIL> dot <EMAIL> at <EMAIL> dot <EMAIL>
*******... | [
"qgis.core.QgsFeature",
"os.path.dirname",
"qgis.core.QgsApplication.iconPath",
"qgis.core.QgsApplication.getThemeIcon",
"qgis.core.QgsField"
] | [((2119, 2191), 'qgis.core.QgsApplication.getThemeIcon', 'QgsApplication.getThemeIcon', (['"""/algorithms/mAlgorithmExtractVertices.svg"""'], {}), "('/algorithms/mAlgorithmExtractVertices.svg')\n", (2146, 2191), False, 'from qgis.core import QgsApplication, QgsFeature, QgsFeatureSink, QgsWkbTypes, QgsField, QgsProcessi... |
# Copyright 2020 <NAME>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | [
"google.protobuf.empty_pb2.Empty"
] | [((1605, 1612), 'google.protobuf.empty_pb2.Empty', 'Empty', ([], {}), '()\n', (1610, 1612), False, 'from google.protobuf.empty_pb2 import Empty\n')] |
import uuid
import datetime
from enum import Enum
from typing import Dict, List
from reqif.models.reqif_core_content import ReqIFCoreContent
from reqif.models.reqif_data_type import (
ReqIFDataTypeDefinitionString,
ReqIFDataTypeDefinitionEnumeration,
ReqIFEnumValue,
)
from reqif.models.reqif_namespace_info... | [
"reqif.object_lookup.ReqIFObjectLookup",
"reqif.models.reqif_req_if_content.ReqIFReqIFContent",
"strictdoc.core.document_iterator.DocumentCachingIterator",
"reqif.models.reqif_namespace_info.ReqIFNamespaceInfo",
"reqif.models.reqif_spec_object.SpecObjectAttribute",
"reqif.models.reqif_spec_object.ReqIFSpe... | [((13789, 13976), 'reqif.models.reqif_req_if_content.ReqIFReqIFContent', 'ReqIFReqIFContent', ([], {'data_types': 'data_types', 'spec_types': 'spec_types', 'spec_objects': 'spec_objects', 'spec_relations': 'spec_relations', 'specifications': 'specifications', 'spec_relation_groups': 'None'}), '(data_types=data_types, s... |
import lib.utils as utils
def read(href, key):
print("read called")
newurl= href +'/' + key +'/kv'
return utils.makeStoreRequest(method='GET', jsonData={'True': True}, url=newurl)
def write(href, key, data):
print("write called")
if(data):
newurl = href + '/' + key + '/kv'
else:
... | [
"lib.utils.makeStoreRequest"
] | [((120, 193), 'lib.utils.makeStoreRequest', 'utils.makeStoreRequest', ([], {'method': '"""GET"""', 'jsonData': "{'True': True}", 'url': 'newurl'}), "(method='GET', jsonData={'True': True}, url=newurl)\n", (142, 193), True, 'import lib.utils as utils\n'), ((367, 431), 'lib.utils.makeStoreRequest', 'utils.makeStoreReques... |
import asyncio
import logging
from typing import Dict, Callable, List, Optional, Union, Pattern
from .command import Command
from .lexer import Lexer
from .parser import Parser
from .. import AsyncRunnable, MessageTypes, EventTypes # interfaces & basics
from .. import Cert, HTTPRequester, WebhookReceiver, WebsocketRe... | [
"logging.getLogger",
"asyncio.get_event_loop"
] | [((464, 491), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (481, 491), False, 'import logging\n'), ((9469, 9493), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (9491, 9493), False, 'import asyncio\n')] |
import pygame
from pygame.locals import *
from Box2D import *
from sprite import Sprite, Animation
from debug import draw_body
class Player(object):
def __init__(self, world, pos=(0, 0)):
self.body = world.b2world.CreateDynamicBody(
position=pos,
allowSleep=False
)
... | [
"sprite.Sprite",
"sprite.Animation",
"pygame.key.get_pressed"
] | [((729, 757), 'sprite.Sprite', 'Sprite', (['"""data/art/stand.png"""'], {}), "('data/art/stand.png')\n", (735, 757), False, 'from sprite import Sprite, Animation\n'), ((785, 812), 'sprite.Sprite', 'Sprite', (['"""data/art/jump.png"""'], {}), "('data/art/jump.png')\n", (791, 812), False, 'from sprite import Sprite, Anim... |
import os
def convertvid(in_dir, out_dir):
for f in os.listdir(in_dir):
if f.endswith(".mp4"):
in_file = in_dir + '/' + f
out_file = out_dir + '/' + f
ex = 'ffmpeg -i "{in_file}" -c:v libx264 -preset slow -profile:v high -crf 18 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 ... | [
"os.system",
"os.listdir"
] | [((58, 76), 'os.listdir', 'os.listdir', (['in_dir'], {}), '(in_dir)\n', (68, 76), False, 'import os\n'), ((422, 435), 'os.system', 'os.system', (['ex'], {}), '(ex)\n', (431, 435), False, 'import os\n')] |
from hrm import readCSV, getBeats, getMeanHR, getDuration
import pytest
@pytest.mark.parametrize("testinput,expected", [
('test_data31.csv', 81.42),
('test_data1.csv', 75),
('test_data11.csv', 68.57)
])
def test(testinput, expected):
[t, v] = readCSV(testinput)
beattimes = getBeats(t, v)
exp =... | [
"pytest.mark.parametrize",
"hrm.getDuration",
"hrm.getBeats",
"hrm.readCSV"
] | [((75, 206), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""testinput,expected"""', "[('test_data31.csv', 81.42), ('test_data1.csv', 75), ('test_data11.csv', 68.57)\n ]"], {}), "('testinput,expected', [('test_data31.csv', 81.42),\n ('test_data1.csv', 75), ('test_data11.csv', 68.57)])\n", (98, 206), F... |
import pytest
from tests.utils import make_fresh_testbed
@pytest.fixture
def testbed():
return make_fresh_testbed()
| [
"tests.utils.make_fresh_testbed"
] | [((102, 122), 'tests.utils.make_fresh_testbed', 'make_fresh_testbed', ([], {}), '()\n', (120, 122), False, 'from tests.utils import make_fresh_testbed\n')] |
#Testing script that lives outside of pytest due to DeepForest dependency in a new conda env. PYTHONPATH manually added to root dir for relative paths.
import os
import pytest
import tensorflow
import numpy as np
from matplotlib import pyplot as plt
import geopandas as gpd
import pandas as pd
import glob
import prepa... | [
"deepforest.deepforest.deepforest",
"geopandas.sjoin",
"geopandas.read_file",
"tensorflow.Session",
"prepare_field_data.create_boxes",
"prepare_field_data.process_plot",
"os.path.dirname",
"DeepTreeAttention.generators.boxes.tf_dataset",
"prepare_field_data.find_sensor_path",
"prepare_field_data.r... | [((427, 471), 'os.path.dirname', 'os.path.dirname', (['prepare_field_data.__file__'], {}), '(prepare_field_data.__file__)\n', (442, 471), False, 'import os\n'), ((724, 768), 'glob.glob', 'glob.glob', (['hyperspectral_dir'], {'recursive': '(True)'}), '(hyperspectral_dir, recursive=True)\n', (733, 768), False, 'import gl... |
from typing import Any, List, Mapping
import numpy as np
from scipy.interpolate import LinearNDInterpolator
from skimage.color import rgb2gray
from skimage.filters import gaussian, threshold_otsu
from skimage.morphology import binary_dilation, binary_erosion, dilation, disk
from morphocut import Node, Output, RawOrVa... | [
"morphocut.Output",
"skimage.color.rgb2gray",
"scipy.interpolate.LinearNDInterpolator",
"skimage.filters.threshold_otsu",
"numpy.isnan",
"numpy.nonzero",
"numpy.bitwise_not",
"skimage.morphology.disk",
"skimage.filters.gaussian"
] | [((360, 376), 'morphocut.Output', 'Output', (['"""result"""'], {}), "('result')\n", (366, 376), False, 'from morphocut import Node, Output, RawOrVariable, ReturnOutputs\n'), ((1387, 1403), 'skimage.filters.gaussian', 'gaussian', (['img', '(3)'], {}), '(img, 3)\n', (1395, 1403), False, 'from skimage.filters import gauss... |
import pygame
pygame.init()
pygame.mixer.music.load('E.mp3')
pygame.mixer.music.play()
pygame.event.wait()
print('boa musica ne?') | [
"pygame.mixer.music.play",
"pygame.event.wait",
"pygame.mixer.music.load",
"pygame.init"
] | [((14, 27), 'pygame.init', 'pygame.init', ([], {}), '()\n', (25, 27), False, 'import pygame\n'), ((28, 60), 'pygame.mixer.music.load', 'pygame.mixer.music.load', (['"""E.mp3"""'], {}), "('E.mp3')\n", (51, 60), False, 'import pygame\n'), ((61, 86), 'pygame.mixer.music.play', 'pygame.mixer.music.play', ([], {}), '()\n', ... |
""" Contains all the logic """
from enum import Enum
# R1 R2
# --[======]-----[======]--
# | | |
# V_in V_out GND
# V_out / V_in = R2 / (R1 + R2)
# resistor_ratio = R1 / R2
class RatioType(Enum):
""" Allows distinguishing between resistor ratios ... | [
"math.log10",
"math.floor"
] | [((1191, 1205), 'math.floor', 'floor', (['(exp / 3)'], {}), '(exp / 3)\n', (1196, 1205), False, 'from math import floor, log10\n'), ((2075, 2085), 'math.log10', 'log10', (['val'], {}), '(val)\n', (2080, 2085), False, 'from math import floor, log10\n')] |
import os
import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_service_running_and_enabled(host):
assert host.service('nginx').is_running
assert host.service('nginx').is_enable... | [
"pytest.mark.parametrize",
"pytest.mark.skip"
] | [((325, 617), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""uri,expecturi,expectcode"""', "[('/map?search=abc1', '/redirectmap?query=def2', 302), ('/map?search=other',\n '/redirectmap', 302), ('/direct/', '/redirect', 301), ('/redirect/',\n '/default', 302), ('/map', '/redirectmap', 302), ('/default... |
#!/usr/bin/python
#
# Copyright 2022 DeepMind Technologies Limited
#
# 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 a... | [
"jax.numpy.zeros",
"jax.vmap",
"jax.lax.fori_loop",
"jax.numpy.concatenate",
"jax.numpy.arange",
"distribution_shift_framework.core.pix.color_conversion.split_channels",
"jax.numpy.bitwise_and",
"jax.numpy.histogram",
"jax.numpy.clip",
"jax.numpy.stack"
] | [((1252, 1273), 'jax.numpy.arange', 'jnp.arange', (['(0)', '(256)', '(1)'], {}), '(0, 256, 1)\n', (1262, 1273), True, 'import jax.numpy as jnp\n'), ((2173, 2205), 'jax.numpy.concatenate', 'jnp.concatenate', (['im_rgbs'], {'axis': '(2)'}), '(im_rgbs, axis=2)\n', (2188, 2205), True, 'import jax.numpy as jnp\n'), ((3527, ... |
from Point import *
from scipy.spatial import ConvexHull
def unpackPoint(P):
if type(P) == P2_Point:
#P.normalize()
(x, y, z) = P.toTuple()
else:
(x, y) = P.toTuple()
z = 1
return (x, y, z)
def sortPoints(points, P0):
# SORT Points by distance to P0
return [Pi for (Pi, d) in sorted([(Pi, P0.euclideanDist... | [
"scipy.spatial.ConvexHull"
] | [((1433, 1475), 'scipy.spatial.ConvexHull', 'ConvexHull', (['wPListofList'], {'incremental': '(True)'}), '(wPListofList, incremental=True)\n', (1443, 1475), False, 'from scipy.spatial import ConvexHull\n'), ((2114, 2156), 'scipy.spatial.ConvexHull', 'ConvexHull', (['wPListofList'], {'incremental': '(True)'}), '(wPListo... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import pymysql
from twisted.enterprise import adbapi
MYSQL_HOST = 'localhost'
MYSQL_PORT = '3306'
MYSQL_DBNAME = 'fp'
MYSQL... | [
"twisted.enterprise.adbapi.ConnectionPool"
] | [((1098, 1143), 'twisted.enterprise.adbapi.ConnectionPool', 'adbapi.ConnectionPool', (['"""pymysql"""'], {}), "('pymysql', **adbparams)\n", (1119, 1143), False, 'from twisted.enterprise import adbapi\n')] |
import requests
import rdflib
from whyis import nanopub
import datetime
import pytz
import dateutil.parser
from dateutil.tz import tzlocal
from werkzeug.datastructures import FileStorage
from werkzeug.http import http_date
from setlr import FileLikeFromIter
import re
import os
from requests_testadapter import Resp
impo... | [
"rdflib.Literal",
"datetime.datetime.now",
"rdflib.BNode",
"rdflib.URIRef"
] | [((1270, 1296), 'rdflib.URIRef', 'rdflib.URIRef', (['entity_name'], {}), '(entity_name)\n', (1283, 1296), False, 'import rdflib\n'), ((2803, 2817), 'rdflib.BNode', 'rdflib.BNode', ([], {}), '()\n', (2815, 2817), False, 'import rdflib\n'), ((1702, 1733), 'datetime.datetime.now', 'datetime.datetime.now', (['pytz.utc'], {... |
import random
from pyecharts import Scatter3D
from flask import Flask, render_template
app = Flask(__name__)
REMOTE_HOST = "https://pyecharts.github.io/assets/js"
@app.route("/")
def hello():
s3d = scatter3d()
return render_template('pyecharts.html',
myechart=s3d.render_embed(),
... | [
"random.randint",
"pyecharts.Scatter3D",
"flask.Flask"
] | [((95, 110), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (100, 110), False, 'from flask import Flask, render_template\n'), ((681, 741), 'pyecharts.Scatter3D', 'Scatter3D', (['"""3D scattering plot demo"""'], {'width': '(1200)', 'height': '(600)'}), "('3D scattering plot demo', width=1200, height=600)\n"... |
# (C) Copyright 2017-2019 by <NAME>
#
# This program 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 2
# of the License, or (at your option) any later version.
#
# This program is distribut... | [
"types.CodeType",
"inspect.iscode"
] | [((20299, 20318), 'inspect.iscode', 'inspect.iscode', (['obj'], {}), '(obj)\n', (20313, 20318), False, 'import inspect, types\n'), ((4449, 4470), 'types.CodeType', 'types.CodeType', (['*args'], {}), '(*args)\n', (4463, 4470), False, 'import inspect, types\n'), ((7930, 7951), 'types.CodeType', 'types.CodeType', (['*args... |
import numpy as np
import warnings
from stingray.base import StingrayObject
from stingray.gti import check_separate, cross_two_gtis
from stingray.lightcurve import Lightcurve
from stingray.utils import assign_value_if_none, simon, excess_variance, show_progress
from stingray.fourier import avg_cs_from_events, avg_pds... | [
"numpy.log10",
"numpy.sqrt",
"stingray.gti.cross_two_gtis",
"numpy.count_nonzero",
"stingray.utils.excess_variance",
"stingray.lightcurve.Lightcurve.make_lightcurve",
"stingray.utils.show_progress",
"numpy.mean",
"stingray.fourier.error_on_averaged_cross_spectrum",
"numpy.asarray",
"numpy.max",
... | [((1897, 1921), 'numpy.asarray', 'np.asarray', (['channel_band'], {}), '(channel_band)\n', (1907, 1921), True, 'import numpy as np\n'), ((1937, 1957), 'numpy.asarray', 'np.asarray', (['ref_band'], {}), '(ref_band)\n', (1947, 1957), True, 'import numpy as np\n'), ((2040, 2080), 'stingray.gti.check_separate', 'check_sepa... |
"""
Original code from PyObjC-Cocoa
See: https://bitbucket.org/ronaldoussoren/pyobjc/
AppKit helpers.
Exported functions:
* runEventLoop - run NSApplicationMain in a safer way
* stopEventLoop - stops the event loop or terminates the application
* callAfter - call a function on the main thread (async)
"""
# Use cocoa... | [
"logging.getLogger",
"cohorte.cocoapy.ObjCClass",
"sys.exc_info",
"sys.exit",
"cohorte.cocoapy.ObjCSubclass",
"cohorte.cocoapy.send_super"
] | [((643, 670), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (660, 670), False, 'import logging\n'), ((733, 759), 'cohorte.cocoapy.ObjCClass', 'ObjCClass', (['"""NSApplication"""'], {}), "('NSApplication')\n", (742, 759), False, 'from cohorte.cocoapy import ObjCClass, ObjCSubclass, ObjCIn... |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 20 22:35:02 2020
@author: hp
"""
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import pickle
from sklearn.utils import resample
from sklearn import tree
fro... | [
"pandas.read_csv",
"sklearn.metrics.precision_score",
"numpy.argsort",
"sklearn.metrics.recall_score",
"sklearn.metrics.roc_auc_score",
"pandas.read_pickle",
"sklearn.ensemble.RandomForestRegressor",
"matplotlib.pyplot.xlabel",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.utils.resample",
"pa... | [((945, 975), 'pandas.read_pickle', 'pd.read_pickle', (['"""Cleaned_data"""'], {}), "('Cleaned_data')\n", (959, 975), True, 'import pandas as pd\n'), ((980, 1004), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {}), "('train.csv')\n", (991, 1004), True, 'import pandas as pd\n'), ((1122, 1190), 'sklearn.utils.r... |
from marshmallow import Schema, fields, post_load
from .base import BaseObject, BaseScheme
class ValueChoice(BaseObject):
pass
class ValueChoiceScheme(Schema):
value = fields.Str()
label = fields.Str()
@post_load
def make_object(self, data):
return ValueChoice(**data)
class Param(Bas... | [
"marshmallow.fields.Nested",
"marshmallow.fields.Str"
] | [((181, 193), 'marshmallow.fields.Str', 'fields.Str', ([], {}), '()\n', (191, 193), False, 'from marshmallow import Schema, fields, post_load\n'), ((206, 218), 'marshmallow.fields.Str', 'fields.Str', ([], {}), '()\n', (216, 218), False, 'from marshmallow import Schema, fields, post_load\n'), ((384, 396), 'marshmallow.f... |
import copy
import json
import uuid
class BigCheese(object):
def __repr__(self):
return self.to_json()
def to_dict(self):
return {}
def to_json(self):
return json.dumps(self.to_dict())
def clone(self):
return copy.deepcopy(self)
@staticmethod
def tag():
... | [
"uuid.uuid4",
"uuid.getnode",
"copy.deepcopy"
] | [((261, 280), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (274, 280), False, 'import copy\n'), ((334, 346), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (344, 346), False, 'import uuid\n'), ((402, 416), 'uuid.getnode', 'uuid.getnode', ([], {}), '()\n', (414, 416), False, 'import uuid\n')] |
# https://github.com/imgproxy/imgproxy/blob/de21b937db3e469e8cfcc2850f49ba9eb1eaa55d/examples/signature.py
import base64
import hashlib
import hmac
import textwrap
from .consts import IMGPROXY_PROTOCOL, IMGPROXY_HOSTNAME, IMGPROXY_KEY, IMGPROXY_SALT
key = bytes.fromhex(IMGPROXY_KEY)
salt = bytes.fromhex(IMGPROXY_SA... | [
"hmac.new",
"textwrap.wrap",
"base64.urlsafe_b64encode"
] | [((530, 560), 'textwrap.wrap', 'textwrap.wrap', (['encoded_url', '(16)'], {}), '(encoded_url, 16)\n', (543, 560), False, 'import textwrap\n'), ((808, 864), 'hmac.new', 'hmac.new', (['key'], {'msg': '(salt + path)', 'digestmod': 'hashlib.sha256'}), '(key, msg=salt + path, digestmod=hashlib.sha256)\n', (816, 864), False,... |
### Code from https://github.com/budzianowski/PyTorch-Beam-Search-Decoding/blob/master/decode_beam.py
import operator
import torch
import torch.nn as nn
import torch.nn.functional as F
from queue import PriorityQueue
from itertools import count
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
SOS_... | [
"torch.cuda.LongTensor",
"torch.LongTensor",
"torch.topk",
"torch.cuda.is_available",
"itertools.count",
"queue.PriorityQueue",
"operator.itemgetter",
"torch.device"
] | [((1396, 1403), 'itertools.count', 'count', ([], {}), '()\n', (1401, 1403), False, 'from itertools import count\n'), ((278, 303), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (301, 303), False, 'import torch\n'), ((2674, 2689), 'queue.PriorityQueue', 'PriorityQueue', ([], {}), '()\n', (2687, ... |
import habitat
import cv2
import os
import time
import git
import magnum as mn
import matplotlib.pyplot as plt
import numpy as np
import math
import habitat_sim
from habitat_sim.utils import viz_utils as vut
# import quadruped_wrapper
from habitat_sim.robots import AntV2Robot
repo = git.Repo(".", search_parent_dir... | [
"habitat_sim.SimulatorConfiguration",
"habitat_sim.Configuration",
"habitat_sim.Simulator",
"habitat_sim.CameraSensorSpec",
"habitat_sim.robots.AntV2Robot",
"os.path.join",
"numpy.array",
"habitat_sim.utils.viz_utils.make_video",
"git.Repo",
"numpy.quaternion",
"habitat_sim.AgentState",
"habit... | [((289, 334), 'git.Repo', 'git.Repo', (['"""."""'], {'search_parent_directories': '(True)'}), "('.', search_parent_directories=True)\n", (297, 334), False, 'import git\n'), ((380, 425), 'os.path.join', 'os.path.join', (['dir_path', '"""../habitat-sim/data"""'], {}), "(dir_path, '../habitat-sim/data')\n", (392, 425), Fa... |
from django.template.response import TemplateResponse
from ..product.models import Product
def home(request):
products = Product.objects.get_available_products()[:12]
products = products.prefetch_related('categories', 'images',
'variants__stock')
return TemplateRe... | [
"django.template.response.TemplateResponse"
] | [((310, 388), 'django.template.response.TemplateResponse', 'TemplateResponse', (['request', '"""base.html"""', "{'products': products, 'parent': None}"], {}), "(request, 'base.html', {'products': products, 'parent': None})\n", (326, 388), False, 'from django.template.response import TemplateResponse\n')] |
# Automatically generated by Pynguin.
import pytest
import utils.geo_tools as module0
import unittest
class IntegrationTest(unittest.TestCase):
def test_case_0(self):
var0 = 180.0
var1 = 2118.01088
var2 = 100.0
var3 = module0.distance(var0, var1, var2, var1)
assert var3 == ... | [
"pytest.approx",
"utils.geo_tools.distance"
] | [((256, 296), 'utils.geo_tools.distance', 'module0.distance', (['var0', 'var1', 'var2', 'var1'], {}), '(var0, var1, var2, var1)\n', (272, 296), True, 'import utils.geo_tools as module0\n'), ((320, 372), 'pytest.approx', 'pytest.approx', (['(8898386.658367889)'], {'abs': '(0.01)', 'rel': '(0.01)'}), '(8898386.658367889,... |
# MIT License
#
# Copyright (c) 2017-2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merg... | [
"numpy.genfromtxt",
"numpy.argmax",
"numpy.max"
] | [((1224, 1323), 'numpy.genfromtxt', 'np.genfromtxt', (['"""xenon_ne_vs_x_do-0.76mm_Id-2.3A.csv"""'], {'delimiter': '""","""', 'skip_header': '(13)', 'names': '(True)'}), "('xenon_ne_vs_x_do-0.76mm_Id-2.3A.csv', delimiter=',',\n skip_header=13, names=True)\n", (1237, 1323), True, 'import numpy as np\n'), ((1554, 1569... |
# -*- coding: utf-8 -*-
"""Concurrent streams and account polling using gevent.
demonstrates usage of oandapyV20:
- streaming prices
- streaming events
- account polling
- restart of a greenlet in case of an exception
For gevent details check: http://sdiehl.github.io/gevent-tutorial/
For REST-API V20 check: http://de... | [
"logging.basicConfig",
"logging.getLogger",
"gevent.pool.Group",
"exampleauth.exampleAuth",
"argparse.ArgumentParser",
"gevent.monkey.patch_all",
"gevent.sleep",
"oandapyV20.endpoints.transactions.TransactionsStream",
"oandapyV20.endpoints.accounts.AccountSummary",
"json.dumps",
"time.sleep",
... | [((973, 991), 'gevent.monkey.patch_all', 'monkey.patch_all', ([], {}), '()\n', (989, 991), False, 'from gevent import monkey\n'), ((1032, 1081), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""concurrent_stream"""'}), "(prog='concurrent_stream')\n", (1055, 1081), False, 'import argparse\n'), ((1... |
#!/usr/bin/env python -*- coding: utf-8 -*-
import argparse
import codecs
import utils
from numpy import mean
def similarity_diff(word, positive_words, negative_words, vsm, similarity_metric):
if similarity_metric == "cosine":
positive_score = mean([vsm.cosine_similarity(word,w) for w in positive_words])
... | [
"codecs.open",
"argparse.ArgumentParser",
"utils.VSM"
] | [((690, 769), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (713, 769), False, 'import argparse\n'), ((1695, 1744), 'utils.VSM', 'utils.VSM', (['args.type', 'args.model', 'args.comp... |
from starcluster.clustersetup import ClusterSetup
from starcluster.logger import log
class SnpEffInstaller(ClusterSetup):
def run(self, nodes, master, user, user_shell, volumes):
for node in nodes:
log.info("Installing SnpEff and SnpSift 4.0 on %s" % (node.alias))
node.ssh.execute('mkdir -p /opt/software/snpe... | [
"starcluster.logger.log.info"
] | [((205, 269), 'starcluster.logger.log.info', 'log.info', (["('Installing SnpEff and SnpSift 4.0 on %s' % node.alias)"], {}), "('Installing SnpEff and SnpSift 4.0 on %s' % node.alias)\n", (213, 269), False, 'from starcluster.logger import log\n'), ((703, 737), 'starcluster.logger.log.info', 'log.info', (['"""Creating Sn... |
#!/usr/bin/env python
# coding: utf-8
# # The Boundary Element Method (BEM)
#
#
# You can run this code directly in your browser by clicking on the rocket logo ( <i class="fas fa-rocket"></i> ) at the top of the page, and clicking 'Binder'. This will open a Jupyter Notebook in a [Binder](https://mybinder.org/) envir... | [
"numpy.linalg.solve",
"matplotlib.pyplot.title",
"numpy.sqrt",
"matplotlib.pyplot.colorbar",
"numpy.log",
"numpy.array",
"numpy.linspace",
"numpy.zeros",
"numpy.real",
"numpy.cos",
"numpy.dot",
"numpy.sin",
"numpy.meshgrid"
] | [((3635, 3661), 'numpy.linspace', 'np.linspace', (['(-50)', '(50)', '(1000)'], {}), '(-50, 50, 1000)\n', (3646, 3661), True, 'import numpy as np\n'), ((3666, 3683), 'numpy.meshgrid', 'np.meshgrid', (['t', 't'], {}), '(t, t)\n', (3677, 3683), True, 'import numpy as np\n'), ((3784, 3805), 'matplotlib.pyplot.colorbar', 'p... |
from collections import OrderedDict
import json
import os
filename = [x for x in os.listdir() if '.json' in x][0]
# with open(filename) as file:
# swagger = json.load(file)
swagger = json.load(open(filename), object_pairs_hook=OrderedDict)
swagger['host'] = 'localhost:8080'
js_str = 'var api_spec = '
js_str += ... | [
"os.listdir",
"json.dumps"
] | [((320, 366), 'json.dumps', 'json.dumps', (['swagger'], {'indent': '(2)', 'sort_keys': '(False)'}), '(swagger, indent=2, sort_keys=False)\n', (330, 366), False, 'import json\n'), ((82, 94), 'os.listdir', 'os.listdir', ([], {}), '()\n', (92, 94), False, 'import os\n')] |
#!/usr/bin/env python
try:
from setuptools import setup, Command
except ImportError:
from distutils.core import setup, Command
class RunTest(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import sys
... | [
"subprocess.call",
"distutils.core.setup"
] | [((510, 1633), 'distutils.core.setup', 'setup', ([], {'name': '"""xcodeprojer"""', 'version': '"""0.1"""', 'url': '"""https://github.com/mikr/xcodeprojer"""', 'license': '"""MIT"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""xcodeprojer is a Python script that brings your project.pbx... |
# Generated by Django 2.2.7 on 2020-03-29 21:56
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('komax_app', '0014_auto_2... | [
"django.db.models.OneToOneField",
"django.db.migrations.DeleteModel",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.ImageField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((227, 284), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (258, 284), False, 'from django.db import migrations, models\n'), ((1470, 1518), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '... |
"""
Script that loads courses recommended for each concept in the tags table from the database.
"""
import os
import pandas as pd
import requests
from sqlalchemy import create_engine
from sqlalchemy.sql.expression import text
from dotenv import load_dotenv
def get_database_engine():
db_user = os.getenv("MYSQL_US... | [
"sqlalchemy.sql.expression.text",
"os.getenv",
"dotenv.load_dotenv"
] | [((301, 324), 'os.getenv', 'os.getenv', (['"""MYSQL_USER"""'], {}), "('MYSQL_USER')\n", (310, 324), False, 'import os\n'), ((339, 371), 'os.getenv', 'os.getenv', (['"""<PASSWORD>_PASSWORD"""'], {}), "('<PASSWORD>_PASSWORD')\n", (348, 371), False, 'import os\n'), ((386, 409), 'os.getenv', 'os.getenv', (['"""MYSQL_HOST""... |
# -*- coding: utf-8 -*-
from openerp import models,fields,api
from openerp.tools.translate import _
from openerp.exceptions import Warning
class is_rgpd_service(models.Model):
_name='is.rgpd.service'
_order='name'
name = fields.Char("Service", required=True)
class is_rgpd_traitement(models.Model):
... | [
"openerp.fields.Text",
"openerp.fields.Selection",
"openerp.fields.Many2one",
"openerp.fields.datetime.now",
"openerp.fields.Many2many",
"openerp.fields.Date",
"openerp.fields.Char"
] | [((237, 274), 'openerp.fields.Char', 'fields.Char', (['"""Service"""'], {'required': '(True)'}), "('Service', required=True)\n", (248, 274), False, 'from openerp import models, fields, api\n'), ((398, 444), 'openerp.fields.Char', 'fields.Char', (['"""N° du traitement"""'], {'readonly': '(True)'}), "('N° du traitement',... |
from __future__ import division
from __future__ import print_function
import json
import pdb
import math
all_params = json.load(open('config.json'))
dataset_name = all_params['dataset_name']
locals().update(all_params['experiment_setup'])
locals().update(all_params[dataset_name])
tcn_params['model_params']['encod... | [
"math.ceil"
] | [((551, 577), 'math.ceil', 'math.ceil', (['(k / sample_rate)'], {}), '(k / sample_rate)\n', (560, 577), False, 'import math\n'), ((665, 691), 'math.ceil', 'math.ceil', (['(k / sample_rate)'], {}), '(k / sample_rate)\n', (674, 691), False, 'import math\n')] |
# A collection of common functions used in the creation and manipulation of the data for this project.
from approaches.approach import Multiclass_Logistic_Regression, Perceptron, Sklearn_SVM
import comp_vis.img_tools as it
import numpy as np
import sys
def images_to_data(images, label, already_cropped=True):
'''... | [
"approaches.approach.Multiclass_Logistic_Regression",
"numpy.shape",
"comp_vis.img_tools.average_color",
"approaches.approach.Sklearn_SVM",
"comp_vis.img_tools.crop_image",
"sys.stderr.write",
"numpy.array",
"comp_vis.img_tools.get_images_dimensions",
"approaches.approach.Perceptron",
"numpy.rando... | [((1276, 1330), 'comp_vis.img_tools.get_images_dimensions', 'it.get_images_dimensions', (['cropped_images'], {'ordered': '(True)'}), '(cropped_images, ordered=True)\n', (1300, 1330), True, 'import comp_vis.img_tools as it\n'), ((2353, 2376), 'numpy.random.shuffle', 'np.random.shuffle', (['data'], {}), '(data)\n', (2370... |
#!python3
from collections import Counter
def main():
with open('11.txt', 'r') as f, open('11_out.txt', 'w') as f_out:
line = f.readline().strip()
steps = line.split(',')
directions = ['n', 'ne', 'se', 's', 'sw', 'nw']
# Part 1
step_counts = Counter(steps)
pairs =... | [
"collections.Counter"
] | [((290, 304), 'collections.Counter', 'Counter', (['steps'], {}), '(steps)\n', (297, 304), False, 'from collections import Counter\n')] |
from django import forms
from django.db.models import Q
from .models import Song
from .youtube_dl import CustomYoutubeDL, DownloadInThread
class SongCreationForm(forms.ModelForm):
class Meta:
model = Song
fields = ["url"]
def clean(self):
self.ytdl = CustomYoutubeDL()
url = s... | [
"django.db.models.Q",
"django.forms.ValidationError"
] | [((459, 526), 'django.forms.ValidationError', 'forms.ValidationError', (["{'Youtube-dl Error': 'Cannot get IE_RESULT'}"], {}), "({'Youtube-dl Error': 'Cannot get IE_RESULT'})\n", (480, 526), False, 'from django import forms\n'), ((598, 645), 'django.forms.ValidationError', 'forms.ValidationError', (["{'url': 'Not suppo... |
import csv
def readBookmarkFile(bm_filename):
bmarks = open(bm_filename)
data = []
i = 0
for line in bmarks:
i+=1
if i<=2:
# skip first two lines as they contain only metadata
continue
reader = csv.reader([line], skipinitialspace=True)
for r in ... | [
"csv.reader"
] | [((261, 302), 'csv.reader', 'csv.reader', (['[line]'], {'skipinitialspace': '(True)'}), '([line], skipinitialspace=True)\n', (271, 302), False, 'import csv\n')] |
###############################################################################
# Converting step files to h5m file to be read by openmc
# Note, the fork below of the cad_to_h5m repo needs to be used for this script to work
# https://github.com/LukeLabrie/cad_to_h5m/tree/transforms_and_graveyards
#####################... | [
"cad_to_h5m.cad_to_h5m"
] | [((463, 762), 'cad_to_h5m.cad_to_h5m', 'cad_to_h5m', ([], {'h5m_filename': '"""geom.h5m"""', 'cubit_path': '"""/opt/Coreform-Cubit-2021.5/bin/"""', 'files_with_tags': "[{'material_tag': 'mat', 'cad_filename': 'geom.step', 'transforms': {\n 'scale': scale}}]", 'faceting_tolerance': '(0.001)', 'surface_reflectivity_na... |
'''
NAME
POO.py
VERSION
[1.0]
AUTHOR
<NAME> <<EMAIL>>
DESCRIPTION
This programs takes a DNA sequence as a class and works with it through its methods and subclasses
CATEGORY
DNA analysis
USAGE
None
ARGUMENTS
This program doesn't take arguments
INPUT
The inp... | [
"re.search"
] | [((3105, 3151), 're.search', 're.search', (['"""ATG[ATGC]+(TAA|TGA|TAG)"""', 'self.seq'], {}), "('ATG[ATGC]+(TAA|TGA|TAG)', self.seq)\n", (3114, 3151), False, 'import re\n')] |
# external
from packaging.requirements import Requirement
from tomlkit import document, dumps, parse
# app
from ..controllers import DependencyMaker
from ..models import RootDependency
from .base import BaseConverter
class PyProjectConverter(BaseConverter):
lock = False
def loads(self, content: str) -> Root... | [
"tomlkit.parse",
"tomlkit.dumps",
"packaging.requirements.Requirement",
"tomlkit.document"
] | [((346, 360), 'tomlkit.parse', 'parse', (['content'], {}), '(content)\n', (351, 360), False, 'from tomlkit import document, dumps, parse\n'), ((765, 775), 'tomlkit.document', 'document', ([], {}), '()\n', (773, 775), False, 'from tomlkit import document, dumps, parse\n'), ((932, 942), 'tomlkit.dumps', 'dumps', (['doc']... |
import sys
from helpers import read_data_file
print('\n************* Day 13 *************\n')
lines = read_data_file(sys.argv[1])
delay = int(lines[0])
bus_ids = list(map(lambda x:int(x) if x.isdigit() else x, lines[1].split(',')))
print(delay, bus_ids)
def part1():
next_bus = None
wait_time = 0
timesta... | [
"helpers.read_data_file"
] | [((104, 131), 'helpers.read_data_file', 'read_data_file', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (118, 131), False, 'from helpers import read_data_file\n')] |
# encoding: utf-8
# USE :
# python setup_project.py build_ext --inplace
#
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
warnings.filterwarnings("ign... | [
"numpy.get_include",
"warnings.filterwarnings",
"distutils.core.setup"
] | [((228, 290), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (251, 290), False, 'import warnings\n'), ((292, 349), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'FutureWarn... |
import numpy as np
jit = lambda x: x
# Make things faster? volume() certainly become faster, but ensure_closed,
# which is more critical, does not.
# import numba
# jit = numba.jit
# Interesting methods:
# - remove unused vertices, but can be obtained by m = Mesh(m.get_flat_vertices())
# - split the different conne... | [
"numpy.zeros",
"numpy.asarray"
] | [((17750, 17778), 'numpy.zeros', 'np.zeros', (['(0, 3)', 'np.float32'], {}), '((0, 3), np.float32)\n', (17758, 17778), True, 'import numpy as np\n'), ((18598, 18626), 'numpy.zeros', 'np.zeros', (['(0, 3)', 'np.float32'], {}), '((0, 3), np.float32)\n', (18606, 18626), True, 'import numpy as np\n'), ((19589, 19617), 'num... |
# Copyright 2018-2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"struct.unpack",
"struct.pack"
] | [((1584, 1627), 'struct.pack', 'struct.pack', (['"""B"""', 'self._data_security_erase'], {}), "('B', self._data_security_erase)\n", (1595, 1627), False, 'import struct\n'), ((1766, 1794), 'struct.unpack', 'struct.unpack', (['"""!I"""', 'buf[:4]'], {}), "('!I', buf[:4])\n", (1779, 1794), False, 'import struct\n')] |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from typing import List, Generator
import heapq
class Graph:
def __init__(self, vertex_count: int) -> None:
self.adj = [[] for _ in range(vertex_count)]
def add_edge(self, s: int, t: int, w: int) -> None:
edge = Edge(s, t, w)
self.adj[s].appe... | [
"heapq.heappop",
"heapq.heapify"
] | [((940, 968), 'heapq.heappop', 'heapq.heappop', (['self.vertices'], {}), '(self.vertices)\n', (953, 968), False, 'import heapq\n'), ((1188, 1216), 'heapq.heapify', 'heapq.heapify', (['self.vertices'], {}), '(self.vertices)\n', (1201, 1216), False, 'import heapq\n')] |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------------... | [
"threading.Lock",
"base64.b64encode",
"base64.b64decode"
] | [((2465, 2471), 'threading.Lock', 'Lock', ([], {}), '()\n', (2469, 2471), False, 'from threading import Lock, Thread\n'), ((6923, 6945), 'base64.b64decode', 'base64.b64decode', (['cert'], {}), '(cert)\n', (6939, 6945), False, 'import base64\n'), ((12738, 12759), 'base64.b64decode', 'base64.b64decode', (['x5c'], {}), '(... |
from collections import Counter
from sklearn.neighbors import KNeighborsClassifier
import logging
logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s', \
level=logging.INFO, \
datefmt='%Y-%m-%d %H:%M:%S')
from pdb import set_trace as bp
class Classifier:
... | [
"logging.basicConfig",
"sklearn.neighbors.KNeighborsClassifier",
"logging.info",
"collections.Counter"
] | [((100, 223), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(levelname)-8s %(message)s"""', 'level': 'logging.INFO', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(format='%(asctime)s %(levelname)-8s %(message)s', level\n =logging.INFO, datefmt='%Y-%m-%d %H:%M:%S')\n", (119, 223), False, ... |
# Copyright 2016 VMware, Inc.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | [
"logging.basicConfig",
"logging.getLogger",
"neutron_lib.api.attributes.populate_project_info",
"oslo_utils.uuidutils.generate_uuid",
"neutron_lib.api.attributes.AttributeInfo"
] | [((773, 812), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (792, 812), False, 'import logging\n'), ((819, 846), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (836, 846), False, 'import logging\n'), ((1312, 1346), 'neutron_lib.ap... |
#!/usr/bin/env python
# encoding: utf-8
# Copyright (c) 2012-2016 Seafile Ltd.
import sqlite3
import os
import sys
import time
import hashlib
import getpass
# Get .ccnet directory from argument or user input
if len(sys.argv) >= 2:
ccnet_dir = sys.argv[1]
else:
home_dir = os.path.join(os.path.expanduser('~... | [
"os.path.exists",
"sqlite3.connect",
"os.path.join",
"getpass.getpass",
"sys.exit",
"hashlib.sha1",
"time.time",
"os.path.expanduser"
] | [((504, 549), 'os.path.join', 'os.path.join', (['ccnet_dir', '"""PeerMgr/usermgr.db"""'], {}), "(ccnet_dir, 'PeerMgr/usermgr.db')\n", (516, 549), False, 'import os\n'), ((674, 701), 'sqlite3.connect', 'sqlite3.connect', (['usermgr_db'], {}), '(usermgr_db)\n', (689, 701), False, 'import sqlite3\n'), ((1758, 1786), 'getp... |
from __future__ import print_function
import tensorflow as tf
import tensorflow.contrib.slim as slim # try out sonnet instead?
from tensorflow.python.client import timeline
from tensorflow.examples.tutorials.mnist import input_data
from sklearn.utils import shuffle
import numpy as np
import os
from utils import *
... | [
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"tensorflow.RunMetadata",
"tensorflow.log",
"tensorflow.app.run",
"numpy.reshape",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.RunOptions",
"tensorflow.python.client.timeline.Timeline",
"tensorflow.train.AdamOptimizer... | [((320, 406), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""logdir"""', '"""/tmp/test"""', '"""location for saved embeedings"""'], {}), "('logdir', '/tmp/test',\n 'location for saved embeedings')\n", (346, 406), True, 'import tensorflow as tf\n'), ((403, 475), 'tensorflow.app.flags.DEFINE... |
from pymongo import MongoClient
from pymongo import DESCENDING
from django.conf import settings
import logging
logger = logging.getLogger('import_logger')
class MongoReader():
client = MongoClient(settings.MONGO_IMPORT_CONNECTION, 27017)
ropa_db = client['esmio']
items = ropa_db['items']
def get_all_brands(self)... | [
"logging.getLogger",
"pymongo.MongoClient"
] | [((121, 155), 'logging.getLogger', 'logging.getLogger', (['"""import_logger"""'], {}), "('import_logger')\n", (138, 155), False, 'import logging\n'), ((188, 240), 'pymongo.MongoClient', 'MongoClient', (['settings.MONGO_IMPORT_CONNECTION', '(27017)'], {}), '(settings.MONGO_IMPORT_CONNECTION, 27017)\n', (199, 240), False... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import pandas as pd
import wget
import pytma
from pytma.Utility import log
class DataSourceError(Exception):
pass
def get_transcription_data():
"""
Function that returns medical transcription data
This data was scraped from mtsamples.co... | [
"os.path.exists",
"wget.download",
"pytma.tests.test_DataSources.test_novel_data",
"pytma.Utility.log.info",
"pandas.read_csv",
"pytma.tests.test_DataSources.test_medical_data",
"os.path.dirname",
"os.mkdir",
"pytma.Utility.log.error"
] | [((3076, 3093), 'pytma.tests.test_DataSources.test_novel_data', 'test_novel_data', ([], {}), '()\n', (3091, 3093), False, 'from pytma.tests.test_DataSources import test_novel_data, test_medical_data\n'), ((3099, 3118), 'pytma.tests.test_DataSources.test_medical_data', 'test_medical_data', ([], {}), '()\n', (3116, 3118)... |
#!/usr/bin/env python2
from hermes_python.hermes import Hermes
import random
MQTT_IP_ADDR = "localhost"
MQTT_PORT = 1883
MQTT_ADDR = "{}:{}".format(MQTT_IP_ADDR, str(MQTT_PORT))
INTENT_START = "bkouw:start_mental_calculations"
INTENT_ANSWER = "bkouw:give_mental_calculation"
INTENT_STOP = "bkouw:stop_lesson"
INTENT_DO... | [
"hermes_python.hermes.Hermes",
"random.choice",
"random.randint"
] | [((657, 678), 'random.randint', 'random.randint', (['(2)', '(12)'], {}), '(2, 12)\n', (671, 678), False, 'import random\n'), ((687, 708), 'random.randint', 'random.randint', (['(2)', '(12)'], {}), '(2, 12)\n', (701, 708), False, 'import random\n'), ((4967, 4984), 'hermes_python.hermes.Hermes', 'Hermes', (['MQTT_ADDR'],... |
import argparse
import random
from sklearn.model_selection import train_test_split
import torch
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
from g2p.config import Config
from g2p.data import a2a_dataset, get_loader, DoubleBets
from g2p.evaluation import levenshtein_distance, mean_score
from... | [
"torch.utils.tensorboard.SummaryWriter",
"random.sample",
"tools.nop.Nop",
"argparse.ArgumentParser",
"tools.log.get_simple_logger",
"sklearn.model_selection.train_test_split",
"tqdm.tqdm",
"g2p.config.Config",
"g2p.data.get_loader",
"torch.save",
"torch.no_grad",
"g2p.data.DoubleBets.arpabet2... | [((423, 442), 'tools.log.get_simple_logger', 'get_simple_logger', ([], {}), '()\n', (440, 442), False, 'from tools.log import get_simple_logger\n'), ((456, 481), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (479, 481), False, 'import argparse\n'), ((688, 719), 'g2p.config.Config', 'Config', (... |
from datetime import datetime, timedelta
from dateutil import parser as dateutil_parser
def parse_date(date_args):
if isinstance(date_args, (list, tuple)):
date_args = " ".join(date_args)
elif isinstance(date_args, datetime):
date_args = str(date_args)
datetime_obj = dateutil_parser.parse... | [
"dateutil.parser.parse",
"datetime.timedelta"
] | [((299, 331), 'dateutil.parser.parse', 'dateutil_parser.parse', (['date_args'], {}), '(date_args)\n', (320, 331), True, 'from dateutil import parser as dateutil_parser\n'), ((721, 745), 'datetime.timedelta', 'timedelta', ([], {'days': 'interval'}), '(days=interval)\n', (730, 745), False, 'from datetime import datetime,... |
import MySQLdb
class DBConnection:
db = ""
# Open database connection
def __init__(self):
self.db = MySQLdb.connect('localhost', 'root', '', 'new_pyproject')
# Return DB Connection
def getConnection(self):
return self.db
| [
"MySQLdb.connect"
] | [((133, 190), 'MySQLdb.connect', 'MySQLdb.connect', (['"""localhost"""', '"""root"""', '""""""', '"""new_pyproject"""'], {}), "('localhost', 'root', '', 'new_pyproject')\n", (148, 190), False, 'import MySQLdb\n')] |
from autogoal.contrib import find_classes
from autogoal.kb import (
algorithm,
Sentence,
Seq,
Word,
Stem,
build_pipeline_graph,
Supervised,
Label,
)
from autogoal.grammar import generate_cfg, Symbol
class Algorithm:
def __init__(
self,
tokenizer: algorithm(Sentence,... | [
"autogoal.kb.algorithm",
"autogoal.grammar.Symbol",
"autogoal.kb.build_pipeline_graph",
"autogoal.contrib.find_classes"
] | [((1018, 1179), 'autogoal.kb.build_pipeline_graph', 'build_pipeline_graph', ([], {'input_types': '(Seq[Seq[Word]], Supervised[Seq[Seq[Label]]])', 'output_type': 'Seq[Seq[Label]]', 'registry': '[FeatureSeqExtractor, CRFTagger]'}), '(input_types=(Seq[Seq[Word]], Supervised[Seq[Seq[Label]\n ]]), output_type=Seq[Seq[Lab... |
"""Run parallel shallow water domain.
run using command like:
mpiexec -np m python run_parallel_sw_merimbula.py
where m is the number of processors to be used.
Will produce sww files with names domain_Pn_m.sww where m is number of processors and
n in [0, m-1] refers to specific processor that own... | [
"anuga.Domain",
"unittest.makeSuite",
"anuga.parallel.finalize",
"builtins.str",
"past.utils.old_div",
"anuga.parallel.barrier",
"builtins.range",
"numpy.array",
"anuga.coordinate_transforms.redfearn.redfearn",
"unittest.TextTestRunner",
"numpy.arange",
"os.remove",
"anuga.File_boundary",
... | [((20979, 21037), 'unittest.makeSuite', 'unittest.makeSuite', (['Test_urs2sts_parallel', '"""parallel_test"""'], {}), "(Test_urs2sts_parallel, 'parallel_test')\n", (20997, 21037), False, 'import unittest\n'), ((21123, 21148), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (21146, 21148), False,... |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 BigML
#
# 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 ... | [
"bigmler.dispatcher.main_dispatcher",
"bigmler.delete.dispatcher.delete_dispatcher",
"bigmler.cluster.dispatcher.cluster_dispatcher",
"sys.exit",
"bigmler.anomaly.dispatcher.anomaly_dispatcher",
"bigmler.analyze.dispatcher.analyze_dispatcher"
] | [((2775, 2983), 'sys.exit', 'sys.exit', (['"""BigMLer used with no arguments. Check:\nbigmler --help\n\nor\n\nbigmler analyze --help\n\n\n\nbigmler cluster --help\n\n\n\nbigmler anomaly --help\n\n\n\nbigmler delete --help\n\n for a list of options"""'], {}), '(\n """BigMLer used with no arguments. Check:\nbigmler --... |
from operator import methodcaller
from django import forms
from django.core.validators import RegexValidator
from django.utils.translation import ugettext_lazy as _
from td_biblio.models import Author
DOI_REGEX = r"(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?![\"&'<>])\S)+)"
doi_validator = RegexValidator(
DOI_REGEX, _("... | [
"django.utils.translation.ugettext_lazy",
"td_biblio.models.Author.objects.values_list",
"td_biblio.models.Author.objects.filter",
"td_biblio.models.Author.objects.get",
"operator.methodcaller",
"django.forms.Textarea"
] | [((317, 352), 'django.utils.translation.ugettext_lazy', '_', (['"""One (or more) DOI is not valid"""'], {}), "('One (or more) DOI is not valid')\n", (318, 352), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((441, 477), 'django.utils.translation.ugettext_lazy', '_', (['"""One (or more) PMID is not... |
#! /usr/bin/env python
import xml.etree.ElementTree as ET
from ..item_container import Item_Container
from .variable_info import Variable_Info
from .variable_name import Variable_Name
from .variable_integer import Variable_Integer
from .variable_state import Variable_State
import logging
logger = logging.getLogger(_... | [
"logging.getLogger",
"xml.etree.ElementTree.fromstring"
] | [((301, 328), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (318, 328), False, 'import logging\n'), ((784, 807), 'xml.etree.ElementTree.fromstring', 'ET.fromstring', (['response'], {}), '(response)\n', (797, 807), True, 'import xml.etree.ElementTree as ET\n')] |
import os, sys, time
import multiprocessing
import pickle
import unittest
import logging
from dpark.executor import *
class TestTask:
def __init__(self, id):
self.id = id
def run(self, aid):
import logging
import time
logging.info("run task %s", self)
return aid
class... | [
"unittest.main",
"logging.info",
"os.getcwd"
] | [((1621, 1636), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1634, 1636), False, 'import unittest\n'), ((261, 294), 'logging.info', 'logging.info', (['"""run task %s"""', 'self'], {}), "('run task %s', self)\n", (273, 294), False, 'import logging\n'), ((437, 482), 'logging.info', 'logging.info', (['"""recv stat... |
class Pipeline:
def __init__(self, ready):
self._queue = []
self._ready = ready
@property
def empty(self):
return not self._queue
def queue(self, task):
print("queued")
self._queue.append(task)
task.add_done_callback(self._task_done)
def _task_don... | [
"asyncio.set_event_loop",
"uvloop.new_event_loop",
"asyncio.sleep"
] | [((874, 890), 'uvloop.new_event_loop', 'new_event_loop', ([], {}), '()\n', (888, 890), False, 'from uvloop import new_event_loop\n'), ((895, 923), 'asyncio.set_event_loop', 'asyncio.set_event_loop', (['loop'], {}), '(loop)\n', (917, 923), False, 'import asyncio\n'), ((780, 800), 'asyncio.sleep', 'asyncio.sleep', (['sle... |
#!/usr/bin/env python
## -*- coding: utf-8 -*-
# BSD 3-Clause License
# Copyright (c) 2021, Tokyo Robotics Inc.
# 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 cod... | [
"toroboeye_camera.toroboeye_camera_service.ToroboeyeCameraService",
"rospy.init_node",
"toroboeye_camera.toroboeye_camera_client.get_capture_setting",
"toroboeye_camera.toroboeye_camera_client.update_frame",
"toroboeye_camera.toroboeye_camera_client.capture",
"cv_bridge.CvBridge",
"os.path.isdir",
"ro... | [((2279, 2304), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (2294, 2304), False, 'import os\n'), ((2334, 2359), 'os.path.basename', 'os.path.basename', (['ABSPATH'], {}), '(ABSPATH)\n', (2350, 2359), False, 'import os\n'), ((2442, 2484), 'rospy.init_node', 'rospy.init_node', (['NODE_NAME']... |
import numpy as np
from algorithms.ddpg.replay_buffer import ReplayBuffer
class PDSReplayBuffer(ReplayBuffer):
"""
Replay buffer for PDS-DDPG, just add some extra information to the basic replay buffer
"""
def __init__(self, state_dim, action_dim, length, batch_size):
super().__init__... | [
"numpy.zeros"
] | [((451, 490), 'numpy.zeros', 'np.zeros', (['[length, 1]'], {'dtype': 'np.float32'}), '([length, 1], dtype=np.float32)\n', (459, 490), True, 'import numpy as np\n'), ((577, 616), 'numpy.zeros', 'np.zeros', (['[length, 1]'], {'dtype': 'np.float32'}), '([length, 1], dtype=np.float32)\n', (585, 616), True, 'import numpy as... |
import pyarrow # type: ignore
from pyarrow.cffi import ffi
import rpy2.rinterface as rinterface
import rpy2.robjects as robjects
import rpy2.robjects.conversion as conversion
import rpy2.robjects.packages as packages
import typing
rarrow = packages.importr('arrow')
# make sure a version is installed with the C API... | [
"pyarrow.chunked_array",
"pyarrow.cffi.ffi.cast",
"pyarrow.cffi.ffi.new",
"rpy2.robjects.packages.importr",
"rpy2.robjects.conversion.Converter",
"rpy2.robjects.conversion.NameClassMap",
"pyarrow.Table.from_arrays",
"rpy2.rinterface.evalr"
] | [((243, 268), 'rpy2.robjects.packages.importr', 'packages.importr', (['"""arrow"""'], {}), "('arrow')\n", (259, 268), True, 'import rpy2.robjects.packages as packages\n'), ((8951, 9041), 'rpy2.robjects.conversion.Converter', 'conversion.Converter', (['"""default arrow conversion"""'], {'template': 'robjects.default_con... |
# Generated by Django 2.1.2 on 2019-01-04 17:52
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.DecimalField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField... | [((247, 304), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (278, 304), False, 'from django.db import migrations, models\n'), ((2850, 2949), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'djang... |
import io
import pytest
from dalia import read_hierarchy
@pytest.fixture
def hiercsv_filebuffer():
fl_content = """region-key,parent-key,name,alternatives,is_terminal,gadmid,agglomid,notes
CAmericas,World,Americas,,False,,,
U021,CAmericas,North America,,False,,,
"""
return io.StringIO(fl_content)
def test... | [
"io.StringIO",
"dalia.read_hierarchy"
] | [((286, 309), 'io.StringIO', 'io.StringIO', (['fl_content'], {}), '(fl_content)\n', (297, 309), False, 'import io\n'), ((453, 500), 'dalia.read_hierarchy', 'read_hierarchy', (['hiercsv_filebuffer'], {'skiplines': '(1)'}), '(hiercsv_filebuffer, skiplines=1)\n', (467, 500), False, 'from dalia import read_hierarchy\n')] |
from dal.oracle.common import execute_select
from dal.oracle.era import db
__author__ = '<NAME>'
def retrieve_run_by_acc(acc):
sql = """SELECT * FROM RUN WHERE RUN_ID = '%s'""" % acc
return execute_select(sql, db)
def retrieve_runs_by_submission_acc(submission_acc):
sql = """SELECT * FROM RUN WHERE SUBM... | [
"dal.oracle.common.execute_select"
] | [((201, 224), 'dal.oracle.common.execute_select', 'execute_select', (['sql', 'db'], {}), '(sql, db)\n', (215, 224), False, 'from dal.oracle.common import execute_select\n'), ((397, 420), 'dal.oracle.common.execute_select', 'execute_select', (['sql', 'db'], {}), '(sql, db)\n', (411, 420), False, 'from dal.oracle.common ... |
import os
import sys
sys.path.append("..")
import GlobalConfig as gl
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QApplication
from model import net
class Ui_MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
def setupUi... | [
"PyQt5.QtWidgets.QWidget",
"model.net.load_model",
"PyQt5.QtGui.QFont",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QStatusBar",
"PyQt5.QtWidgets.QVBoxLayout",
"sys.path.append",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QMenuBar"
] | [((21, 42), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (36, 42), False, 'import sys\n'), ((490, 519), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', (['MainWindow'], {}), '(MainWindow)\n', (507, 519), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((614, 651), 'PyQt5.QtWidgets.QWidg... |
from collections import defaultdict, deque
from datetime import datetime
def find_high_score(player_num, last_marble_value):
"""
>>> find_high_score(7, 25)
32
>>> find_high_score(10, 1618)
8317
>>> find_high_score(13, 7999)
146373
>>> find_high_score(17, 1104)
2764
>>> find_hig... | [
"datetime.datetime.now",
"collections.deque",
"collections.defaultdict"
] | [((660, 676), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (671, 676), False, 'from collections import defaultdict, deque\n'), ((700, 707), 'collections.deque', 'deque', ([], {}), '()\n', (705, 707), False, 'from collections import defaultdict, deque\n'), ((1586, 1600), 'datetime.datetime.now', '... |
import os
import base64
from aes_encryption import aes_encrypt
import asymmetric as Rencrypt
import sys
def encrypt_lin():
file_format = {'.DOC': 0, '.DOCX': 0, '.XLS': 0, '.XLSX': 0, '.PPT': 0, '.PPTX': 0, '.PST': 0, '.OST': 0, '.MSG': 0, '.EML': 0, '.VSD\
': 0, '.VSDX': 0, '.TXT': 0, '.CSV': 0, '.RTF': 0, '.WKS':... | [
"aes_encryption.aes_encrypt",
"os.path.join",
"asymmetric.d_main",
"os.walk",
"os.remove"
] | [((1307, 1327), 'os.walk', 'os.walk', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (1314, 1327), False, 'import os\n'), ((2055, 2072), 'asymmetric.d_main', 'Rencrypt.d_main', ([], {}), '()\n', (2070, 2072), True, 'import asymmetric as Rencrypt\n'), ((2170, 2203), 'os.remove', 'os.remove', (['"""res/temp_key.txt.y4h"""'], ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
import math
from torch.autograd import Variable
__all__ = ['NUFNet', 'nufnet8', 'nufnet16','nufnet33','nufnet50']
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Co... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Sequential",
"math.sqrt",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.Linear",
"torch.randn",
"torch.cat"
] | [((315, 404), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(3)', 'stride': 'stride', 'padding': '(1)', 'bias': '(False)'}), '(in_planes, out_planes, kernel_size=3, stride=stride, padding=1,\n bias=False)\n', (324, 404), True, 'import torch.nn as nn\n'), ((507, 581), 'torch.nn.Conv2d... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: user.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_data... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.descriptor.MethodDescriptor",
"google.protobuf.descriptor.FileDescriptor",
"google.protobuf.reflection.GeneratedProtocolMessageType"
] | [((372, 398), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (396, 398), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((416, 1027), 'google.protobuf.descriptor.FileDescriptor', '_descriptor.FileDescriptor', ([], {'name': '"""user.proto"""', 'packa... |
# Copyright 2016 Huawei, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"logging.getLogger",
"workspaceclient.osc.v1.parser_builder.Desktop.add_user_name_option",
"workspaceclient.osc.v1.parser_builder.Desktop.add_root_volume_option",
"workspaceclient.common.i18n._",
"workspaceclient.osc.v1.parser_builder.Desktop.add_security_group_option",
"workspaceclient.osc.v1.parser_buil... | [((884, 911), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (901, 911), False, 'import logging\n'), ((968, 986), 'workspaceclient.common.i18n._', '_', (['"""list desktops"""'], {}), "('list desktops')\n", (969, 986), False, 'from workspaceclient.common.i18n import _\n'), ((1906, 1936), '... |
import os
import pandas as pd
import numpy as np
from sklearn.preprocessing import MinMaxScaler
def load_data():
here = os.path.realpath(__file__)
here = os.path.dirname(here)
fn = os.path.join(here, 'monthly-milk-production.csv')
return pd.read_csv(fn, index_col='Month')
def clean_data(df):
# c... | [
"pandas.read_csv",
"os.path.join",
"os.path.realpath",
"os.path.dirname",
"pandas.to_datetime"
] | [((126, 152), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (142, 152), False, 'import os\n'), ((164, 185), 'os.path.dirname', 'os.path.dirname', (['here'], {}), '(here)\n', (179, 185), False, 'import os\n'), ((195, 244), 'os.path.join', 'os.path.join', (['here', '"""monthly-milk-productio... |
""" $lic$
Copyright (C) 2016-2020, <NAME>
All rights reserved.
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; wit... | [
"os.path.join"
] | [((802, 833), 'os.path.join', 'os.path.join', (['simdir', '"""out.cfg"""'], {}), "(simdir, 'out.cfg')\n", (814, 833), False, 'import os\n'), ((1090, 1121), 'os.path.join', 'os.path.join', (['simdir', '"""zsim.h5"""'], {}), "(simdir, 'zsim.h5')\n", (1102, 1121), False, 'import os\n')] |
import asyncio
import os
import math
from io import BytesIO
from xml.etree import ElementTree
import pytest
import hashlib
import aiohttp
from stsci_aws_utils import s3
from . import conftest
@pytest.fixture(autouse=True)
def monkeypatch_retry_constants(monkeypatch):
# No need to sleep while tests are running
... | [
"hashlib.md5",
"math.floor",
"stsci_aws_utils.s3.AsyncConcurrentS3Client",
"os.urandom",
"xml.etree.ElementTree.tostring",
"io.BytesIO",
"xml.etree.ElementTree.Element",
"pytest.raises",
"pytest.fixture",
"xml.etree.ElementTree.SubElement",
"stsci_aws_utils.s3.ConcurrentS3Client"
] | [((198, 226), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (212, 226), False, 'import pytest\n'), ((505, 531), 'os.urandom', 'os.urandom', (['content_length'], {}), '(content_length)\n', (515, 531), False, 'import os\n'), ((1207, 1285), 'xml.etree.ElementTree.Element', 'ElementTr... |
from socketserver import StreamRequestHandler, TCPServer
from socket import error as SocketError
import errno
import datetime
import time
import os
import base64
import numpy as np
import cv2
from scipy import misc
from warpgan import WarpGAN
from align.detect_align import detect_align
class GANnetworks:
def __in... | [
"numpy.random.normal",
"numpy.tile",
"cv2.imwrite",
"socketserver.TCPServer",
"warpgan.WarpGAN",
"align.detect_align.detect_align",
"numpy.ones",
"cv2.imencode",
"os.path.join",
"numpy.array",
"datetime.datetime.now",
"cv2.imdecode",
"threading.Thread",
"time.time"
] | [((586, 595), 'warpgan.WarpGAN', 'WarpGAN', ([], {}), '()\n', (593, 595), False, 'from warpgan import WarpGAN\n'), ((1032, 1078), 'numpy.tile', 'np.tile', (['img[None]', '[self.num_styles, 1, 1, 1]'], {}), '(img[None], [self.num_styles, 1, 1, 1])\n', (1039, 1078), True, 'import numpy as np\n'), ((1146, 1237), 'numpy.ra... |
import unittest
import os
import platform
import pygame
SDL1 = pygame.get_sdl_version()[0] < 2
DARWIN = "Darwin" in platform.platform()
class MouseTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
# The display needs to be initialized for mouse functions.
pygame.display.init()
... | [
"pygame.get_sdl_version",
"pygame.display.init",
"pygame.mouse.get_pressed",
"pygame.event.get",
"pygame.display.set_mode",
"platform.platform",
"unittest.skipIf",
"pygame.mouse.get_pos",
"pygame.mouse.get_focused",
"pygame.display.quit",
"pygame.mouse.set_visible",
"pygame.mouse.get_rel",
"... | [((117, 136), 'platform.platform', 'platform.platform', ([], {}), '()\n', (134, 136), False, 'import platform\n'), ((477, 554), 'unittest.skipIf', 'unittest.skipIf', (['(SDL1 and DARWIN)', '"""Can fails on Mac SDL1, window not focused"""'], {}), "(SDL1 and DARWIN, 'Can fails on Mac SDL1, window not focused')\n", (492, ... |
# -*- coding: utf-8 -*-
from django.http import JsonResponse
from .models import Jugador, Seleccion
def obtener_jugadores(request):
pais_id = request.GET.get('pais_id')
jugadores_select = '<option value="" selected="selected">---------</option>'
if pais_id:
pais = Seleccion.objects.get(pk=pais_id... | [
"django.http.JsonResponse"
] | [((645, 667), 'django.http.JsonResponse', 'JsonResponse', (['response'], {}), '(response)\n', (657, 667), False, 'from django.http import JsonResponse\n')] |
import os
import unittest
from unittest.mock import patch
from .fixtures.defaults import DEFAULT_ARGS, TEST_FOLDER
from .test_helper import TestMixin
from samsgeneratechangelog import GenerateChangelog
@patch.dict('os.environ', {'TZ': 'UTC'})
class TestJinjaFeatures(unittest.TestCase, TestMixin):
def setUp(self)... | [
"os.path.join",
"unittest.mock.patch.dict"
] | [((205, 244), 'unittest.mock.patch.dict', 'patch.dict', (['"""os.environ"""', "{'TZ': 'UTC'}"], {}), "('os.environ', {'TZ': 'UTC'})\n", (215, 244), False, 'from unittest.mock import patch\n'), ((524, 590), 'os.path.join', 'os.path.join', (['TEST_FOLDER', '"""fixtures"""', '"""template_with_includes.j2"""'], {}), "(TEST... |
import numpy as np
import pandas as pd
def sma(series: pd.Series, short_period: int, long_period: int) -> pd.Series:
short_series = series.rolling(short_period).mean()
long_series = series.rolling(long_period).mean()
sma_positions = pd.Series(
np.where(short_series > long_series, 1, -1), index=ser... | [
"numpy.where"
] | [((266, 309), 'numpy.where', 'np.where', (['(short_series > long_series)', '(1)', '(-1)'], {}), '(short_series > long_series, 1, -1)\n', (274, 309), True, 'import numpy as np\n')] |
import numpy as np
import cv2
def img_clahe(img):
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
img = clahe.apply(img)
return img
def img_clahe_cm(img):
b,g,r = cv2.split(img)
clahe = cv2.createCLAHE(clipLimit=1.0, tileGridSize=(8,8))
b = clahe.apply(b)
g = clahe.apply(g)
... | [
"numpy.mean",
"cv2.merge",
"numpy.abs",
"numpy.min",
"cv2.createCLAHE",
"numpy.max",
"cv2.addWeighted",
"cv2.split",
"numpy.std",
"cv2.Sobel"
] | [((63, 114), 'cv2.createCLAHE', 'cv2.createCLAHE', ([], {'clipLimit': '(2.0)', 'tileGridSize': '(8, 8)'}), '(clipLimit=2.0, tileGridSize=(8, 8))\n', (78, 114), False, 'import cv2\n'), ((192, 206), 'cv2.split', 'cv2.split', (['img'], {}), '(img)\n', (201, 206), False, 'import cv2\n'), ((219, 270), 'cv2.createCLAHE', 'cv... |
# call this script with `python -m evaluation.evaluate_poselines_globalaction`
import numpy as np
from numpy.core.fromnumeric import sort
import pandas as pd
import datetime
import torch
import pickle
from torch.functional import norm
from tqdm import tqdm
from . import eval_utils
from compoelem.config import config
f... | [
"compoelem.compare.pose_line.compare_pose_lines_3",
"compoelem.generate.global_action.get_global_action_lines",
"numpy.array",
"numpy.lexsort",
"datetime.datetime.now",
"compoelem.compare.pose_line.filter_pose_line_ga_result",
"compoelem.compare.normalize.norm_by_global_action",
"compoelem.generate.po... | [((1072, 1200), 'compoelem.compare.normalize.norm_by_global_action', 'norm_by_global_action', (["query_data['compoelem']['pose_lines']", "query_data['compoelem']['global_action_lines']"], {'fallback': '(True)'}), "(query_data['compoelem']['pose_lines'], query_data[\n 'compoelem']['global_action_lines'], fallback=Tru... |
from unittest2 import TestCase
from datetime import datetime
from teleport import t
from teleport.compat import PY2
class T(object):
pairs = []
undefined = []
def test_from_json(self):
for pair in self.pairs:
self.assertEqual(t(self.schema).from_json(pair[0]), pair[1])
def test_... | [
"datetime.datetime",
"teleport.t"
] | [((479, 520), 'datetime.datetime', 'datetime', (['(2013)', '(10)', '(18)', '(1)', '(58)', '(24)', '(904349)'], {}), '(2013, 10, 18, 1, 58, 24, 904349)\n', (487, 520), False, 'from datetime import datetime\n'), ((262, 276), 'teleport.t', 't', (['self.schema'], {}), '(self.schema)\n', (263, 276), False, 'from teleport im... |
from MiscUtils.DataTable import DataTable
from MiscUtils.Funcs import hostName as HostName
from SitePage import SitePage
class SelectDatabase(SitePage):
def writeSideBar(self):
self.writeln('<a href="?showHelp=1" class="SideBarLink">Help</a>')
def writeContent(self):
self.saveFieldsToCookies... | [
"MiscUtils.DataTable.DataTable",
"MiscUtils.Funcs.hostName"
] | [((832, 843), 'MiscUtils.DataTable.DataTable', 'DataTable', ([], {}), '()\n', (841, 843), False, 'from MiscUtils.DataTable import DataTable\n'), ((1809, 1819), 'MiscUtils.Funcs.hostName', 'HostName', ([], {}), '()\n', (1817, 1819), True, 'from MiscUtils.Funcs import hostName as HostName\n')] |