code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
import math
import numpy as np
from numpy import exp
def sigmoid(x):
return 1 / (1 + exp(-x))
def tanh(x):
return np.tanh(x) | [
"numpy.exp",
"numpy.tanh"
] | [((127, 137), 'numpy.tanh', 'np.tanh', (['x'], {}), '(x)\n', (134, 137), True, 'import numpy as np\n'), ((92, 99), 'numpy.exp', 'exp', (['(-x)'], {}), '(-x)\n', (95, 99), False, 'from numpy import exp\n')] |
##########################################################################
#
# Copyright (c) 2010-2013, Image Engine Design 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:
#
# * Redis... | [
"unittest.main",
"IECoreHoudini.FromHoudiniGeometryConverter.create",
"IECore.CubicBasisf.linear",
"hou.setFrame",
"hou.parm",
"IECoreHoudini.FromHoudiniGeometryConverter.createDummy",
"IECore.TypeId",
"IECoreHoudini.FromHoudiniGeometryConverter.supportedTypes",
"hou.node",
"IECoreHoudini.FromHoud... | [((20622, 20637), 'unittest.main', 'unittest.main', ([], {}), '()\n', (20635, 20637), False, 'import unittest\n'), ((4892, 4939), 'IECoreHoudini.FromHoudiniCurvesConverter', 'IECoreHoudini.FromHoudiniCurvesConverter', (['curve'], {}), '(curve)\n', (4932, 4939), False, 'import IECoreHoudini\n'), ((5144, 5200), 'IECoreHo... |
#
#
#
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
import sys
# effective temperature prior
# inputs
Sbar = 60.
eSbar = 1.
Tinput = 8700.
# load spectral type |-> temperature conversion file
dt = {'ST': np.str, 'STix': np.float64, 'Teff':np.float64,... | [
"numpy.trapz",
"numpy.zeros_like",
"pandas.read_csv",
"numpy.min",
"numpy.max",
"numpy.array",
"numpy.exp",
"scipy.interpolate.interp1d",
"numpy.sqrt"
] | [((346, 439), 'pandas.read_csv', 'pd.read_csv', (['"""data/adopted_spt-teff.txt"""'], {'dtype': 'dt', 'names': "['ST', 'STix', 'Teff', 'eTeff']"}), "('data/adopted_spt-teff.txt', dtype=dt, names=['ST', 'STix',\n 'Teff', 'eTeff'])\n", (357, 439), True, 'import pandas as pd\n'), ((485, 504), 'numpy.array', 'np.array',... |
# This is not needed if the trackintel library is installed. ==================
import sys
sys.path.append("..")
sys.path.append("../trackintel")
# =============================================================================
import logging
import matplotlib.pyplot as plt
import trackintel as ti
from trackintel.geog... | [
"sys.path.append",
"logging.basicConfig",
"trackintel.geogr.distances.meters_to_decimal_degrees",
"trackintel.read_positionfixes_csv",
"sys.exit"
] | [((91, 112), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (106, 112), False, 'import sys\n'), ((113, 145), 'sys.path.append', 'sys.path.append', (['"""../trackintel"""'], {}), "('../trackintel')\n", (128, 145), False, 'import sys\n'), ((367, 468), 'logging.basicConfig', 'logging.basicConfig', (... |
"""
This module handles all things related to creating a new invoice, including
* keeping track of when they were issued
* making sure they have unique and correct invoice numbers
* keeping track who was the issuer of the invoice (changes form year to year)
* stroing full copy in the Invoice model to be viewed later.
... | [
"django.db.models.Max",
"conference.currencies.normalize_price",
"unicodecsv.DictWriter",
"decimal.Decimal",
"django.template.loader.render_to_string",
"assopy.models.Invoice.objects.update_or_create",
"datetime.date.today",
"assopy.models.Invoice.objects.filter",
"conference.currencies.convert_from... | [((3226, 3295), 'assopy.models.Invoice.objects.filter', 'Invoice.objects.filter', ([], {'code__startswith': 'prefix', 'emit_date__year': 'year'}), '(code__startswith=prefix, emit_date__year=year)\n', (3248, 3295), False, 'from assopy.models import Invoice, Order\n'), ((7401, 7429), 'conference.models.Conference.objects... |
import matplotlib.pyplot as plt
import numpy as np
from timevariant_invariant import time_var_invar
from comb_step_ramp1 import comb_step_ramp1
t = np.arange(-10, 10,0.01)
'general form is a(b*t-c+d) c is shift which is t0'
time_var_invar(1,1,2,0,t)
time_var_invar(-1,1,2,0,t)
time_var_invar(1,-1,2,0,t)
time_... | [
"numpy.arange",
"timevariant_invariant.time_var_invar"
] | [((152, 176), 'numpy.arange', 'np.arange', (['(-10)', '(10)', '(0.01)'], {}), '(-10, 10, 0.01)\n', (161, 176), True, 'import numpy as np\n'), ((232, 261), 'timevariant_invariant.time_var_invar', 'time_var_invar', (['(1)', '(1)', '(2)', '(0)', 't'], {}), '(1, 1, 2, 0, t)\n', (246, 261), False, 'from timevariant_invarian... |
"""Advent of Code 2016 Day 14."""
import hashlib
import re
puzzle = 'zpqevtbw'
def main(salt=puzzle):
key_index, _ = find_nth_pad_key(puzzle, 64)
print(f'Index producing 64th key: {key_index}')
key_index, _ = find_nth_pad_key(puzzle, 64, 2017)
print(f'Index producing 64th key with hashing 2017 times... | [
"re.findall"
] | [((1418, 1441), 're.findall', 're.findall', (['regex', 'text'], {}), '(regex, text)\n', (1428, 1441), False, 'import re\n')] |
import pytest
def test_keyword__Table__1(address_book, browser):
"""The `Table` shows that initially no keywords are defined."""
browser.login('editor')
browser.open(browser.MASTER_DATA_URL)
browser.getLink('Keywords').click()
assert browser.KEYWORDS_LIST_URL == browser.url
assert '>No keyword... | [
"pytest.mark.parametrize",
"pytest.raises"
] | [((8814, 8876), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""loginname"""', "['visitor', 'archivist']"], {}), "('loginname', ['visitor', 'archivist'])\n", (8837, 8876), False, 'import pytest\n'), ((4721, 4747), 'pytest.raises', 'pytest.raises', (['LookupError'], {}), '(LookupError)\n', (4734, 4747), Fals... |
"""
Simple genetic algorithm class in Python
Copyright (C) 2014 <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... | [
"sys.stdout.write",
"numpy.sum",
"numpy.abs",
"numpy.shape",
"os.path.isfile",
"numpy.histogram",
"sys.stdout.flush",
"numpy.arange",
"numpy.exp",
"numpy.copy",
"numpy.append",
"matplotlib.pyplot.show",
"numpy.random.permutation",
"matplotlib.pyplot.ylabel",
"numpy.dot",
"sys.exit",
... | [((2684, 2712), 'numpy.copy', 'np.copy', (['nnet.hiddenLayerOne'], {}), '(nnet.hiddenLayerOne)\n', (2691, 2712), True, 'import numpy as np\n'), ((2832, 2857), 'numpy.copy', 'np.copy', (['nnet.outputLayer'], {}), '(nnet.outputLayer)\n', (2839, 2857), True, 'import numpy as np\n'), ((5376, 5410), 'os.path.isfile', 'os.pa... |
"""Test AdaNet ensemble single graph implementation.
Copyright 2018 The AdaNet Authors. 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
https://www.apache.org/licenses/LIC... | [
"os.mkdir",
"tensorflow.get_collection",
"tensorflow.reset_default_graph",
"tensorflow.summary.audio",
"tensorflow.local_variables_initializer",
"adanet.core.testing_utils.dummy_tensor",
"shutil.rmtree",
"tensorflow.test.main",
"tensorflow.train.get_or_create_global_step",
"tensorflow.no_op",
"t... | [((5425, 8522), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["{'testcase_name': 'no_previous_ensemble', 'want_logits': [[0.016], [0.117]],\n 'want_loss': 1.338, 'want_adanet_loss': 1.338,\n 'want_mixture_weight_vars': 1}", "{'testcase_name': 'no_previous_ensemble_prune_all', ... |
import pytest
import respx
from httpx import Response
from app.factories.stylesheet import StylesheetFactory
from tests.helper import make_html, make_snapshot
@pytest.mark.asyncio
@respx.mock
async def test_build_from_snapshot():
snapshot = make_snapshot()
html = make_html()
html.content = '<html><body>... | [
"tests.helper.make_snapshot",
"respx.get",
"tests.helper.make_html",
"httpx.Response",
"app.factories.stylesheet.StylesheetFactory.from_snapshot"
] | [((248, 263), 'tests.helper.make_snapshot', 'make_snapshot', ([], {}), '()\n', (261, 263), False, 'from tests.helper import make_html, make_snapshot\n'), ((275, 286), 'tests.helper.make_html', 'make_html', ([], {}), '()\n', (284, 286), False, 'from tests.helper import make_html, make_snapshot\n'), ((516, 594), 'httpx.R... |
# coding: utf-8
# ## Financial and technology articles taken from [webhose.io](https://webhose.io/datasets)
# In[1]:
import pandas as pd
import json
import glob
get_ipython().magic('matplotlib inline')
# ## Take a look at one JSON file
# In[2]:
with open('financial_news/data/09/news_0000001.json','r') as inFi... | [
"pandas.DataFrame",
"sklearn.feature_extraction.text.CountVectorizer",
"sklearn.preprocessing.LabelBinarizer",
"sklearn.naive_bayes.MultinomialNB",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.f1_score",
"sklearn.metrics.make_scorer",
"sklearn.pipeline.Pipeline",
"sklearn.feature_ext... | [((969, 1033), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': "{'text': financeTexts, 'category': 'finance'}"}), "(data={'text': financeTexts, 'category': 'finance'})\n", (981, 1033), True, 'import pandas as pd\n'), ((1660, 1690), 'sklearn.preprocessing.LabelBinarizer', 'preprocessing.LabelBinarizer', ([], {}), '()\... |
import shutil
# 移动单个文件,如果目标文件夹存在则被覆盖
shutil.move('/Users/moqi/Downloads/c09_test/1/1.txt', '/Users/moqi/Downloads/c09_test/2/')
# 移动单个文件并重命名
shutil.move('/Users/moqi/Downloads/c09_test/1/zzz.txt', '/Users/moqi/Downloads/c09_test/2/zzz2.txt')
# 注意:移动单个文件,目标文件夹不存在,则重命名文件为 3
shutil.move('/Users/moqi/Downloads/c09_test/1/... | [
"shutil.move"
] | [((38, 132), 'shutil.move', 'shutil.move', (['"""/Users/moqi/Downloads/c09_test/1/1.txt"""', '"""/Users/moqi/Downloads/c09_test/2/"""'], {}), "('/Users/moqi/Downloads/c09_test/1/1.txt',\n '/Users/moqi/Downloads/c09_test/2/')\n", (49, 132), False, 'import shutil\n'), ((142, 246), 'shutil.move', 'shutil.move', (['"""/... |
from pyquery import PyQuery
from Cookie import SimpleCookie
from django.urls import reverse as urlreverse
import debug # pyflakes:ignore
from ietf.utils.test_data import make_test_data
from ietf.utils.test_utils import TestCase
class CookieTests(TestCase):
def test_settings_defaults(... | [
"Cookie.SimpleCookie",
"ietf.utils.test_data.make_test_data",
"pyquery.PyQuery",
"django.urls.reverse"
] | [((335, 351), 'ietf.utils.test_data.make_test_data', 'make_test_data', ([], {}), '()\n', (349, 351), False, 'from ietf.utils.test_data import make_test_data\n'), ((534, 552), 'pyquery.PyQuery', 'PyQuery', (['r.content'], {}), '(r.content)\n', (541, 552), False, 'from pyquery import PyQuery\n'), ((1057, 1073), 'ietf.uti... |
import json
from .webwait import follow_events, get_field
def render_message(msg):
lines = []
lines.append('== %d: from %s (cid=%d #%d):' % (
msg["id"], msg["petname"], msg["cid"], msg["seqnum"]))
payload = json.loads(msg["payload_json"])
if "basic" in payload:
lines.append(" basic: " +... | [
"json.loads"
] | [((228, 259), 'json.loads', 'json.loads', (["msg['payload_json']"], {}), "(msg['payload_json'])\n", (238, 259), False, 'import json\n'), ((856, 873), 'json.loads', 'json.loads', (['value'], {}), '(value)\n', (866, 873), False, 'import json\n')] |
from django.contrib import admin
from .models import Posts, Quotes
admin.site.register(Posts)
admin.site.register(Quotes)
| [
"django.contrib.admin.site.register"
] | [((68, 94), 'django.contrib.admin.site.register', 'admin.site.register', (['Posts'], {}), '(Posts)\n', (87, 94), False, 'from django.contrib import admin\n'), ((95, 122), 'django.contrib.admin.site.register', 'admin.site.register', (['Quotes'], {}), '(Quotes)\n', (114, 122), False, 'from django.contrib import admin\n')... |
import pytest
from loqusdb.exceptions import CaseError
from loqusdb.utils.case import update_case
def test_update_case(case_obj, sv_case_obj):
## GIVEN a case with snv info and a case with sv info
assert sv_case_obj["vcf_path"] is None
assert case_obj["vcf_path"] is not None
assert case_obj["vcf_sv_pa... | [
"pytest.raises",
"loqusdb.utils.case.update_case"
] | [((433, 490), 'loqusdb.utils.case.update_case', 'update_case', ([], {'case_obj': 'sv_case_obj', 'existing_case': 'case_obj'}), '(case_obj=sv_case_obj, existing_case=case_obj)\n', (444, 490), False, 'from loqusdb.utils.case import update_case\n'), ((1236, 1260), 'pytest.raises', 'pytest.raises', (['CaseError'], {}), '(C... |
# -*- coding: utf-8 -*-
__author__ = 'hyd'
from abc import ABCMeta,abstractmethod
from lib.exceptions import ArgumentTypeException
from uuid import uuid4
'''
schemas :
container : 标识一个容器
portId : 对应的交换机端口号
mac : container的mac地址
hostId : 容器对应的主机ID
dpId : 容器所连... | [
"uuid.uuid4",
"lib.exceptions.ArgumentTypeException"
] | [((2007, 2034), 'lib.exceptions.ArgumentTypeException', 'ArgumentTypeException', (['data'], {}), '(data)\n', (2028, 2034), False, 'from lib.exceptions import ArgumentTypeException\n'), ((2097, 2104), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (2102, 2104), False, 'from uuid import uuid4\n')] |
import os
base_dir = 'train'
for d in os.listdir(base_dir):
if 'empty' == d: continue
count = 0
prefix = d.split('_')[1]
tmp = base_dir+'/'+d+'/'
for f in os.listdir(tmp):
count += 1
ext = f.split('.')[-1]
os.rename(tmp+f, tmp+prefix+str(count)+'.'+ext)
# print(tmp+p... | [
"os.listdir"
] | [((39, 59), 'os.listdir', 'os.listdir', (['base_dir'], {}), '(base_dir)\n', (49, 59), False, 'import os\n'), ((176, 191), 'os.listdir', 'os.listdir', (['tmp'], {}), '(tmp)\n', (186, 191), False, 'import os\n')] |
import komand
from .schema import PassiveDnsInput, PassiveDnsOutput, Input, Output, Component
# Custom imports below
from komand.exceptions import PluginException
class PassiveDns(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name="passive_dns",
descrip... | [
"komand.exceptions.PluginException"
] | [((912, 974), 'komand.exceptions.PluginException', 'PluginException', ([], {'preset': 'PluginException.Preset.UNKNOWN', 'data': 'e'}), '(preset=PluginException.Preset.UNKNOWN, data=e)\n', (927, 974), False, 'from komand.exceptions import PluginException\n')] |
from __future__ import absolute_import
from collections import OrderedDict
import os
import shutil
import subprocess
import sys
import tempfile
import time
import zipfile
from celery import task, registry
from celery import Task
from celery.task.control import revoke
from django.conf import settings
from django.core.... | [
"os.remove",
"celery.task.control.revoke",
"rodan.models.RunJob",
"distutils.spawn.find_executable",
"rodan.jobs.base.TemporaryDirectory",
"os.path.join",
"subprocess.check_call",
"shutil.copy",
"rodan.models.Resource.objects.get",
"six.moves.range",
"django.db.models.Value",
"os.path.dirname"... | [((5094, 5129), 'celery.task', 'task', ([], {'name': '"""rodan.core.create_diva"""'}), "(name='rodan.core.create_diva')\n", (5098, 5129), False, 'from celery import task, registry\n'), ((36835, 36877), 'celery.task', 'task', ([], {'name': '"""rodan.core.cancel_workflowrun"""'}), "(name='rodan.core.cancel_workflowrun')\... |
import numpy as np
import cv2
import os
import matplotlib.pyplot as plt
pastas = os.listdir("gestures")
dataset = []
classes = []
temp = [0 for i in range(len(pastas))]
for i,pasta in enumerate(pastas):
images = os.listdir("gestures/"+pasta)
copy = temp.copy()
copy[i] = 1
for img in imag... | [
"cv2.imread",
"os.listdir"
] | [((87, 109), 'os.listdir', 'os.listdir', (['"""gestures"""'], {}), "('gestures')\n", (97, 109), False, 'import os\n'), ((229, 260), 'os.listdir', 'os.listdir', (["('gestures/' + pasta)"], {}), "('gestures/' + pasta)\n", (239, 260), False, 'import os\n'), ((378, 392), 'cv2.imread', 'cv2.imread', (['st'], {}), '(st)\n', ... |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 <NAME>
# Copyright (c) 2008-2020 pyglet contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following c... | [
"pyglet.text.document.UnformattedDocument",
"pyglet.text.caret.Caret",
"pyglet.text.layout.IncrementalTextLayout",
"pyglet.graphics.Batch",
"pyglet.sprite.Sprite",
"pyglet.shapes.Rectangle",
"pyglet.graphics.Group"
] | [((4014, 4042), 'pyglet.graphics.Group', 'Group', ([], {'order': '(0)', 'parent': 'group'}), '(order=0, parent=group)\n', (4019, 4042), False, 'from pyglet.graphics import Group\n'), ((4066, 4142), 'pyglet.sprite.Sprite', 'pyglet.sprite.Sprite', (['self._depressed_img', 'x', 'y'], {'batch': 'batch', 'group': 'bg_group'... |
# -*- coding: utf-8 -*-
from openprocurement.api.utils import (
json_view,
)
from openprocurement.api.validation import (
validate_file_update,
validate_patch_document_data,
validate_file_upload,
)
from openprocurement.tender.core.views.document import CoreDocumentResource
from openprocurement.tender.op... | [
"openprocurement.api.utils.json_view",
"openprocurement.tender.openeu.utils.qualifications_resource"
] | [((618, 985), 'openprocurement.tender.openeu.utils.qualifications_resource', 'qualifications_resource', ([], {'name': '"""aboveThresholdEU:Tender Qualification Documents"""', 'collection_path': '"""/tenders/{tender_id}/qualifications/{qualification_id}/documents"""', 'path': '"""/tenders/{tender_id}/qualifications/{qua... |
# <NAME> <<EMAIL>>
import copy
import logging
import pytest
try:
import unittest.mock as mock
except ImportError:
import mock
from alphatwirl.selection.modules.Count import Count
##__________________________________________________________________||
@pytest.fixture()
def obj1_results_org():
return [
... | [
"copy.deepcopy",
"alphatwirl.selection.modules.Count.Count",
"pytest.fixture"
] | [((262, 278), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (276, 278), False, 'import pytest\n'), ((438, 454), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (452, 454), False, 'import pytest\n'), ((569, 585), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (583, 585), False, 'import pytest\n'), (... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Nipype interfaces core
......................
Defines the ``Interface`` API and the body of the
most basic interfaces.
The I/O specifications corresponding to these base
interf... | [
"future.standard_library.install_aliases",
"textwrap.wrap",
"gc.collect",
"datetime.datetime.utcnow",
"select.select",
"os.path.join",
"numpy.atleast_2d",
"os.path.abspath",
"platform.node",
"builtins.open",
"traceback.format_exc",
"numpy.loadtxt",
"re.sub",
"simplejson.dump",
"subproces... | [((1396, 1430), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (1428, 1430), False, 'from future import standard_library\n'), ((24576, 24681), 'subprocess.Popen', 'sp.Popen', (['cmdline'], {'stdout': 'stdout', 'stderr': 'stderr', 'shell': '(True)', 'cwd': 'runtime.cwd',... |
import time
import random
import pygame
import moderngl
from numpy import pi
import pyrr
from engine.model import load_obj, create_skybox
from engine.light import BasicLight
from engine.camera import FirstPersonController
from engine.ui import Image, Text
pygame.init()
WINDOW_WIDTH, WINDOW_HEIGHT = 1280, 720
pygame.... | [
"engine.light.BasicLight",
"engine.model.create_skybox",
"pygame.mouse.set_visible",
"pygame.event.get",
"engine.ui.Text",
"moderngl.create_context",
"pygame.mouse.get_pos",
"engine.camera.FirstPersonController",
"random.randint",
"pygame.display.set_mode",
"pygame.mouse.get_rel",
"pygame.mixe... | [((259, 272), 'pygame.init', 'pygame.init', ([], {}), '()\n', (270, 272), False, 'import pygame\n'), ((313, 377), 'pygame.display.gl_set_attribute', 'pygame.display.gl_set_attribute', (['pygame.GL_MULTISAMPLEBUFFERS', '(1)'], {}), '(pygame.GL_MULTISAMPLEBUFFERS, 1)\n', (344, 377), False, 'import pygame\n'), ((378, 442)... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# This file is auto-generated by h2o-3/h2o-bindings/bin/gen_python.py
# Copyright 2016 H2O.ai; Apache License Version 2.0 (see LICENSE for details)
#
from __future__ import absolute_import, division, print_function, unicode_literals
from h2o.estimators.estimator_base ... | [
"h2o.utils.typechecks.Enum",
"h2o.exceptions.H2OValueError",
"h2o.frame.H2OFrame._validate",
"h2o.utils.typechecks.assert_is_type"
] | [((3159, 3192), 'h2o.utils.typechecks.assert_is_type', 'assert_is_type', (['nfolds', 'None', 'int'], {}), '(nfolds, None, int)\n', (3173, 3192), False, 'from h2o.utils.typechecks import assert_is_type, Enum, numeric\n'), ((4832, 4863), 'h2o.utils.typechecks.assert_is_type', 'assert_is_type', (['seed', 'None', 'int'], {... |
import builtins
import io
open("filepath") # $ getAPathArgument="filepath"
open(file="filepath") # $ getAPathArgument="filepath"
o = open
o("filepath") # $ getAPathArgument="filepath"
o(file="filepath") # $ getAPathArgument="filepath"
builtins.open("filepath") # $ getAPathArgument="filepath"
builtins.open(fil... | [
"builtins.open",
"io.open"
] | [((244, 269), 'builtins.open', 'builtins.open', (['"""filepath"""'], {}), "('filepath')\n", (257, 269), False, 'import builtins\n'), ((303, 333), 'builtins.open', 'builtins.open', ([], {'file': '"""filepath"""'}), "(file='filepath')\n", (316, 333), False, 'import builtins\n'), ((369, 388), 'io.open', 'io.open', (['"""f... |
from flask import current_app
from cachetools import TTLCache, cached
from server.models.dtos.message_dto import ChatMessageDTO, ProjectChatDTO
from server.models.postgis.project_chat import ProjectChat
from server.services.messaging.message_service import MessageService
from server.services.users.authentication_servic... | [
"cachetools.TTLCache",
"server.db.session.commit",
"cachetools.cached",
"flask.current_app.logger.debug",
"server.services.messaging.message_service.MessageService.send_message_after_chat",
"server.models.postgis.project_chat.ProjectChat.get_messages",
"server.models.postgis.project_chat.ProjectChat.cre... | [((428, 456), 'cachetools.TTLCache', 'TTLCache', ([], {'maxsize': '(64)', 'ttl': '(10)'}), '(maxsize=64, ttl=10)\n', (436, 456), False, 'from cachetools import TTLCache, cached\n'), ((1156, 1174), 'cachetools.cached', 'cached', (['chat_cache'], {}), '(chat_cache)\n', (1162, 1174), False, 'from cachetools import TTLCach... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 11 19:06:06 2020
@author: <NAME>
Abstract:
Some examples on planarity, chordality and drawing of clique forests
"""
import networkx as nx
import matplotlib.pyplot as plt
g = nx.Graph()
g.add_nodes_from(range(1,6))
c1 = nx.complete_graph(range(1,5))
c2 = nx.complete_gr... | [
"matplotlib.pyplot.subplot",
"networkx.maximum_spanning_tree",
"networkx.is_chordal",
"networkx.check_planarity",
"networkx.Graph",
"networkx.draw"
] | [((225, 235), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (233, 235), True, 'import networkx as nx\n'), ((395, 405), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (403, 405), True, 'import networkx as nx\n'), ((512, 556), 'networkx.check_planarity', 'nx.check_planarity', (['ct'], {'counterexample': '(False)'}), '... |
from sea.utils import import_string, cached_property
from sea.middleware import BaseMiddleware
from sea.pb2 import default_pb2
from playhouse import db_url
from peewee import DoesNotExist, DataError
import grpc
from .validation import ValidationError
class Peeweext:
def __init__(self, ns='PW_'):
self.ns ... | [
"playhouse.db_url.connect",
"sea.pb2.default_pb2.Empty"
] | [((581, 628), 'playhouse.db_url.connect', 'db_url.connect', (["config['db_url']"], {}), "(config['db_url'], **conn_params)\n", (595, 628), False, 'from playhouse import db_url\n'), ((2348, 2367), 'sea.pb2.default_pb2.Empty', 'default_pb2.Empty', ([], {}), '()\n', (2365, 2367), False, 'from sea.pb2 import default_pb2\n'... |
import base64
from unittest.mock import patch, Mock, PropertyMock, MagicMock
import pytest
from baldrick.config import loads
from baldrick.github.github_api import (FILE_CACHE, RepoHandler, IssueHandler,
PullRequestHandler)
# TODO: Add more tests to increase coverage.
class... | [
"unittest.mock.patch.object",
"baldrick.github.github_api.PullRequestHandler",
"unittest.mock.MagicMock",
"baldrick.github.github_api.RepoHandler",
"unittest.mock.Mock",
"baldrick.config.loads",
"unittest.mock.patch",
"pytest.raises",
"base64.b64encode",
"baldrick.github.github_api.IssueHandler",
... | [((450, 471), 'unittest.mock.patch', 'patch', (['"""requests.get"""'], {}), "('requests.get')\n", (455, 471), False, 'from unittest.mock import patch, Mock, PropertyMock, MagicMock\n'), ((1031, 1052), 'unittest.mock.patch', 'patch', (['"""requests.get"""'], {}), "('requests.get')\n", (1036, 1052), False, 'from unittest... |
#!/usr/bin/env python3
import sys
import shutil
import subprocess
from distutils.util import strtobool
import argparse
import time
import itertools
from math import ceil
from operator import itemgetter
from PIL import Image
from pathlib import Path
from dataclasses import dataclass, field, asdict
from collections impor... | [
"ScreenBuilder.ScreenBuilder",
"logging.error",
"argparse.ArgumentParser",
"logging.basicConfig",
"math.ceil",
"shutil.copy2",
"PIL.Image.open",
"logging.info",
"pathlib.Path",
"array.array",
"operator.itemgetter",
"sys.exit"
] | [((5025, 5047), 'PIL.Image.open', 'Image.open', (['image_path'], {}), '(image_path)\n', (5035, 5047), False, 'from PIL import Image\n'), ((5149, 5191), 'logging.info', 'log.info', (['f"""Converting image {image_path}"""'], {}), "(f'Converting image {image_path}')\n", (5157, 5191), True, 'import logging as log\n'), ((53... |
import os
from lxml import etree
import mimetypes
from django.conf import settings
from django.db import models
from survey.models.base import BaseModel
from survey.models.interviewer import Interviewer
from survey.models.surveys import Survey
from survey.models.enumeration_area import EnumerationArea
from survey.model... | [
"django.db.models.FileField",
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"lxml.etree.fromstring",
"lxml.etree.Element",
"os.path.basename",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.IntegerField",
"lxml.etree.tostring",
"mimetypes.guess... | [((405, 478), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['"""SurveyAllocation"""'], {'related_name': '"""file_downloads"""'}), "('SurveyAllocation', related_name='file_downloads')\n", (427, 478), False, 'from django.db import models\n'), ((574, 636), 'django.db.models.ForeignKey', 'models.ForeignKe... |
import os
import re
import argparse
##
# Create a directory structure for ACCESS Production Runs
#
# Usage: create_access_project -p Project_10151_B -o /home/user/my_run
#
# Results in:
#
# /output_location/project_id
# /bam_qc
# /structural_variants
# /small_variants
# /copy_number_variants
# /microsatellit... | [
"os.mkdir",
"os.path.join",
"argparse.ArgumentParser",
"re.compile"
] | [((364, 399), 're.compile', 're.compile', (['"""Project_\\\\d{5}_.{1,2}"""'], {}), "('Project_\\\\d{5}_.{1,2}')\n", (374, 399), False, 'import re\n'), ((794, 819), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (817, 819), False, 'import argparse\n'), ((1415, 1466), 'os.path.join', 'os.path.joi... |
#
# Copyright (c) 2013-2016 <NAME> <<EMAIL>>
#
# Distributed under the terms of the GNU GENERAL PUBLIC LICENSE
#
"""Extends the Cheetah generator search list to add html historic data tables in a nice colour scheme.
Tested on Weewx release 4.0.0.
Works with all databases.
Observes the units of measure and display for... | [
"weewx.cheetahgenerator.SearchList.__init__",
"datetime.datetime.fromtimestamp",
"weewx.tags.TimespanBinder",
"time.time"
] | [((3517, 3553), 'weewx.cheetahgenerator.SearchList.__init__', 'SearchList.__init__', (['self', 'generator'], {}), '(self, generator)\n', (3536, 3553), False, 'from weewx.cheetahgenerator import SearchList\n'), ((5205, 5216), 'time.time', 'time.time', ([], {}), '()\n', (5214, 5216), False, 'import time\n'), ((5327, 5338... |
'''
Created on Mar 6, 2019
@author: hzhang0418
'''
from operator import itemgetter
'''
Combine given ranked lists into a single ranked list
'''
def combine_two_lists(first, second):
all_items = set(first+second)
first2score = {}
second2score = {}
# assign scores to items in first list
score... | [
"operator.itemgetter"
] | [((1177, 1193), 'operator.itemgetter', 'itemgetter', (['(3)', '(1)'], {}), '(3, 1)\n', (1187, 1193), False, 'from operator import itemgetter\n'), ((2149, 2162), 'operator.itemgetter', 'itemgetter', (['(1)'], {}), '(1)\n', (2159, 2162), False, 'from operator import itemgetter\n')] |
# coding=utf-8
# Copyright 2020 TF.Text 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"wordpiece_vocab.bert_vocab_from_dataset.bert_vocab_from_dataset",
"absl.testing.absltest.main",
"tensorflow.data.Dataset.from_tensor_slices"
] | [((1946, 1961), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (1959, 1961), False, 'from absl.testing import absltest\n'), ((1525, 1665), 'wordpiece_vocab.bert_vocab_from_dataset.bert_vocab_from_dataset', 'bert_vocab_from_dataset.bert_vocab_from_dataset', (['ds'], {'vocab_size': '(65)', 'reserved_tok... |
# Generated by Django 3.1.7 on 2021-04-26 11:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stock', '0002_auto_20210425_2306'),
]
operations = [
migrations.AlterField(
model_name='stock',
name='category',
... | [
"django.db.models.PositiveSmallIntegerField"
] | [((335, 436), 'django.db.models.PositiveSmallIntegerField', 'models.PositiveSmallIntegerField', ([], {'choices': "[(1, 'Category1'), (2, 'Category2'), (3, 'Category3')]"}), "(choices=[(1, 'Category1'), (2, 'Category2'\n ), (3, 'Category3')])\n", (367, 436), False, 'from django.db import migrations, models\n'), ((551... |
import sys
MONTHLY_CALENDER = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
DAYS = {1: "MON", 2: "TUE", 3: "WED", 4: "THU", 5: "FRI", 6: "SAT", 0: "SUN"}
def get_days(m, d):
days = 0
for i in range(m):
days += MONTHLY_CALENDER[i]
days += d
return DAYS[days % 7]
m, d = map(int, sys.st... | [
"sys.stdin.readline"
] | [((314, 334), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (332, 334), False, 'import sys\n')] |
""" get page content, check page is empty or redirect """
from tool.wiki import get_official_tool as get_tool
def main():
""" main func
compare last modify date for page en-zh
"""
# json demo : [{'pageid': 123, 'ns': 0, 'title': 'Asd/zh'}, ...]
wiki = get_tool()
en_pages = wiki.pages_lan... | [
"tool.wiki.get_official_tool"
] | [((279, 289), 'tool.wiki.get_official_tool', 'get_tool', ([], {}), '()\n', (287, 289), True, 'from tool.wiki import get_official_tool as get_tool\n')] |
__docformat__ = "reStructuredText"
import weakref
from weakref import WeakSet
import platform
import copy
from . import _chipmunk_cffi
cp = _chipmunk_cffi.lib
ffi = _chipmunk_cffi.ffi
from .vec2d import Vec2d
from .body import Body
from .collision_handler import CollisionHandler
from .query_info import Point... | [
"platform.system",
"copy.deepcopy",
"weakref.proxy"
] | [((11592, 11611), 'weakref.proxy', 'weakref.proxy', (['self'], {}), '(self)\n', (11605, 11611), False, 'import weakref\n'), ((11881, 11900), 'weakref.proxy', 'weakref.proxy', (['self'], {}), '(self)\n', (11894, 11900), False, 'import weakref\n'), ((31893, 31912), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self... |
from pathlib import Path
def main():
print(f"Hello world, this is {Path(__file__).name}")
| [
"pathlib.Path"
] | [((73, 87), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (77, 87), False, 'from pathlib import Path\n')] |
#!/usr/bin/python3
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | [
"subprocess.Popen",
"os.path.abspath",
"argparse.ArgumentParser",
"shutil.which",
"time.time",
"tarfile.open"
] | [((6378, 6573), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter', 'description': '"""Creates a webdataset index file for the use with the fn.readers.webdataset from DALI."""'}), "(formatter_class=argparse.\n ArgumentDefaultsHelpFormatter, descrip... |
##
# Contains the views QNTargetsAvailable and QNTargetsDetailView
##
from django.utils.decorators import method_decorator
from rest_framework import generics, serializers
from rest_framework.exceptions import NotFound
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from data_refinery_api... | [
"rest_framework.exceptions.NotFound",
"data_refinery_common.models.Organism.get_object_for_name",
"data_refinery_common.models.Organism.get_objects_with_qn_targets",
"data_refinery_api.views.relation_serializers.ComputationalResultNoFilesRelationSerializer",
"drf_yasg.openapi.Parameter",
"data_refinery_co... | [((605, 661), 'data_refinery_api.views.relation_serializers.ComputationalResultNoFilesRelationSerializer', 'ComputationalResultNoFilesRelationSerializer', ([], {'many': '(False)'}), '(many=False)\n', (649, 661), False, 'from data_refinery_api.views.relation_serializers import ComputationalResultNoFilesRelationSerialize... |
import os
from unittest import mock
import sys
from io import StringIO
from django.contrib.gis.geos.error import GEOSException
from django.core.management import call_command
from django.test import TestCase
from django.core.management.base import CommandError
from geotrek.core.factories import PathFactory
from geotr... | [
"geotrek.infrastructure.factories.InfrastructureFactory",
"io.StringIO",
"geotrek.authent.factories.StructureFactory.create",
"geotrek.infrastructure.models.Infrastructure.objects.all",
"os.path.dirname",
"geotrek.core.factories.PathFactory.create",
"unittest.mock.patch.dict",
"django.core.management.... | [((654, 674), 'geotrek.core.factories.PathFactory.create', 'PathFactory.create', ([], {}), '()\n', (672, 674), False, 'from geotrek.core.factories import PathFactory\n'), ((733, 743), 'io.StringIO', 'StringIO', ([], {}), '()\n', (741, 743), False, 'from io import StringIO\n'), ((764, 805), 'geotrek.authent.factories.St... |
# Copyright (c) 2018, <NAME>ATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | [
"hpccm.primitives.shell.shell",
"hpccm.building_blocks.packages.packages",
"distutils.version.StrictVersion",
"hpccm.primitives.comment.comment"
] | [((3925, 3939), 'hpccm.primitives.comment.comment', 'comment', (['"""pip"""'], {}), "('pip')\n", (3932, 3939), False, 'from hpccm.primitives.comment import comment\n'), ((3999, 4059), 'hpccm.building_blocks.packages.packages', 'packages', ([], {'apt': 'self.__debs', 'epel': 'self.__epel', 'yum': 'self.__rpms'}), '(apt=... |
"""
Deployment for Affiliates in production.
Requires commander (https://github.com/oremj/commander) which is installed on
the systems that need it.
"""
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from commander.deploy import task, hostgroups
import commander_settings as settin... | [
"commander.deploy.hostgroups",
"os.path.abspath",
"os.path.join"
] | [((1304, 1383), 'commander.deploy.hostgroups', 'hostgroups', (['settings.WEB_HOSTGROUP'], {'remote_kwargs': "{'ssh_key': settings.SSH_KEY}"}), "(settings.WEB_HOSTGROUP, remote_kwargs={'ssh_key': settings.SSH_KEY})\n", (1314, 1383), False, 'from commander.deploy import task, hostgroups\n'), ((1514, 1593), 'commander.dep... |
import numpy as np
from robot.robot_scenarios.collaborative_tasks import CollScenario
class Scenario(CollScenario):
def reset_world(self, world):
"""Overwrite collaborative scenario reset method and add task specific initial states"""
super().reset_world(world)
# add task specific initia... | [
"numpy.linalg.norm"
] | [((646, 719), 'numpy.linalg.norm', 'np.linalg.norm', (['(world.goals[0].state.p_pos - world.objects[0].state.p_pos)'], {}), '(world.goals[0].state.p_pos - world.objects[0].state.p_pos)\n', (660, 719), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Unit tests for the signal_processing module.
:copyright: Copyright 2014-2016 by the Elephant team, see `doc/authors.rst`.
:license: Modified BSD, see LICENSE.txt for details.
"""
from __future__ import division, print_function
import unittest
import neo
import numpy as np
import quantitie... | [
"numpy.abs",
"scipy.signal.welch",
"numpy.ma.testutils.assert_allclose",
"numpy.angle",
"numpy.ones",
"numpy.shape",
"numpy.sin",
"numpy.arange",
"numpy.mean",
"numpy.correlate",
"numpy.random.normal",
"numpy.exp",
"unittest.main",
"numpy.zeros_like",
"neo.AnalogSignal",
"numpy.ma.test... | [((51987, 52002), 'unittest.main', 'unittest.main', ([], {}), '()\n', (52000, 52002), False, 'import unittest\n'), ((722, 742), 'numpy.arange', 'np.arange', (['n_samples'], {}), '(n_samples)\n', (731, 742), True, 'import numpy as np\n'), ((1097, 1126), 'numpy.zeros', 'np.zeros', (['(self.n_samples, 3)'], {}), '((self.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.
# --------------------------------------------------------------------... | [
"uuid.uuid4",
"azure.storage.blob.BlobServiceClient.from_connection_string",
"cryptography.hazmat.primitives.hashes.SHA1",
"cryptography.hazmat.backends.default_backend",
"cryptography.hazmat.primitives.keywrap.aes_key_wrap",
"os.urandom",
"sys.exit",
"cryptography.hazmat.primitives.keywrap.aes_key_un... | [((11060, 11119), 'azure.storage.blob.BlobServiceClient.from_connection_string', 'BlobServiceClient.from_connection_string', (['CONNECTION_STRING'], {}), '(CONNECTION_STRING)\n', (11100, 11119), False, 'from azure.storage.blob import BlobServiceClient, BlobType, download_blob_from_url\n'), ((1627, 1641), 'os.urandom', ... |
# Copyright 2021 <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, softw... | [
"grpc_health.v1.health_pb2.HealthCheckResponse",
"structlog.processors.TimeStamper",
"os.environ.get",
"grpc_health.v1.health_pb2_grpc.add_HealthServicer_to_server",
"google.cloud.storage.Client",
"shakesapp_pb2_grpc.add_ShakespeareServiceServicer_to_server",
"shakesapp_pb2.ShakespeareResponse",
"stru... | [((1600, 1622), 'structlog.get_logger', 'structlog.get_logger', ([], {}), '()\n', (1620, 1622), False, 'import structlog\n'), ((3027, 3043), 'google.cloud.storage.Client', 'storage.Client', ([], {}), '()\n', (3041, 3043), False, 'from google.cloud import storage\n'), ((3184, 3225), 'concurrent.futures.ThreadPoolExecuto... |
# Mammalian Phenotype
import os
import re
try:
from cPickle import load, dump # < v3
except:
from pickle import load, dump # > v3
try:
from itertools import izip
except:
izip = zip
import pandas as PD
class MP(object):
roots = dict(mp='MP:0000001')
__no_ref_to_other_class__ = True
... | [
"os.path.dirname",
"os.path.exists",
"re.compile"
] | [((501, 521), 'os.path.dirname', 'os.path.dirname', (['obo'], {}), '(obo)\n', (516, 521), False, 'import os\n'), ((564, 585), 'os.path.exists', 'os.path.exists', (['pname'], {}), '(pname)\n', (578, 585), False, 'import os\n'), ((3397, 3414), 're.compile', 're.compile', (['regex'], {}), '(regex)\n', (3407, 3414), False,... |
#!/usr/bin/env python3
# vim: set fileencoding=utf8 :
import types
from contextlib import contextmanager
from tornado import gen
from tornado.concurrent import Future, is_future
import inflection
import python_jsonschema_objects as pjs
from tornado_jsonapi.exceptions import MissingResourceSchemaError
class Resource... | [
"tornado_jsonapi.exceptions.MissingResourceSchemaError",
"alchemyjsonschema.SchemaFactory",
"sqlalchemy.orm.scoped_session",
"alchemyjsonschema.dictify.jsonify",
"python_jsonschema_objects.ObjectBuilder",
"inflection.pluralize",
"dbapiext.execute_f",
"sqlalchemy.func.count",
"tornado.concurrent.is_f... | [((667, 697), 'python_jsonschema_objects.ObjectBuilder', 'pjs.ObjectBuilder', (['self.schema'], {}), '(self.schema)\n', (684, 697), True, 'import python_jsonschema_objects as pjs\n'), ((2836, 2879), 'sqlalchemy.orm.scoped_session', 'sqlalchemy.orm.scoped_session', (['sessionmaker'], {}), '(sessionmaker)\n', (2865, 2879... |
from jivago.lang.annotations import Inject
from jivago.wsgi.annotations import Resource
from jivago.wsgi.invocation.parameters import PathParam
from jivago.wsgi.methods import POST
from civbot.app.resource.civhook.civ_hook_model import CivHookStateModel
from civbot.app.service.game_state_notifier import GameStateNotif... | [
"jivago.wsgi.annotations.Resource"
] | [((327, 353), 'jivago.wsgi.annotations.Resource', 'Resource', (['"""/civ/{game_id}"""'], {}), "('/civ/{game_id}')\n", (335, 353), False, 'from jivago.wsgi.annotations import Resource\n')] |
# -*- coding: utf-8 -*-
#importing the required libraries
import cv2
import face_recognition
#capture the video from default camera
webcam_video_stream = cv2.VideoCapture(0)
#initialize the array variable to hold all face locations in the frame
all_face_locations = []
#loop through every frame in the... | [
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.rectangle",
"face_recognition.face_locations",
"cv2.destroyAllWindows",
"cv2.resize"
] | [((166, 185), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (182, 185), False, 'import cv2\n'), ((1844, 1867), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (1865, 1867), False, 'import cv2\n'), ((541, 592), 'cv2.resize', 'cv2.resize', (['current_frame', '(0, 0)'], {'fx': '(0.25)... |
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doctype('Expense Claim')
for data in frappe.db.sql(""" select name from `tabExpense Claim`
where (docstatus=1 and total_sancti... | [
"frappe.db.sql",
"frappe.reload_doctype",
"frappe.get_doc"
] | [((176, 214), 'frappe.reload_doctype', 'frappe.reload_doctype', (['"""Expense Claim"""'], {}), "('Expense Claim')\n", (197, 214), False, 'import frappe\n'), ((229, 466), 'frappe.db.sql', 'frappe.db.sql', (['""" select name from `tabExpense Claim`\n\t\twhere (docstatus=1 and total_sanctioned_amount=0 and status = \'Paid... |
# Network module used for all TCP networking aspects of the Gatecrasher script.
# Developed by <NAME>.
import socket
# Initializes socket with stream proto and binds to port arg.
def bind(port):
global s
host = ''
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((host, port))
def conne... | [
"socket.socket"
] | [((235, 284), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (248, 284), False, 'import socket\n'), ((367, 416), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (380, ... |
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
import unittest
from cfn_policy_validator.application_error import ApplicationError
from cfn_policy_validator.parsers.utils.node_evaluator import NodeEvaluator
from cfn_policy_validator.tests.parsers_tests import ... | [
"cfn_policy_validator.tests.utils.load_resources",
"cfn_policy_validator.tests.utils.load",
"cfn_policy_validator.tests.parsers_tests.mock_node_evaluator_setup",
"cfn_policy_validator.parsers.utils.node_evaluator.NodeEvaluator",
"cfn_policy_validator.tests.utils.expected_type_error"
] | [((521, 548), 'cfn_policy_validator.tests.parsers_tests.mock_node_evaluator_setup', 'mock_node_evaluator_setup', ([], {}), '()\n', (546, 548), False, 'from cfn_policy_validator.tests.parsers_tests import mock_node_evaluator_setup\n'), ((1763, 1790), 'cfn_policy_validator.tests.parsers_tests.mock_node_evaluator_setup', ... |
import re
import math
import json
import operator
from collections import Counter
import collections
import xml.etree.ElementTree as ET
import urllib.request
import urllib.parse
tree = ET.parse('workingDirectory/skos.rdf')
root = tree.getroot()
namespaces = {"skos": "http://www.w3.org/2004/02/skos/core#",
... | [
"xml.etree.ElementTree.parse"
] | [((186, 223), 'xml.etree.ElementTree.parse', 'ET.parse', (['"""workingDirectory/skos.rdf"""'], {}), "('workingDirectory/skos.rdf')\n", (194, 223), True, 'import xml.etree.ElementTree as ET\n')] |
#!/usr/bin/env python3
'''
Copyright (c) 2019-2020 ETH Zurich
Copyright (c) 2018 <NAME>
SPDX-License-Identifier: BSL-1.0
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
create_module_skeleton.py - A tool to generat... | [
"os.makedirs",
"os.getcwd",
"os.path.exists",
"os.path.join",
"sys.exit"
] | [((7010, 7021), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (7019, 7021), False, 'import sys, os\n'), ((599, 610), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (607, 610), False, 'import sys, os\n'), ((4839, 4906), 'os.path.join', 'os.path.join', (['lib_name', 'module_name', '"""include"""', '"""hpx"""', 'include_pa... |
# coding: utf-8
"""Parser/type converter for data in Interactive Brokers' Flex XML format.
https://www.interactivebrokers.com/en/software/reportguide/reportguide.htm
Flex report configuration needed by this module:
Date format: choose yyyy-MM-dd
Trades: uncheck "Symbol Summary", "Asset Class", "Orders"
"""
im... | [
"functools.partial",
"argparse.ArgumentParser",
"xml.etree.ElementTree.XML",
"datetime.datetime.strptime",
"ibflex.enums.Code",
"itertools.chain.from_iterable",
"xml.etree.ElementTree.ElementTree"
] | [((1291, 1307), 'xml.etree.ElementTree.ElementTree', 'ET.ElementTree', ([], {}), '()\n', (1305, 1307), True, 'import xml.etree.ElementTree as ET\n'), ((17226, 17315), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Quick test of Interactive Brokers Flex XML data parser"""'}), "(description=\n '... |
from django.contrib.auth import get_user_model
from django.utils.translation import gettext as _
from rest_framework.response import Response
from rest_framework.views import APIView
from constents import SIGN_UP_KEY
from modules.conf.models import Conf
from utils.authenticators import SessionAuthenticate
from utils.e... | [
"django.utils.translation.gettext",
"utils.exceptions.UserNotExist",
"django.contrib.auth.get_user_model",
"modules.conf.models.Conf.objects.get",
"rest_framework.response.Response",
"utils.exceptions.SMSSendFailed"
] | [((411, 427), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (425, 427), False, 'from django.contrib.auth import get_user_model\n'), ((974, 984), 'rest_framework.response.Response', 'Response', ([], {}), '()\n', (982, 984), False, 'from rest_framework.response import Response\n'), ((1705, 171... |
# Gunicorn entrypoint file For the base image, see this project:
# https://github.com/matthieugouel/docker-python-gunicorn-nginx
from app.app import create_app
app = create_app()
| [
"app.app.create_app"
] | [((168, 180), 'app.app.create_app', 'create_app', ([], {}), '()\n', (178, 180), False, 'from app.app import create_app\n')] |
################################################################################
# Copyright (c) 2021 ContinualAI. #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. ... | [
"pathlib.Path",
"torchvision.transforms.functional.to_tensor",
"torch.utils.tensorboard.SummaryWriter"
] | [((4104, 4120), 'pathlib.Path', 'Path', (['tb_log_dir'], {}), '(tb_log_dir)\n', (4108, 4120), False, 'from pathlib import Path\n'), ((2626, 2684), 'torch.utils.tensorboard.SummaryWriter', 'SummaryWriter', (['tb_log_dir'], {'filename_suffix': 'filename_suffix'}), '(tb_log_dir, filename_suffix=filename_suffix)\n', (2639,... |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"logging.exception",
"flask.Flask",
"os.path.dirname",
"flask.render_template"
] | [((952, 967), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (957, 967), False, 'from flask import Flask, render_template, request\n'), ((1047, 1075), 'flask.render_template', 'render_template', (['"""form.html"""'], {}), "('form.html')\n", (1062, 1075), False, 'from flask import Flask, render_template, re... |
#!/usr/bin/env python3
# Author: <NAME>
#This script will create either cluster features or antibody features json for use in Features R script.
#I am just really sick of doing this by hand.
#Example Cmd-line: python create_features_json.py --database databases/baseline_comparison.txt --scripts cluster
from jade2.r... | [
"argparse.ArgumentParser"
] | [((429, 689), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""This script will create either cluster features or antibody features json for use in Features R script.\nExample Cmd-line: python create_features_json.py --database databases/baseline_comparison.txt --scripts cluster"""'}), '(descripti... |
import os
import sys
def real_path(relative_path):
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, os.path.join(ASSETS_DIR, relative_path))
return os.path.join(ASSETS_DIR, relative_path)
def get_parent_dir(path):
return path.rpartition("\\")[0]
def font_path(filename):
return r... | [
"os.path.dirname",
"os.path.join"
] | [((470, 501), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""debug"""'], {}), "(DATA_DIR, 'debug')\n", (482, 501), False, 'import os\n'), ((514, 547), 'os.path.join', 'os.path.join', (['ASSETS_DIR', '"""fonts"""'], {}), "(ASSETS_DIR, 'fonts')\n", (526, 547), False, 'import os\n'), ((179, 218), 'os.path.join', 'os.pa... |
"""
Approximate the square root of non-zero positive integer ``c``.
Use Newton-Raphson method: ``t' = ((c/t) +t) / 2.0``.
The result ``t`` should be precise up to ``eps``: ``abs(t*t -c) < eps``.
"""
from icontract import require, ensure
# ERROR: Missed an edge case.
#
# icontract.errors.ViolationError:
# abs(result... | [
"icontract.require"
] | [((487, 511), 'icontract.require', 'require', (['(lambda c: c > 0)'], {}), '(lambda c: c > 0)\n', (494, 511), False, 'from icontract import require, ensure\n')] |
import os
from pathlib import Path
import numpy as np
import torch
from tqdm import tqdm
from tfrecord.tools.tfrecord2idx import create_index
from tfrecord.torch.dataset import TFRecordDataset
from vp_suite.base.base_dataset import VPDataset, VPData
import vp_suite.constants as constants
class BAIRPushingDataset(VPD... | [
"tfrecord.torch.dataset.TFRecordDataset",
"os.remove",
"tqdm.tqdm",
"numpy.load",
"tfrecord.tools.tfrecord2idx.create_index",
"numpy.concatenate",
"numpy.save",
"os.path.exists",
"os.path.isfile",
"pathlib.Path",
"tarfile.open",
"os.path.join",
"os.listdir",
"vp_suite.utils.utils.download_... | [((3938, 3960), 'tarfile.open', 'tarfile.open', (['tar_path'], {}), '(tar_path)\n', (3950, 3960), False, 'import tarfile\n'), ((4008, 4027), 'os.remove', 'os.remove', (['tar_path'], {}), '(tar_path)\n', (4017, 4027), False, 'import os\n'), ((4630, 4646), 'tqdm.tqdm', 'tqdm', (['data_files'], {}), '(data_files)\n', (463... |
import os
import sys
import glob
import re
import nltk
import string
# nltk.download('punkt')
# nltk.download('stopwords')
import codecs
import matplotlib.pyplot as plt
from collections import defaultdict
import pandas as pd
from sklearn.model_selection import train_test_split
from nltk.stem.snowball import French... | [
"argparse.ArgumentParser",
"pandas.DataFrame.from_dict",
"codecs.open",
"nltk.stem.snowball.FrenchStemmer",
"os.path.basename",
"os.path.exists",
"spacy.load",
"os.path.splitext",
"spacy.pipeline.Tagger",
"collections.OrderedDict"
] | [((471, 486), 'nltk.stem.snowball.FrenchStemmer', 'FrenchStemmer', ([], {}), '()\n', (484, 486), False, 'from nltk.stem.snowball import FrenchStemmer\n'), ((2493, 2532), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""""""'}), "(description='')\n", (2516, 2532), False, 'import argparse\n')... |
import fiftyone.zoo as foz
import what.utils.logger as log
import torch
from torch.utils.data import DataLoader
from what.models.detection.datasets.fiftyone import FiftyOneDataset
from what.models.detection.datasets.voc import VOCDataset
from what.models.detection.ssd.ssd.ssd import MatchPrior
from what.models.detec... | [
"what.models.detection.ssd.ssd.ssd.MatchPrior",
"torch.utils.data.DataLoader",
"fiftyone.zoo.load_zoo_dataset",
"what.models.detection.ssd.mobilenet_v2_ssd_lite.MobileNetV2SSDLite",
"what.models.detection.ssd.ssd.preprocessing.TestTransform",
"torch.cuda.is_available",
"fiftyone.zoo.load_zoo_dataset_inf... | [((607, 632), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (630, 632), False, 'import torch\n'), ((686, 710), 'what.utils.logger.get_logger', 'log.get_logger', (['__name__'], {}), '(__name__)\n', (700, 710), True, 'import what.utils.logger as log\n'), ((1028, 1101), 'what.models.detection.ssd... |
import requests
def getUrl(timeframe, exchange, type):
# Response with Section = "last"
# [
# MTS,
# OPEN,
# CLOSE,
# HIGH,
# LOW,
# VOLUME
# ]
# Response with Section = "hist"
# [
# [ MTS, OPEN, CLOSE, HIGH, LOW, VOLUME ],
# ...
# ]
... | [
"requests.get"
] | [((629, 661), 'requests.get', 'requests.get', (['url'], {'params': 'params'}), '(url, params=params)\n', (641, 661), False, 'import requests\n')] |
from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7
import KratosMultiphysics
def GetDefaultInputParameters():
default_settings = KratosMultiphysics.Parameters("""
{
"do_print_results_option" : true,
... | [
"KratosMultiphysics.Parameters"
] | [((221, 9074), 'KratosMultiphysics.Parameters', 'KratosMultiphysics.Parameters', (['"""\n {\n "do_print_results_option" : true,\n "WriteMdpaFromResults" : false,\n "Dimension" : 3,\n "PeriodicDomainOption" : false... |
from collections import Counter
def points(dice):
if len(set(dice))==1:
return 50
check=Counter(dice)
for i,j in check.items():
if j==4:
return 40
elif j==3:
return 0 if len(check)==3 else 30
for i in [12345, 23456, 34561, 13654, 62534]:
if Counter... | [
"collections.Counter"
] | [((104, 117), 'collections.Counter', 'Counter', (['dice'], {}), '(dice)\n', (111, 117), False, 'from collections import Counter\n')] |
import random
import itertools
class KeagenSimulator():
def __init__(self):
self.Pairs = ['A', 'C', 'T', 'G']
self.Codons = itertools.product(self.Pairs, repeat=3)
self.all_codons = ["".join(codon) for codon in self.Codons]
self.start = "ATG"
self.stop = ("TAA", "TAG", "TGA"... | [
"random.choices",
"random.choice",
"random.randint",
"itertools.product"
] | [((145, 184), 'itertools.product', 'itertools.product', (['self.Pairs'], {'repeat': '(3)'}), '(self.Pairs, repeat=3)\n', (162, 184), False, 'import itertools\n'), ((879, 914), 'random.choices', 'random.choices', (['lno_stops'], {'k': 'length'}), '(lno_stops, k=length)\n', (893, 914), False, 'import random\n'), ((942, 9... |
import numpy as np
import pandas as pd
from matplotlib.ticker import AutoMinorLocator
def str2float(s, string_to_val):
try:
val = string_to_val[s]
except:
val = float(s)
return val
class Curve():
def __init__(self, directory,
string_to_val,
label,
... | [
"pandas.read_csv",
"numpy.median",
"numpy.asarray",
"matplotlib.ticker.AutoMinorLocator",
"numpy.array",
"numpy.arange",
"numpy.add.accumulate"
] | [((7520, 7562), 'pandas.read_csv', 'pd.read_csv', (['file_path'], {'sep': 'self.separator'}), '(file_path, sep=self.separator)\n', (7531, 7562), True, 'import pandas as pd\n'), ((3041, 3057), 'numpy.array', 'np.array', (['x_read'], {}), '(x_read)\n', (3049, 3057), True, 'import numpy as np\n'), ((3090, 3106), 'numpy.ar... |
# bb_convert_to_csv.py
#
# IN: year/month - target match time period
# OUT: CSV files for target match time period
#
# (1) read each JSON files.
# (2) load JSON data structure.
# (3) reconstruct as string list.
# (4) dump to the CSV file.
import os
import json
import sys
import csv
from logManager import getTracebackS... | [
"os.listdir",
"os.mkdir",
"os.path.isdir",
"os.getcwd",
"os.path.getsize",
"os.path.isfile",
"logManager.getTracebackStr",
"os.chdir",
"csv.DictWriter"
] | [((1742, 1847), 'csv.DictWriter', 'csv.DictWriter', (['csv_file'], {'delimiter': '""","""', 'dialect': '"""excel"""', 'fieldnames': 'fieldNames', 'lineterminator': '"""\n"""'}), "(csv_file, delimiter=',', dialect='excel', fieldnames=\n fieldNames, lineterminator='\\n')\n", (1756, 1847), False, 'import csv\n'), ((632... |
import sys
sys.path.append("../../")
from appJar import gui
current = 0
def up():
global current
current = 1 if current > 4 else current + 1
app.raiseFrame(str(current))
with gui() as app:
with app.frame("1", bg='red', row=0, column=0):
app.label("1")
for x in range(10): app.radio("A"... | [
"sys.path.append",
"appJar.gui"
] | [((11, 36), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (26, 36), False, 'import sys\n'), ((190, 195), 'appJar.gui', 'gui', ([], {}), '()\n', (193, 195), False, 'from appJar import gui\n')] |
######################################################################
#
# File: b2sdk/raw_simulator.py
#
# Copyright 2021 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
from typing import Optional
im... | [
"io.BytesIO",
"random.randint",
"random.Random",
"re.match",
"time.time",
"collections.defaultdict",
"requests.structures.CaseInsensitiveDict",
"collections.namedtuple",
"logging.getLogger",
"re.compile"
] | [((1399, 1426), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1416, 1426), False, 'import logging\n'), ((16056, 16108), 'collections.namedtuple', 'collections.namedtuple', (['"""FakeRequest"""', '"""url headers"""'], {}), "('FakeRequest', 'url headers')\n", (16078, 16108), False, 'impor... |
import datetime
from dateutil.relativedelta import relativedelta
import pandas as pd
"""
Contains various functions that are typically to do with date
calculations or formatting date results. It also contains a routine
that helps combine all the file paths where an x509 certificate may
appear.
"""
def calculate_dat... | [
"pandas.DataFrame",
"datetime.datetime.now",
"dateutil.relativedelta.relativedelta",
"datetime.timedelta"
] | [((696, 719), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (717, 719), False, 'import datetime\n'), ((1615, 1637), 'pandas.DataFrame', 'pd.DataFrame', (['week_lst'], {}), '(week_lst)\n', (1627, 1637), True, 'import pandas as pd\n'), ((2024, 2046), 'pandas.DataFrame', 'pd.DataFrame', (['week_lst']... |
from typing import List
from pdfmajor.utils import mult_matrix, isnumber, apply_matrix_pt, translate_matrix
from pdfmajor.utils import Bbox
from ..PDFTextState import PDFTextState
from ..PDFGraphicState import PDFGraphicState, PDFColorSpace
from ._base import PDFItem
class Char:
def __init__(self, char: str, bb... | [
"pdfmajor.utils.isnumber",
"pdfmajor.utils.translate_matrix",
"pdfmajor.utils.Bbox.from_points",
"pdfmajor.utils.mult_matrix",
"pdfmajor.utils.apply_matrix_pt"
] | [((875, 909), 'pdfmajor.utils.mult_matrix', 'mult_matrix', (['textstate.matrix', 'ctm'], {}), '(textstate.matrix, ctm)\n', (886, 909), False, 'from pdfmajor.utils import mult_matrix, isnumber, apply_matrix_pt, translate_matrix\n'), ((3990, 4018), 'pdfmajor.utils.apply_matrix_pt', 'apply_matrix_pt', (['matrix', 'bll'], ... |
from math import ceil
import json
import argparse
# TODO: LAYER1_K, STAGE2L_K, STAGE2R_K, STAGE2L_OFFSET, STAGE2R_OFFSET
# Array layout:
# cin[IN_NUM_HW / IN_NUM_T][H_HW][W_HW][IN_NUM_T]
# w[OUT_NUM_HW][IN_NUM_HW / IN_NUM_T][K][K][IN_NUM_T]
# bias[OUT_NUM_HW]
# cout[OUT_NUM_HW / OUT_NUM_T][H_HW][W_HW][OUT_NUM_T]
# M... | [
"argparse.ArgumentParser"
] | [((62705, 62764), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Data reorganization."""'}), "(description='Data reorganization.')\n", (62728, 62764), False, 'import argparse\n')] |
from markdownify import markdownify as md
def test_nested():
text = md('<p>This is an <a href="http://example.com/">example link</a>.</p>')
assert text == 'This is an [example link](http://example.com/).\n\n'
| [
"markdownify.markdownify"
] | [((74, 145), 'markdownify.markdownify', 'md', (['"""<p>This is an <a href="http://example.com/">example link</a>.</p>"""'], {}), '(\'<p>This is an <a href="http://example.com/">example link</a>.</p>\')\n', (76, 145), True, 'from markdownify import markdownify as md\n')] |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | [
"requests.Session",
"tensorflow.python.lib.io.file_io.FileIO",
"pathlib.Path",
"pickle.load",
"numpy.array",
"gzip.GzipFile"
] | [((1549, 1567), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1565, 1567), False, 'import requests\n'), ((794, 824), 'tensorflow.python.lib.io.file_io.FileIO', 'gcsfile.FileIO', (['filename', '"""rb"""'], {}), "(filename, 'rb')\n", (808, 824), True, 'from tensorflow.python.lib.io import file_io as gcsfile\... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'dialogs/preferences.ui'
#
# Created: Tue Jan 17 03:54:45 2012
# by: PyQt4 UI code generator 4.8.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
ex... | [
"PyQt4.QtGui.QWidget",
"PyQt4.QtGui.QLabel",
"PyQt4.QtGui.QIcon",
"PyQt4.QtGui.QVBoxLayout",
"PyQt4.QtGui.QSizePolicy",
"PyQt4.QtGui.QDialogButtonBox",
"PyQt4.QtGui.QApplication.translate",
"PyQt4.QtGui.QSlider",
"PyQt4.QtGui.QTableWidget",
"PyQt4.QtGui.QFormLayout",
"PyQt4.QtGui.QAction",
"Py... | [((554, 629), 'PyQt4.QtGui.QSizePolicy', 'QtGui.QSizePolicy', (['QtGui.QSizePolicy.Preferred', 'QtGui.QSizePolicy.Preferred'], {}), '(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)\n', (571, 629), False, 'from PyQt4 import QtCore, QtGui\n'), ((1006, 1036), 'PyQt4.QtGui.QVBoxLayout', 'QtGui.QVBoxLayout', (['P... |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | [
"heat.common.config.get_ssl_options",
"oslo_utils.importutils.import_module",
"keystoneauth1.discover.Discover"
] | [((1137, 1214), 'keystoneauth1.discover.Discover', 'ks_discover.Discover', ([], {'session': 'session', 'url': 'cfg.CONF.clients_keystone.auth_uri'}), '(session=session, url=cfg.CONF.clients_keystone.auth_uri)\n', (1157, 1214), True, 'from keystoneauth1 import discover as ks_discover\n'), ((1368, 1426), 'oslo_utils.impo... |
import pytest
import test_db.models as models
ROOTNAME = 'whatever'
@pytest.fixture
def data(sync):
root = models.OddKeysRoot(name=ROOTNAME).save(sync)
models.OddKeysNode(oddkeysroot=root, name=models.NODE1).save(sync)
models.OddKeysNode(oddkeysroot=root, name=models.NODE2).save(sync)
def test_simple... | [
"test_db.models.OddKeysRoot",
"test_db.models.OddKeysRoot.list",
"test_db.models.OddKeysRoot.load",
"test_db.models.OddKeysNode.list",
"test_db.models.OddKeysRoot.query.execute",
"test_db.models.OddKeysNode",
"test_db.models.OddKeysNode.query.execute"
] | [((513, 542), 'test_db.models.OddKeysNode.list', 'models.OddKeysNode.list', (['sync'], {}), '(sync)\n', (536, 542), True, 'import test_db.models as models\n'), ((743, 785), 'test_db.models.OddKeysRoot.load', 'models.OddKeysRoot.load', (['sync', 'root.my_key'], {}), '(sync, root.my_key)\n', (766, 785), True, 'import tes... |
# https://zhuanlan.zhihu.com/p/33593039
# finding the max prior to the current item
a = [3, 4, 6, 2, 1, 9, 0, 7, 5, 8]
results = []
current_max = 0
for i in a:
current_max = max(i, current_max)
results.append(current_max)
print(results) # results = [3, 4, 6, 6, 6, 9, 9, 9, 9, 9]
# =========================... | [
"itertools.accumulate"
] | [((877, 895), 'itertools.accumulate', 'accumulate', (['a', 'max'], {}), '(a, max)\n', (887, 895), False, 'from itertools import accumulate\n')] |
"""
Implementation for Advent of Code Day 20.
https://adventofcode.com/2018/day/20
"""
from __future__ import print_function
from collections import defaultdict, deque
from operator import itemgetter
from sys import maxsize
class TreeNode:
"""Represents a single node in the Regex tree."""
def __init__(sel... | [
"collections.defaultdict",
"sys.exit",
"operator.itemgetter",
"collections.deque"
] | [((4552, 4559), 'collections.deque', 'deque', ([], {}), '()\n', (4557, 4559), False, 'from collections import defaultdict, deque\n'), ((4583, 4612), 'collections.defaultdict', 'defaultdict', (['(lambda : maxsize)'], {}), '(lambda : maxsize)\n', (4594, 4612), False, 'from collections import defaultdict, deque\n'), ((463... |
'''
main.py
Created by <NAME> on 2020
Copyright © 2020 <NAME>. All rights reserved.
'''
import sys
t = int(sys.stdin.readline())
output = []
for _ in range(t):
p = str(sys.stdin.readline())
n = int(sys.stdin.readline())
pre_arr = str(sys.stdin.readline().rstrip())
arr = []
temp =... | [
"sys.stdin.readline"
] | [((126, 146), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (144, 146), False, 'import sys\n'), ((192, 212), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (210, 212), False, 'import sys\n'), ((226, 246), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (244, 246), False, 'im... |
from setuptools import setup
from os import path
here = path.abspath(path.dirname(__file__))
setup(
name='ThreatPlaybook-Client',
version='3.0.8',
packages=['playbook'],
entry_points={
'console_scripts': [
'playbook = playbook:main'
]
},
url='https://we45.github.io/... | [
"os.path.dirname",
"setuptools.setup"
] | [((95, 604), 'setuptools.setup', 'setup', ([], {'name': '"""ThreatPlaybook-Client"""', 'version': '"""3.0.8"""', 'packages': "['playbook']", 'entry_points': "{'console_scripts': ['playbook = playbook:main']}", 'url': '"""https://we45.github.io/threatplaybook/"""', 'license': '"""MIT License"""', 'author': '"""we45"""',... |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015-2020 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publishe... | [
"datetime.datetime.strptime",
"backtrader.Cerebro",
"argparse.ArgumentParser",
"backtrader.num2date"
] | [((2396, 2408), 'backtrader.Cerebro', 'bt.Cerebro', ([], {}), '()\n', (2406, 2408), True, 'import backtrader as bt\n'), ((3513, 3657), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter', 'description': '"""Sample for Close Orders with daily data"""'})... |
from geometry_python.geom2d import point
l = list(map(lambda i: point.Point(i, i*i), range(-5, 6)))
l2 = list(filter(lambda p: p.x % 2 == 0, l))
print(l)
print(l2) | [
"geometry_python.geom2d.point.Point"
] | [((66, 87), 'geometry_python.geom2d.point.Point', 'point.Point', (['i', '(i * i)'], {}), '(i, i * i)\n', (77, 87), False, 'from geometry_python.geom2d import point\n')] |
# coding=utf-8
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Related proposals."""
from lib import base
from lib.entities import entity
from lib.utils import date_utils
class RelatedProposals(base.WithBrowser):
"""Related proposals."""
def are_... | [
"lib.utils.date_utils.ui_str_with_zone_to_datetime"
] | [((2530, 2583), 'lib.utils.date_utils.ui_str_with_zone_to_datetime', 'date_utils.ui_str_with_zone_to_datetime', (['datetime_str'], {}), '(datetime_str)\n', (2569, 2583), False, 'from lib.utils import date_utils\n')] |
#!/usr/bin/env python
import signac
project = signac.init_project("Optimization")
for seed in (0,):
for func in (
"(x - 1.0)**2", # solution: x = 1.0
"(x - 2.0)**3", # solution: x = 2.0
"sqrt(x) - sqrt(3.0)", # solution: x = 3.0
):
job = project.open_job({"func": func, "x0":... | [
"signac.init_project"
] | [((47, 82), 'signac.init_project', 'signac.init_project', (['"""Optimization"""'], {}), "('Optimization')\n", (66, 82), False, 'import signac\n')] |
from algorithm.Algorithm import Algorithm
class PowerSetExponential(Algorithm):
def __init__(self, test_data=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']):
Algorithm.__init__(self)
self._test_data = test_data[:]
@staticmethod
def get_str_binary_representation(n, number_of_digits):
... | [
"algorithm.Algorithm.Algorithm.__init__"
] | [((176, 200), 'algorithm.Algorithm.Algorithm.__init__', 'Algorithm.__init__', (['self'], {}), '(self)\n', (194, 200), False, 'from algorithm.Algorithm import Algorithm\n')] |
#!/usr/bin/python
"""
(C) Copyright 2018-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
import os
import threading
from ClusterShell.NodeSet import NodeSet
from dfuse_test_base import DfuseTestBase
from ior_utils import IorCommand
from command_utils_base import CommandFailure
from job_manag... | [
"threading.Thread",
"ior_utils.IorCommand",
"ior_utils.IorCommand.get_ior_metrics",
"general_utils.pcmd",
"daos_utils.DaosCommand",
"mpio_utils.MpioUtils",
"os.path.join",
"job_manager_utils.Mpirun"
] | [((1296, 1308), 'ior_utils.IorCommand', 'IorCommand', ([], {}), '()\n', (1306, 1308), False, 'from ior_utils import IorCommand\n'), ((12185, 12197), 'ior_utils.IorCommand', 'IorCommand', ([], {}), '()\n', (12195, 12197), False, 'from ior_utils import IorCommand\n'), ((12412, 12424), 'ior_utils.IorCommand', 'IorCommand'... |
#!/usr/bin/env python3
# CONFFILE=/home/pi/ticc_avrdude.conf
# avrdude -C$CONFFILE -v -patmega2560 -cwiring \
# -P/dev/ttyTICC0 -b115200 -D -Uflash:w:$1:i
import sys
import subprocess
import shlex
import gpiozero
import time
pin21 = gpiozero.OutputDevice(21)
conffile = '/home/pi/ticc_avrdude.conf'
hexfile = s... | [
"shlex.split",
"gpiozero.OutputDevice",
"time.sleep"
] | [((243, 268), 'gpiozero.OutputDevice', 'gpiozero.OutputDevice', (['(21)'], {}), '(21)\n', (264, 268), False, 'import gpiozero\n'), ((568, 584), 'time.sleep', 'time.sleep', (['(0.01)'], {}), '(0.01)\n', (578, 584), False, 'import time\n'), ((620, 636), 'shlex.split', 'shlex.split', (['cmd'], {}), '(cmd)\n', (631, 636), ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.