code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from sage.misc.lazy_import import lazy_import
lazy_import('sage.geometry.polyhedron.constructor', 'Polyhedron')
lazy_import('sage.geometry.polyhedron.library', 'polytopes')
| [
"sage.misc.lazy_import.lazy_import"
] | [((47, 112), 'sage.misc.lazy_import.lazy_import', 'lazy_import', (['"""sage.geometry.polyhedron.constructor"""', '"""Polyhedron"""'], {}), "('sage.geometry.polyhedron.constructor', 'Polyhedron')\n", (58, 112), False, 'from sage.misc.lazy_import import lazy_import\n'), ((113, 173), 'sage.misc.lazy_import.lazy_import', '... |
from Position import Position
from Sheep import Sheep
from Grass import Grass
if __name__ == '__main__':
grass = Grass(position=Position(10, 10))
sheep = Sheep(position=Position(-10, -10))
for i in range(0,10):
print('-- Iteration {0} --'.format(i))
grass.move()
print(grass)
... | [
"Position.Position"
] | [((133, 149), 'Position.Position', 'Position', (['(10)', '(10)'], {}), '(10, 10)\n', (141, 149), False, 'from Position import Position\n'), ((178, 196), 'Position.Position', 'Position', (['(-10)', '(-10)'], {}), '(-10, -10)\n', (186, 196), False, 'from Position import Position\n')] |
from django.views.generic import ListView, DetailView
from django.shortcuts import render, get_object_or_404
from analytics.mixins import ObjectViewedMixin
from carts.models import Cart
from .models import Product
from django.http import Http404
class ProductFeaturedListView(ListView):
template_name = "product... | [
"django.shortcuts.render",
"carts.models.Cart.objects.new_or_get",
"django.http.Http404"
] | [((1116, 1162), 'django.shortcuts.render', 'render', (['request', '"""products/list.html"""', 'context'], {}), "(request, 'products/list.html', context)\n", (1122, 1162), False, 'from django.shortcuts import render, get_object_or_404\n'), ((2888, 2936), 'django.shortcuts.render', 'render', (['request', '"""products/det... |
import sys
if sys.version_info < (3, 0):
from nose.plugins.skip import SkipTest
raise SkipTest
from mlxtend.text import generalize_names
def test_generalize_names():
assert(generalize_names("<NAME>") == 'etoo s')
assert(generalize_names("Eto'o, Samuel") == 'etoo s')
assert(generalize_names("Eto... | [
"mlxtend.text.generalize_names"
] | [((190, 216), 'mlxtend.text.generalize_names', 'generalize_names', (['"""<NAME>"""'], {}), "('<NAME>')\n", (206, 216), False, 'from mlxtend.text import generalize_names\n'), ((241, 274), 'mlxtend.text.generalize_names', 'generalize_names', (['"""Eto\'o, Samuel"""'], {}), '("Eto\'o, Samuel")\n', (257, 274), False, 'from... |
from nanoget import get_input
from argparse import ArgumentParser
from nanoplot import utils
from .version import __version__
from nanoplotter import check_valid_time_and_sort, Plot
from os import path
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
def main():
args = get_args()
merge... | [
"argparse.ArgumentParser",
"matplotlib.pyplot.close",
"nanoplotter.Plot",
"nanoplotter.check_valid_time_and_sort",
"numpy.log10",
"nanoget.get_input",
"os.path.join"
] | [((1081, 1229), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Get detection curve of nanopore experiment."""', 'epilog': 'epilog', 'formatter_class': 'utils.custom_formatter', 'add_help': '(False)'}), "(description='Get detection curve of nanopore experiment.',\n epilog=epilog, formatter_clas... |
# -*- coding:utf-8 -*-
import ymz294
import mml
import time
class Sequencer:
# initialize.
# @param psgplayer ymz294.PSGPlayer instance
def __init__(self, psgplayer):
self.psgplayer = psgplayer
# play sound by MML string
# @param chA_MML a MML string for PSG channel A
# @param chB... | [
"mml.Parser",
"time.sleep"
] | [((549, 570), 'mml.Parser', 'mml.Parser', (['core_freq'], {}), '(core_freq)\n', (559, 570), False, 'import mml\n'), ((2331, 2347), 'time.sleep', 'time.sleep', (['wait'], {}), '(wait)\n', (2341, 2347), False, 'import time\n')] |
import random
import arcade
from ant import Ant
from colony import Colony
# TODO
# - Food blobs 2x zo groot
# - Food blobs droppen met muis
# - Food blob coo is altijd centrale coo
# - Lijn tekenen bij backtrack
from settings import settings
class Arena(arcade.Window):
def __init__(self, width, height, title, ge... | [
"ant.Ant",
"random.randint",
"arcade.run",
"arcade.SpriteSolidColor",
"settings.settings.WALL_MIN",
"arcade.start_render",
"settings.settings.WALL_MAX",
"random.random",
"arcade.check_for_collision_with_list",
"arcade.set_background_color",
"settings.settings.WALL_THICKNESS",
"arcade.SpriteLis... | [((6368, 6380), 'arcade.run', 'arcade.run', ([], {}), '()\n', (6378, 6380), False, 'import arcade\n'), ((418, 474), 'arcade.SpriteList', 'arcade.SpriteList', ([], {'is_static': '(True)', 'use_spatial_hash': '(True)'}), '(is_static=True, use_spatial_hash=True)\n', (435, 474), False, 'import arcade\n'), ((500, 556), 'arc... |
import tkinter
from tkinter import messagebox
from tkinter import Button
window = tkinter.Tk()
HEIGHT = window.winfo_height()
WIDTH = window.winfo_width()
print(f'Height: {HEIGHT}, Width: {WIDTH}')
def click_button():
msg = messagebox.showinfo("Hello!", "You clicked a button!")
# initializing button
button_widg... | [
"tkinter.Button",
"tkinter.messagebox.showinfo",
"tkinter.Tk"
] | [((83, 95), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (93, 95), False, 'import tkinter\n'), ((325, 379), 'tkinter.Button', 'Button', (['window'], {'text': '"""Click me!"""', 'command': 'click_button'}), "(window, text='Click me!', command=click_button)\n", (331, 379), False, 'from tkinter import Button\n'), ((231, ... |
import numpy as np
import matplotlib.pyplot as plt
from IPython.core.debugger import set_trace
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import glob
import os
from skimage.io import imread
from skimage.transform import resize
from torch.utils import data
import os... | [
"numpy.stack",
"utils.rotate_fcns.rotate_2d",
"pandas.read_csv",
"pandas.ExcelFile",
"numpy.zeros",
"pandas.read_excel",
"numpy.array",
"utils.rotate_fcns.flip_2d",
"torch.from_numpy"
] | [((599, 639), 'pandas.read_csv', 'pd.read_csv', (['"""utils/rot_dict_unique.csv"""'], {}), "('utils/rot_dict_unique.csv')\n", (610, 639), True, 'import pandas as pd\n'), ((717, 769), 'pandas.ExcelFile', 'pd.ExcelFile', (["(self.path + os.sep + 'ListOfData.xlsx')"], {}), "(self.path + os.sep + 'ListOfData.xlsx')\n", (72... |
#!/usr/bin/env python3
from aws_cdk import (core as cdk)
from core.monorepo_stack import MonorepoStack
from core.pipelines_stack import PipelineStack
app = cdk.App()
core = MonorepoStack(app, "MonoRepoStack")
PipelineStack(app, "PipelinesStack", core.exported_monorepo)
app.synth()
| [
"aws_cdk.core.App",
"core.monorepo_stack.MonorepoStack",
"core.pipelines_stack.PipelineStack"
] | [((158, 167), 'aws_cdk.core.App', 'cdk.App', ([], {}), '()\n', (165, 167), True, 'from aws_cdk import core as cdk\n'), ((175, 210), 'core.monorepo_stack.MonorepoStack', 'MonorepoStack', (['app', '"""MonoRepoStack"""'], {}), "(app, 'MonoRepoStack')\n", (188, 210), False, 'from core.monorepo_stack import MonorepoStack\n'... |
import datetime
import uuid
from django.contrib.auth import get_user_model
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from taggit.managers import TaggableManager
from taggit.models import GenericUUIDTaggedItemBa... | [
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.ForeignKey",
"django.utils.timezone.now",
"django.contrib.auth.get_user_model",
"django.db.models.Manager",
"django.db.models.SlugField",
"django.urls.reverse",
"django.db.models.IntegerField",
"taggit.managers.Tagga... | [((786, 856), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(True)', 'default': 'uuid.uuid4', 'editable': '(False)'}), '(primary_key=True, default=uuid.uuid4, editable=False)\n', (802, 856), False, 'from django.db import models\n'), ((877, 909), 'django.db.models.CharField', 'models.CharField'... |
import RPi.GPIO as GPIO
class Pin:
def __init__(self, pin_id):
self.pin_id = pin_id
self.state = Off
GPIO.setmode(GPIO.BCM)
def sense(self):
GPIO.setup(self.pin_id, GPIO.IN)
output = GPIO.input(self.pin_id)
self.state = output
return output
def set... | [
"RPi.GPIO.setmode",
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.input",
"RPi.GPIO.output"
] | [((131, 153), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (143, 153), True, 'import RPi.GPIO as GPIO\n'), ((184, 216), 'RPi.GPIO.setup', 'GPIO.setup', (['self.pin_id', 'GPIO.IN'], {}), '(self.pin_id, GPIO.IN)\n', (194, 216), True, 'import RPi.GPIO as GPIO\n'), ((234, 257), 'RPi.GPIO.input', ... |
# 多个文件中要用到的函数之类的统一写在这里
from skimage.measure import label
import numpy as np
import copy
# 如果最大连通域面积小于2000,直接认为分割错误,返回无分割结果,反之保留面积最大连通域,如果面积第二大连通域和最大差不多,则两个都保留
def refine_output(output):
refine = np.zeros((1280, 2440), dtype=np.uint8)
if len(np.where(output > 0)[0]) > 0:
output = label(output)
... | [
"copy.deepcopy",
"skimage.measure.label",
"numpy.where",
"numpy.zeros"
] | [((201, 239), 'numpy.zeros', 'np.zeros', (['(1280, 2440)'], {'dtype': 'np.uint8'}), '((1280, 2440), dtype=np.uint8)\n', (209, 239), True, 'import numpy as np\n'), ((298, 311), 'skimage.measure.label', 'label', (['output'], {}), '(output)\n', (303, 311), False, 'from skimage.measure import label\n'), ((251, 271), 'numpy... |
from signature import Structure, add_signature
class SpamTheOldWay:
def __init__(self, name, price):
self.name = name
self.price = price
@add_signature("name", "price")
class Spam(Structure):
pass
if __name__ == "__main__":
spam_0 = Spam(price=0.618, name="wexort")
print(spam_0.nam... | [
"signature.add_signature"
] | [((162, 192), 'signature.add_signature', 'add_signature', (['"""name"""', '"""price"""'], {}), "('name', 'price')\n", (175, 192), False, 'from signature import Structure, add_signature\n')] |
import os
import shutil
import arrow
import glob
def get_date_range(start, end):
"""get the date range of the used months"""
start = start[:4] + '-' + start[4:]
startdate = arrow.get(start)
end = end[:4] + '-' + end[4:]
enddate = arrow.get(end)
return arrow.Arrow.range('month', startdate, endd... | [
"os.mkdir",
"arrow.get",
"os.makedirs",
"os.path.basename",
"os.path.exists",
"arrow.Arrow.range",
"glob.glob",
"shutil.copy"
] | [((1417, 1452), 'shutil.copy', 'shutil.copy', (['closePriceFile', 'dir1st'], {}), '(closePriceFile, dir1st)\n', (1428, 1452), False, 'import shutil\n'), ((1548, 1569), 'glob.glob', 'glob.glob', (['featureDir'], {}), '(featureDir)\n', (1557, 1569), False, 'import glob\n'), ((187, 203), 'arrow.get', 'arrow.get', (['start... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
"""Module to access site configuration in siteconfig.ini."""
from ConfigParser import ConfigParser
from flask import g
FILENAME = '/srv/oclubs/siteconfig.ini'
def _done(commit=True):
if g.get('siteconfigParser', None):
if commit:
if g.get('s... | [
"ConfigParser.ConfigParser",
"flask.g.siteconfigParser.read",
"flask.g.get",
"flask.g.siteconfigParser.write"
] | [((245, 276), 'flask.g.get', 'g.get', (['"""siteconfigParser"""', 'None'], {}), "('siteconfigParser', None)\n", (250, 276), False, 'from flask import g\n'), ((626, 657), 'flask.g.get', 'g.get', (['"""siteconfigParser"""', 'None'], {}), "('siteconfigParser', None)\n", (631, 657), False, 'from flask import g\n'), ((719, ... |
import unittest
import library
NUM_CORPUS = '''
On the 5th of May every year, Mexicans celebrate Cinco de Mayo. This tradition
began in 1845 (the twenty-second anniversary of the Mexican Revolution), and
is the 1st example of a national independence holiday becoming popular in the
Western Hemisphere. (The Fourth of Ju... | [
"unittest.main",
"library.scan"
] | [((3867, 3882), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3880, 3882), False, 'import unittest\n'), ((683, 713), 'library.scan', 'library.scan', (['text', 'extractors'], {}), '(text, extractors)\n', (695, 713), False, 'import library\n')] |
#!/usr/bin/env python
# Copyright 2020-2022 OpenDR European Project
#
# 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... | [
"rospy.Subscriber",
"opendr_bridge.ROSBridge",
"cv2.putText",
"opendr.engine.target.BoundingBox",
"opendr.perception.pose_estimation.get_bbox",
"opendr.engine.target.BoundingBoxList",
"rospy.spin",
"opendr.perception.pose_estimation.LightweightOpenPoseLearner",
"rospy.Publisher",
"rospy.loginfo",
... | [((2444, 2455), 'opendr_bridge.ROSBridge', 'ROSBridge', ([], {}), '()\n', (2453, 2455), False, 'from opendr_bridge import ROSBridge\n'), ((2528, 2648), 'opendr.perception.pose_estimation.LightweightOpenPoseLearner', 'LightweightOpenPoseLearner', ([], {'device': 'device', 'num_refinement_stages': '(2)', 'mobilenet_use_s... |
import pytest
import subprocess
import testinfra
import pprint
# scope='session' uses the same container for all the tests;
# scope='function' uses a new container per test function.
@pytest.fixture(scope='session')
def host(request):
# build local ./Dockerfile
subprocess.check_call(['docker', 'build', '-t', 'web'... | [
"subprocess.check_output",
"pytest.fail",
"pytest.fixture",
"pytest.mark.parametrize",
"testinfra.get_host",
"subprocess.check_call"
] | [((185, 216), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (199, 216), False, 'import pytest\n'), ((660, 723), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""name,version"""', "[('python3', '3.6.4')]"], {}), "('name,version', [('python3', '3.6.4')])\n", (683,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Chemical RDF converter & fixer.
Version 2.3 (Dec 28, 14:25:00 2021)
Added mol sanitization and try/catch
run by calling
rdf_fixer.convert(filename or path)
(optional: returns list of new filenames)
@author: <NAME> (DocMinus)
license: MIT License
Copyright (c) 2021 D... | [
"os.path.isdir",
"os.walk",
"re.match",
"rdkit.Chem.MolStandardize.rdMolStandardize.Normalize",
"rdkit.Chem.SanitizeMol",
"collections.OrderedDict.fromkeys",
"os.path.isfile",
"rdkit.RDLogger.logger",
"os.path.splitext",
"rdkit.Chem.MolToSmiles",
"os.path.join",
"rdkit.Chem.MolFromMolBlock"
] | [((1116, 1138), 'os.path.isfile', 'os.path.isfile', (['RDF_IN'], {}), '(RDF_IN)\n', (1130, 1138), False, 'import os\n'), ((578, 595), 'rdkit.RDLogger.logger', 'RDLogger.logger', ([], {}), '()\n', (593, 595), False, 'from rdkit import RDLogger\n'), ((1395, 1416), 'os.path.isdir', 'os.path.isdir', (['RDF_IN'], {}), '(RDF... |
#!/usr/bin/env python3
from subprocess import run
from sys import argv, exit
PYVER = argv[1]
IMAGE = f"ruterstop:python{PYVER}"
print("Building", IMAGE)
run(
[
"docker",
"build",
"--network=host",
"--file=.deploy/Dockerfile",
f"--build-arg=PYTHON_VERSION={PYVER}",
f... | [
"subprocess.run"
] | [((155, 365), 'subprocess.run', 'run', (["['docker', 'build', '--network=host', '--file=.deploy/Dockerfile',\n f'--build-arg=PYTHON_VERSION={PYVER}',\n f'--build-arg=POETRY_VERSION=1.1.5', f'--tag=ruterstop:python{PYVER}', '.']"], {'check': '(True)'}), "(['docker', 'build', '--network=host', '--file=.deploy/Docke... |
import bayesian_irl
import mdp_worlds
import utils
import mdp
import numpy as np
import scipy
import random
import generate_efficient_frontier
import matplotlib.pyplot as plt
def generate_reward_sample():
#rewards for no-op are gamma distributed
r_noop = []
locs = 1/2
scales = [20, 40, 80,190]
... | [
"numpy.random.seed",
"numpy.ones",
"numpy.random.gamma",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.linalg.norm",
"mdp.get_policy_expected_return",
"mdp.MachineReplacementMDP",
"matplotlib.pyplot.tight_layout",
"numpy.random.randn",
"matplotlib.pyplot.yticks",
"numpy.max",
"random.seed... | [((418, 434), 'numpy.array', 'np.array', (['r_noop'], {}), '(r_noop)\n', (426, 434), True, 'import numpy as np\n'), ((582, 616), 'numpy.concatenate', 'np.concatenate', (['(r_noop, r_repair)'], {}), '((r_noop, r_repair))\n', (596, 616), True, 'import numpy as np\n'), ((924, 945), 'numpy.array', 'np.array', (['all_sample... |
import time
import math
@profile
def primes(n):
start = time.time()
prime1 = [2]
sn=int(math.sqrt(n))
for attempt in range(3,sn+1,2):
if all((attempt % prime != 0 and n%attempt==0) for prime in prime1):
prime1.append(attempt)
end = time.time()
print(end - start)
... | [
"math.sqrt",
"time.time"
] | [((64, 75), 'time.time', 'time.time', ([], {}), '()\n', (73, 75), False, 'import time\n'), ((282, 293), 'time.time', 'time.time', ([], {}), '()\n', (291, 293), False, 'import time\n'), ((106, 118), 'math.sqrt', 'math.sqrt', (['n'], {}), '(n)\n', (115, 118), False, 'import math\n')] |
# Copyright 2021 Condenser Author All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
"random.sample",
"random.shuffle",
"random.randint",
"torch.tensor"
] | [((2786, 2814), 'random.shuffle', 'random.shuffle', (['cand_indexes'], {}), '(cand_indexes)\n', (2800, 2814), False, 'import random\n'), ((4125, 4149), 'random.randint', 'random.randint', (['(0)', 'trunc'], {}), '(0, trunc)\n', (4139, 4149), False, 'import random\n'), ((6408, 6431), 'random.sample', 'random.sample', ([... |
from rest_framework.exceptions import APIException
from core.exceptions import common_exception_handler
def test_common_exception_handler_if_error_without_detail(mocker):
exp = APIException({'data': 'test'})
response = common_exception_handler(exp, mocker.Mock())
assert response.data['service_name'] == '... | [
"rest_framework.exceptions.APIException"
] | [((184, 214), 'rest_framework.exceptions.APIException', 'APIException', (["{'data': 'test'}"], {}), "({'data': 'test'})\n", (196, 214), False, 'from rest_framework.exceptions import APIException\n'), ((527, 558), 'rest_framework.exceptions.APIException', 'APIException', (["['testing error']"], {}), "(['testing error'])... |
"""Models representing the data modifying payloads."""
from h.h_api.enums import DataType
from h.h_api.model.json_api import JSONAPIData
from h.h_api.schema import Schema
class UpsertBody(JSONAPIData):
data_type = None
query_fields = []
@classmethod
def create(cls, attributes, id_reference):
... | [
"h.h_api.schema.Schema.get_validator"
] | [((802, 859), 'h.h_api.schema.Schema.get_validator', 'Schema.get_validator', (['"""bulk_api/command/upsert_user.json"""'], {}), "('bulk_api/command/upsert_user.json')\n", (822, 859), False, 'from h.h_api.schema import Schema\n'), ((1023, 1081), 'h.h_api.schema.Schema.get_validator', 'Schema.get_validator', (['"""bulk_a... |
#!/usr/bin/env python
"""Provides ways to join distinct graphs."""
from GArDen.transform.contraction import Minor
from sklearn.base import BaseEstimator, TransformerMixin
import networkx as nx
import logging
logger = logging.getLogger(__name__)
# ---------------------------------------------------------------------... | [
"networkx.disjoint_union",
"networkx.Graph",
"logging.getLogger",
"GArDen.transform.contraction.Minor"
] | [((219, 246), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (236, 246), False, 'import logging\n'), ((1502, 1512), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (1510, 1512), True, 'import networkx as nx\n'), ((2452, 2462), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (2460, 2462), ... |
from SentimentAnalysis.creat_data.config import tencent
import pandas as pd
import numpy as np
import requests
import json
import time
import random
import hashlib
from urllib import parse
from collections import OrderedDict
AppID = tencent['account']['id_1']['APP_ID']
AppKey = tencent['account']['id_1']['AppKey']
de... | [
"pandas.DataFrame",
"json.loads",
"urllib.parse.urlencode",
"random.choice",
"time.time",
"numpy.where",
"collections.OrderedDict",
"requests.post"
] | [((776, 789), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (787, 789), False, 'from collections import OrderedDict\n'), ((906, 929), 'urllib.parse.urlencode', 'parse.urlencode', (['params'], {}), '(params)\n', (921, 929), False, 'from urllib import parse\n'), ((2557, 2643), 'pandas.DataFrame', 'pd.DataFr... |
# -*- coding: utf-8 -*-
'''
#-------------------------------------------------------------------------------
# NATIONAL UNIVERSITY OF SINGAPORE - NUS
# SINGAPORE INSTITUTE FOR NEUROTECHNOLOGY - SINAPSE
# Singapore
# URL: http://www.sinapseinstitute.org
#-----------------------------------------------------------... | [
"sys.path.append",
"numpy.size",
"sklearn.externals.joblib.dump",
"numpy.zeros",
"numpy.transpose",
"os.path.isfile",
"sklearn.externals.joblib.load",
"numpy.loadtxt",
"sklearn.svm.SVC",
"numpy.vstack"
] | [((1187, 1216), 'sys.path.append', 'sys.path.append', (['"""../general"""'], {}), "('../general')\n", (1202, 1216), False, 'import os, os.path, sys\n'), ((9841, 9877), 'numpy.loadtxt', 'np.loadtxt', (['"""NewData_BRC/BRC_B1.txt"""'], {}), "('NewData_BRC/BRC_B1.txt')\n", (9851, 9877), True, 'import numpy as np\n'), ((10... |
from algorithm import Algorithm
from tkinter import *
from tkinter import ttk
class Gradient_Boosting_Classifier(Algorithm):
def __init__(self, frame):
self.frame = frame
self.name = "Gradient Boosting Classifier"
#Options for the loss criteria.
self.Loss_Label = ttk.Label(frame, text="Loss Fun... | [
"tkinter.ttk.Label",
"tkinter.ttk.Radiobutton",
"tkinter.ttk.Entry"
] | [((289, 328), 'tkinter.ttk.Label', 'ttk.Label', (['frame'], {'text': '"""Loss Function:"""'}), "(frame, text='Loss Function:')\n", (298, 328), False, 'from tkinter import ttk\n'), ((409, 486), 'tkinter.ttk.Radiobutton', 'ttk.Radiobutton', (['frame'], {'text': '"""Deviance"""', 'variable': 'self.Loss', 'value': '"""devi... |
import pdb
import json
import numpy as np
file = 'benchmark_data.json'
with open(file, 'r') as f:
json_data = json.load(f)
print(json_data.keys()) # ['domains', 'version']
domains = json_data['domains']
print('domain length', len(domains))
corr_data = []
for domain in domains:
temp = {}
temp['long_description'... | [
"numpy.save",
"numpy.array",
"json.load"
] | [((719, 738), 'numpy.array', 'np.array', (['corr_data'], {}), '(corr_data)\n', (727, 738), True, 'import numpy as np\n'), ((739, 779), 'numpy.save', 'np.save', (['"""benchmark_data.npy"""', 'corr_data'], {}), "('benchmark_data.npy', corr_data)\n", (746, 779), True, 'import numpy as np\n'), ((113, 125), 'json.load', 'js... |
# -*- coding: utf-8 -*-
# !/usr/bin/env python
#
# @file __init__.py
# @brief G_MMPBSA DASK PROJECT
# @author <NAME>
#
# <!--------------------------------------------------------------------------
#
# Copyright (c) 2016-2019,<NAME>.
# All rights reserved.
# Redistribution and use in source and binary forms, ... | [
"copy.deepcopy",
"molmolpy.utils.folder_utils.find_folder_in_path",
"multiprocessing.current_process",
"math.ceil",
"molmolpy.utils.folder_utils.create_folder",
"molmolpy.tools.run_dask_tools.get_dask_worker_status",
"time.sleep",
"itertools.cycle",
"mdtraj.load_xtc",
"molmolpy.tools.run_dask_tool... | [((1917, 1987), 'itertools.cycle', 'itertools.cycle', (["['navy', 'c', 'cornflowerblue', 'gold', 'darkorange']"], {}), "(['navy', 'c', 'cornflowerblue', 'gold', 'darkorange'])\n", (1932, 1987), False, 'import itertools\n'), ((8609, 8666), 'mdtraj.load_xtc', 'md.load_xtc', (['self.trajectory_file'], {'top': 'self.topolo... |
import random
from randomized_tsp.utils import cost, random_neighbour, random_tour
def init_population(population_size, num_of_cities):
"""
Initializes the population
"""
population = set()
while len(population) != population_size:
population.add(tuple(random_tour(num_of_cities)))
retu... | [
"randomized_tsp.utils.random_tour",
"randomized_tsp.utils.cost",
"random.randint",
"random.uniform",
"random.shuffle",
"random.choices",
"randomized_tsp.utils.random_neighbour"
] | [((827, 863), 'random.randint', 'random.randint', (['(0)', '(num_of_cities - 2)'], {}), '(0, num_of_cities - 2)\n', (841, 863), False, 'import random\n'), ((874, 914), 'random.randint', 'random.randint', (['start', '(num_of_cities - 1)'], {}), '(start, num_of_cities - 1)\n', (888, 914), False, 'import random\n'), ((192... |
from django.db import models
from django_extensions.db.fields import CreationDateTimeField
from django_extensions.db.models import TimeStampedModel
class CreationSortedTimeStampedModel(TimeStampedModel):
class Meta(TimeStampedModel.Meta):
abstract = True
ordering = ['-created']
get_latest_... | [
"django_extensions.db.fields.CreationDateTimeField"
] | [((350, 386), 'django_extensions.db.fields.CreationDateTimeField', 'CreationDateTimeField', ([], {'db_index': '(True)'}), '(db_index=True)\n', (371, 386), False, 'from django_extensions.db.fields import CreationDateTimeField\n')] |
'''
Created on Feb 24, 2015
@author: <NAME> <<EMAIL>>
This module provides functions and classes for probability distributions, which
build upon the scipy.stats package and extend it.
'''
from __future__ import division
import numpy as np
from scipy import stats, special, linalg, optimize
from ..data_structures... | [
"numpy.sum",
"numpy.abs",
"scipy.special.ndtri",
"numpy.random.exponential",
"scipy.optimize.leastsq",
"numpy.histogram",
"scipy.optimize.newton",
"numpy.exp",
"numpy.diag",
"numpy.prod",
"numpy.unique",
"numpy.zeros_like",
"scipy.stats.lognorm.pdf",
"scipy.stats.norm.cdf",
"scipy.stats.... | [((2333, 2366), 'numpy.linspace', 'np.linspace', (['(0)', 'val_max', '(bins + 1)'], {}), '(0, val_max, bins + 1)\n', (2344, 2366), True, 'import numpy as np\n'), ((2420, 2483), 'numpy.histogram', 'np.histogram', (['vals'], {'bins': 'bins', 'range': '[0, val_max]', 'density': '(True)'}), '(vals, bins=bins, range=[0, val... |
#!/usr/bin/env python3
# coding=utf-8
import json
import os
import sys
import unittest
from src.utils.payloadHelper import PayloadHelper
class MappedPayloadTests(unittest.TestCase):
def setUp(self):
pass
def test_hartbeat(self):
script_dir = os.path.dirname(__file__)
rel_path = 'dat... | [
"unittest.main",
"json.load",
"os.path.dirname",
"src.utils.payloadHelper.PayloadHelper",
"os.path.join"
] | [((833, 858), 'unittest.main', 'unittest.main', ([], {'exit': '(False)'}), '(exit=False)\n', (846, 858), False, 'import unittest\n'), ((271, 296), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (286, 296), False, 'import os\n'), ((376, 410), 'os.path.join', 'os.path.join', (['script_dir', 're... |
import random
import string
from .player import Player
# from flask import current_app
# from flask_socketio import SocketIO, emit
# socketio = SocketIO(current_app)
# logger = current_app.logger
class Word:
def __init__(self, word: str, player: Player, guesser: Player = None):
self.word = word.upper()
... | [
"random.shuffle",
"random.choice"
] | [((1589, 1606), 'random.shuffle', 'random.shuffle', (['l'], {}), '(l)\n', (1603, 1606), False, 'import random\n'), ((756, 793), 'random.choice', 'random.choice', (['string.ascii_lowercase'], {}), '(string.ascii_lowercase)\n', (769, 793), False, 'import random\n')] |
from nose.tools import *
from tests.base import OsfTestCase
from tests.factories import UserFactory
from scripts.migration.migrate_mailing_lists_to_mailchimp_field import main, get_users_with_no_mailchimp_mailing_lists
class TestMigrateMailingLists(OsfTestCase):
def setUp(self):
super(TestMigrateMailingL... | [
"scripts.migration.migrate_mailing_lists_to_mailchimp_field.get_users_with_no_mailchimp_mailing_lists",
"scripts.migration.migrate_mailing_lists_to_mailchimp_field.main",
"tests.factories.UserFactory"
] | [((361, 402), 'tests.factories.UserFactory', 'UserFactory', ([], {'mailing_lists': "{'mail': True}"}), "(mailing_lists={'mail': True})\n", (372, 402), False, 'from tests.factories import UserFactory\n'), ((424, 466), 'tests.factories.UserFactory', 'UserFactory', ([], {'mailing_lists': "{'mail': False}"}), "(mailing_lis... |
import pickle
from typing import List, Set
from os.path import join, exists, isfile, isdir
from os import makedirs, listdir
from hotpot.config import CORPUS_DIR
from hotpot.configurable import Configurable
from hotpot.data_handling.data import RelevanceQuestion
from hotpot.data_handling.word_vectors import load_word... | [
"pickle.dump",
"os.makedirs",
"os.path.isdir",
"os.path.exists",
"hotpot.data_handling.word_vectors.load_word_vectors",
"os.path.isfile",
"hotpot.utils.ResourceLoader",
"pickle.load",
"hotpot.data_handling.data.RelevanceQuestion",
"os.path.join"
] | [((3821, 4071), 'hotpot.data_handling.data.RelevanceQuestion', 'RelevanceQuestion', ([], {'dataset_name': '"""squad"""', 'question_id': 'squad_question.question_id', 'question_tokens': 'squad_question.question', 'supporting_facts': '[squad_question.paragraph.par_text]', 'distractors': '[x.par_text for x in squad_questi... |
from flask import current_app, render_template, url_for
from markupsafe import Markup
from mass_flask_core.models import FileSample, IPSample, DomainSample, URISample, ExecutableBinarySample, UserLevel
from mass_flask_webui.config import webui_blueprint
@webui_blueprint.context_processor
def sample_processors():
... | [
"markupsafe.Markup",
"flask.url_for",
"flask.render_template"
] | [((1144, 1179), 'flask.url_for', 'url_for', (['""".sample_search"""'], {}), "('.sample_search', **kwargs)\n", (1151, 1179), False, 'from flask import current_app, render_template, url_for\n'), ((408, 444), 'markupsafe.Markup', 'Markup', (['"""<i class="fa fa-file"></i>"""'], {}), '(\'<i class="fa fa-file"></i>\')\n', (... |
from users.models import User
from django.db import models
PET_SIZES = [('P', 'Pequeno'), ('M', 'Médio'), ('G', 'Grande')]
PET_SEX = [('M', 'Macho'), ('F', 'Fêmea')]
# PET TYPE
GATO = 'Gato'
CACHORRO = 'Cachorro'
PASSARO = 'Pássaro'
ROEDOR = 'Roedor'
OUTRO = 'Outro'
# DEFAULT
DE00 = 'Sem raça definida'
DE01 = '... | [
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.ImageField"
] | [((6494, 6557), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'default': 'None', 'on_delete': 'models.CASCADE'}), '(User, default=None, on_delete=models.CASCADE)\n', (6511, 6557), False, 'from django.db import models\n'), ((6570, 6635), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload... |
# coding: utf-8
import pygame
import os
from functions import *
from color import *
from pygame.locals import *
from listOfCards import allCards, values
from About import About
from Text import *
from color import *
class Card(pygame.sprite.Sprite):
"""Manages the cards in the game"""
def __init__(self, numb... | [
"About.About"
] | [((561, 583), 'About.About', 'About', (['self.name', 'self'], {}), '(self.name, self)\n', (566, 583), False, 'from About import About\n')] |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import torch
from torch.utils.data import Dataset
from sklearn.model_selection import train_test_split
# Define the class for the Meta-material dataset
class MetaMaterialDataSet(Dataset):
""" The Meta Material Dataset Class """
def __init__... | [
"numpy.random.shuffle",
"numpy.multiply",
"torch.utils.data.DataLoader",
"sklearn.model_selection.train_test_split",
"numpy.power",
"numpy.savetxt",
"numpy.zeros",
"numpy.arange",
"numpy.array",
"numpy.linspace",
"numpy.concatenate",
"numpy.sqrt"
] | [((1093, 1129), 'numpy.linspace', 'np.linspace', (['r_min', 'r_max', '(space + 1)'], {}), '(r_min, r_max, space + 1)\n', (1104, 1129), True, 'import numpy as np\n'), ((1144, 1180), 'numpy.linspace', 'np.linspace', (['h_min', 'h_max', '(space + 1)'], {}), '(h_min, h_max, space + 1)\n', (1155, 1180), True, 'import numpy ... |
# Read the problem below and then implement it in code. You do not need to submit your
# written decomposition of how you’ve worked it out but make sure to comment your code
# to explain what you’ve done.
#
# A computer generates a random number from 0 – 10. It then asks the user to make a
# guess. They have 5 attempt... | [
"random.randint"
] | [((555, 569), 'random.randint', 'randint', (['(0)', '(10)'], {}), '(0, 10)\n', (562, 569), False, 'from random import randint\n')] |
from django.urls import reverse_lazy
from oauth2_provider import views
from .. import mixins
class ApplicationList(mixins.TwoFactorMixin, mixins.ApplicationViewMixin, views.ApplicationList):
template_name = 'oauth2/applications/list.html'
class ApplicationRegistration(mixins.ApplicationCreationMixin, mixins.Tw... | [
"django.urls.reverse_lazy"
] | [((871, 903), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""application_list"""'], {}), "('application_list')\n", (883, 903), False, 'from django.urls import reverse_lazy\n'), ((469, 534), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""application_detail"""'], {'kwargs': "{'pk': self.object.pk}"}), "('applicatio... |
import frappe
def execute():
a=frappe.new_doc("Task")
a.subject='axy'
a.save()
print(a.name)
# #bench execute demo.doctype.task.execute
# print('***************') | [
"frappe.new_doc"
] | [((35, 57), 'frappe.new_doc', 'frappe.new_doc', (['"""Task"""'], {}), "('Task')\n", (49, 57), False, 'import frappe\n')] |
from gettext import gettext
def foo():
print(gettext('ssshhh....'))
| [
"gettext.gettext"
] | [((51, 72), 'gettext.gettext', 'gettext', (['"""ssshhh...."""'], {}), "('ssshhh....')\n", (58, 72), False, 'from gettext import gettext\n')] |
import numpy as np
from ..colors import Color
from .widget import Widget, overlapping_region
from .widget_data_structures import Point, Size, Rect
class _Root(Widget):
"""
Root widget. Meant to be instantiated by the `App` class. Renders to terminal.
"""
def __init__(self, app, env_out, default_char,... | [
"numpy.full",
"numpy.full_like",
"numpy.zeros_like",
"numpy.not_equal",
"numpy.any",
"numpy.nonzero",
"numpy.logical_or"
] | [((775, 820), 'numpy.full', 'np.full', (['dim', 'self.default_char'], {'dtype': 'object'}), '(dim, self.default_char, dtype=object)\n', (782, 820), True, 'import numpy as np\n'), ((849, 903), 'numpy.full', 'np.full', (['(*dim, 6)', 'self.default_color'], {'dtype': 'np.uint8'}), '((*dim, 6), self.default_color, dtype=np... |
import re
import time
from datetime import datetime
import urllib
import mechanicalsoup
import getpass
from bs4 import BeautifulSoup
# Conver Time Function
def convertTime(time):
try:
time = time.replace(",","").replace("@","").replace("."," ").replace(":"," ")
t2 = datetime.strptime(time[3:], "%A... | [
"re.split",
"getpass.getpass",
"time.replace",
"time.sleep",
"datetime.datetime",
"mechanicalsoup.StatefulBrowser",
"datetime.datetime.strptime",
"bs4.BeautifulSoup"
] | [((718, 750), 'mechanicalsoup.StatefulBrowser', 'mechanicalsoup.StatefulBrowser', ([], {}), '()\n', (748, 750), False, 'import mechanicalsoup\n'), ((936, 976), 'getpass.getpass', 'getpass.getpass', (['"""Enter your password: """'], {}), "('Enter your password: ')\n", (951, 976), False, 'import getpass\n'), ((1376, 1407... |
import os
from bddcli import Given, stdout, Application, when, given
def foos(): # pragma: no cover
e = os.environ.copy()
# For Linux and Windows
discarded_variables = ['LC_CTYPE', 'PWD',
'COMSPEC', 'PATHEXT', 'PROMPT', 'SYSTEMROOT']
# Windows environment variables are cas... | [
"bddcli.Application",
"os.environ.copy",
"bddcli.when",
"bddcli.Given"
] | [((467, 512), 'bddcli.Application', 'Application', (['"""foo"""', '"""tests.test_environ:foos"""'], {}), "('foo', 'tests.test_environ:foos')\n", (478, 512), False, 'from bddcli import Given, stdout, Application, when, given\n'), ((112, 129), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (127, 129), False, 'im... |
from .base import *
import dj_database_url
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# If DEBUG is False, send the errors to the email:
ADMINS = [
('Andre', '<EMAIL>'),
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenois... | [
"dj_database_url.config"
] | [((1363, 1403), 'dj_database_url.config', 'dj_database_url.config', ([], {'conn_max_age': '(500)'}), '(conn_max_age=500)\n', (1385, 1403), False, 'import dj_database_url\n')] |
import logging
import numpy as np
from openpnm.utils import SettingsAttr, Docorator
from openpnm.integrators import ScipyRK45
from openpnm.algorithms import GenericAlgorithm
from openpnm.algorithms._solution import SolutionContainer, TransientSolution
logger = logging.getLogger(__name__)
docstr = Docorator()
@docstr.... | [
"openpnm.algorithms._solution.TransientSolution",
"numpy.isscalar",
"openpnm.utils.Docorator",
"numpy.ones",
"openpnm.algorithms._solution.SolutionContainer",
"numpy.hstack",
"numpy.cumsum",
"openpnm.integrators.ScipyRK45",
"numpy.arange",
"openpnm.utils.SettingsAttr",
"logging.getLogger"
] | [((261, 288), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (278, 288), False, 'import logging\n'), ((298, 309), 'openpnm.utils.Docorator', 'Docorator', ([], {}), '()\n', (307, 309), False, 'from openpnm.utils import SettingsAttr, Docorator\n'), ((797, 850), 'openpnm.utils.SettingsAttr',... |
# Copyright (c) OpenMMLab. All rights reserved.
import mmocr.utils as utils
import torch
import torch.nn.functional as F
from mmdeploy.core import FUNCTION_REWRITER
@FUNCTION_REWRITER.register_rewriter(
func_name='mmocr.models.textrecog.encoders.SAREncoder.forward',
backend='default')
def sar_encoder__forwar... | [
"mmocr.utils.is_type_list",
"torch.stack",
"torch.ceil",
"torch.nn.functional.max_pool2d",
"mmdeploy.core.FUNCTION_REWRITER.register_rewriter"
] | [((169, 292), 'mmdeploy.core.FUNCTION_REWRITER.register_rewriter', 'FUNCTION_REWRITER.register_rewriter', ([], {'func_name': '"""mmocr.models.textrecog.encoders.SAREncoder.forward"""', 'backend': '"""default"""'}), "(func_name=\n 'mmocr.models.textrecog.encoders.SAREncoder.forward', backend='default')\n", (204, 292)... |
# Tests for WikiText parsing
#
# Copyright (c) 2020-2021 <NAME>. See file LICENSE and https://ylonen.org
import unittest
from wikitextprocessor import Wtp
from wikitextprocessor.parser import (print_tree, NodeKind, WikiNode)
def parse_with_ctx(title, text, **kwargs):
assert isinstance(title, str)
assert isi... | [
"wikitextprocessor.Wtp"
] | [((349, 354), 'wikitextprocessor.Wtp', 'Wtp', ([], {}), '()\n', (352, 354), False, 'from wikitextprocessor import Wtp\n')] |
import collections
import io
import json
import math
import zipfile
import logging
from urllib.error import URLError
from urllib.request import urlopen
import pandas as pd
from matplotlib import pyplot as plt
# Getting data
def set_source(filename):
"""
Sets source global variable to the path of .zip file.
... | [
"pandas.DataFrame",
"matplotlib.pyplot.xlim",
"json.dump",
"logging.error",
"matplotlib.pyplot.show",
"matplotlib.pyplot.bar",
"math.floor",
"urllib.request.urlopen",
"matplotlib.pyplot.rcdefaults",
"pandas.Series",
"pandas.Timedelta",
"collections.Counter",
"pandas.set_option",
"matplotli... | [((6203, 6242), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', 'None'], {}), "('display.max_rows', None)\n", (6216, 6242), True, 'import pandas as pd\n'), ((6425, 6441), 'matplotlib.pyplot.rcdefaults', 'plt.rcdefaults', ([], {}), '()\n', (6439, 6441), True, 'from matplotlib import pyplot as plt\n'), ... |
import xml.etree.ElementTree as et
from objects.node import Node
from objects.way import Way
def extract_road(item, roads):
way_id = int(item.attrib['id'])
way = Way(way_id)
is_highway = False
for child in item:
if child.tag == "nd":
way.add_node(int(child.attrib['ref']))
... | [
"objects.way.Way",
"xml.etree.ElementTree.parse",
"objects.node.Node"
] | [((173, 184), 'objects.way.Way', 'Way', (['way_id'], {}), '(way_id)\n', (176, 184), False, 'from objects.way import Way\n'), ((905, 938), 'objects.node.Node', 'Node', (['node_id', 'node_lat', 'node_lon'], {}), '(node_id, node_lat, node_lon)\n', (909, 938), False, 'from objects.node import Node\n'), ((1162, 1180), 'xml.... |
import json
import os
from jinja2 import Template
from chronologer.config import config
def write_html():
html_file = os.path.join(os.path.dirname(__file__), "templates", "index.html")
with open(html_file) as fp:
html_template = Template(fp.read())
if not config.dry_run:
boxplot_spec = j... | [
"os.path.dirname",
"json.load"
] | [((139, 164), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (154, 164), False, 'import os\n'), ((583, 596), 'json.load', 'json.load', (['fp'], {}), '(fp)\n', (592, 596), False, 'import json\n')] |
from core import *
import core
def Initialize():
"""
find libcom-api and initialize
"""
import os
import sys
dirname = os.path.dirname(__file__)
ext = '.so'
if sys.platform == 'darwin':
ext = '.dylib'
elif sys.platform.startswith("win"):
ext = '.dll'
... | [
"sys.platform.startswith",
"os.path.dirname",
"os.environ.get",
"core.AxInit",
"os.path.join"
] | [((145, 170), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (160, 170), False, 'import os\n'), ((339, 380), 'os.path.join', 'os.path.join', (['dirname', "('libcom-api' + ext)"], {}), "(dirname, 'libcom-api' + ext)\n", (351, 380), False, 'import os\n'), ((414, 460), 'os.environ.get', 'os.envi... |
import yaml
import os
fileNamePath = os.path.split(os.path.realpath(__file__))[0]
dir = os.path.join(fileNamePath,'../conf')
def get(file_name,*keys,file_path=dir):
yamlPath = os.path.join(file_path, file_name)
file = open(yamlPath, 'r', encoding='utf-8')
config = yaml.load(file)
for key in keys:
... | [
"yaml.load",
"os.path.join",
"os.path.realpath"
] | [((89, 126), 'os.path.join', 'os.path.join', (['fileNamePath', '"""../conf"""'], {}), "(fileNamePath, '../conf')\n", (101, 126), False, 'import os\n'), ((182, 216), 'os.path.join', 'os.path.join', (['file_path', 'file_name'], {}), '(file_path, file_name)\n', (194, 216), False, 'import os\n'), ((279, 294), 'yaml.load', ... |
__copyright__ = "Copyright (C) 2019 <NAME>"
__license__ = """
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, modif... | [
"pytest.mark.parametrize",
"numpy.sqrt",
"pytest.skip",
"common.parser.parse_args"
] | [((1284, 1330), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dtype"""', '[np.float64]'], {}), "('dtype', [np.float64])\n", (1307, 1330), False, 'import pytest\n'), ((1333, 1404), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""Stepper"""', '[ps.RungeKutta4, ps.LowStorageRK54]'], {}), "('Stepp... |
import pytest
from mergify_engine import subscription
def test_init():
subscription.Subscription(
123, True, "friend", {}, frozenset({subscription.Features.PRIVATE_REPOSITORY})
)
def test_dict():
owner_id = 1234
sub = subscription.Subscription(
owner_id,
True,
"frien... | [
"pytest.mark.parametrize",
"mergify_engine.subscription.Subscription._retrieve_subscription_from_cache",
"mergify_engine.subscription.Subscription.from_dict"
] | [((466, 643), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""features"""', '({}, {subscription.Features.PRIVATE_REPOSITORY}, {subscription.Features.\n PRIVATE_REPOSITORY, subscription.Features.PRIORITY_QUEUES})'], {}), "('features', ({}, {subscription.Features.\n PRIVATE_REPOSITORY}, {subscription.Fe... |
'''
Setup file for Operator and Hamiltonain Generators.
'''
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config=Configuration('hgen',parent_package,top_path)
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
se... | [
"numpy.distutils.core.setup",
"numpy.distutils.misc_util.Configuration"
] | [((179, 226), 'numpy.distutils.misc_util.Configuration', 'Configuration', (['"""hgen"""', 'parent_package', 'top_path'], {}), "('hgen', parent_package, top_path)\n", (192, 226), False, 'from numpy.distutils.misc_util import Configuration\n'), ((318, 352), 'numpy.distutils.core.setup', 'setup', ([], {'configuration': 'c... |
# Generated by Django 3.2.9 on 2022-01-10 08:19
import cloudinary.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('hoodapp', '0013_auto_20220110_1102'),
]
operations = [
migrations.AlterModelOptions(
name='post',
o... | [
"django.db.migrations.RemoveField",
"django.db.migrations.AlterModelOptions"
] | [((252, 324), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""post"""', 'options': "{'ordering': ['-pk']}"}), "(name='post', options={'ordering': ['-pk']})\n", (280, 324), False, 'from django.db import migrations\n'), ((369, 424), 'django.db.migrations.RemoveField', 'migratio... |
from abc import ABCMeta, abstractmethod
from typing import Optional
import json
def error_catcher(method):
def wrapper(*args, **kwargs):
try:
return method(*args, **kwargs)
except (AttributeError, ValueError):
return "File error: указан неверный тип файла."
return wrapp... | [
"json.load"
] | [((1144, 1156), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1153, 1156), False, 'import json\n')] |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: update_comment.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.proto... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.reflection.GeneratedProtocolMessageType"
] | [((468, 494), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (492, 494), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((5415, 5584), 'google.protobuf.reflection.GeneratedProtocolMessageType', '_reflection.GeneratedProtocolMessageType', (['"""Updat... |
from setuptools import setup
import numpy
setup(
name='CIGAN',
version='0.2dev',
packages=['vpa'],
license='MIT License',
include_dirs=[numpy.get_include(),],
) | [
"numpy.get_include"
] | [((157, 176), 'numpy.get_include', 'numpy.get_include', ([], {}), '()\n', (174, 176), False, 'import numpy\n')] |
#!/usr/bin/env python3
import re, argparse, numpy as np, glob, os
#from sklearn.neighbors.kde import KernelDensity
import matplotlib.pyplot as plt
from extractTargetFilesNonDim import epsNuFromRe
from extractTargetFilesNonDim import getAllData
from computeSpectraNonDim import readAllSpectra
colors = ['#1f78b4', '#3... | [
"matplotlib.pyplot.subplot",
"extractTargetFilesNonDim.epsNuFromRe",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"numpy.log",
"extractTargetFilesNonDim.getAllData",
"computeSpectraNonDim.readAllSpectra",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"glob.glob",
"matplotli... | [((982, 1008), 'glob.glob', 'glob.glob', (["(runspath + '/*')"], {}), "(runspath + '/*')\n", (991, 1008), False, 'import re, argparse, numpy as np, glob, os\n'), ((1277, 1318), 'numpy.arange', 'np.arange', (['(1)', '(nBins + 1)'], {'dtype': 'np.float64'}), '(1, nBins + 1, dtype=np.float64)\n', (1286, 1318), True, 'impo... |
#!/usr/bin/env python3
""" An attempt to solve the Last Factorial Digit """
import sys
# This is totally wrong, but given N maxes out at 10, and anything after 5 the last digit is 0,
# this is likely cheaper and faster
result_dict = {1: 1,
2: 2,
3: 6,
4: 4}
dont_care = sy... | [
"sys.stdin.readline",
"sys.stdin.readlines"
] | [((318, 338), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (336, 338), False, 'import sys\n'), ((352, 373), 'sys.stdin.readlines', 'sys.stdin.readlines', ([], {}), '()\n', (371, 373), False, 'import sys\n')] |
import os, sys
from PyQt5 import QtCore, QtGui
from qtpy.QtWidgets import QApplication
import ctypes
from sys import platform
sys.path.insert(0, os.path.join( os.path.dirname(__file__), "..", ".." ))
from window import ExecutionNodeEditorWindow
if __name__ == '__main__':
app = QApplication(sys.argv)
exe_p... | [
"PyQt5.QtGui.QIcon",
"os.path.join",
"PyQt5.QtGui.QFontDatabase.addApplicationFont",
"PyQt5.QtGui.QFontDatabase.applicationFontFamilies",
"os.path.dirname",
"window.ExecutionNodeEditorWindow",
"os.path.realpath",
"PyQt5.QtCore.QSize",
"ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID",
... | [((287, 309), 'qtpy.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (299, 309), False, 'from qtpy.QtWidgets import QApplication\n'), ((390, 422), 'os.path.join', 'os.path.join', (['exe_path', '"""assets"""'], {}), "(exe_path, 'assets')\n", (402, 422), False, 'import os, sys\n'), ((830, 843)... |
from environs import Env
env = Env()
env.read_env()
db_host = env.str('DB_HOST', 'localhost')
db_port = env.int('DB_PORT', 27017) | [
"environs.Env"
] | [((32, 37), 'environs.Env', 'Env', ([], {}), '()\n', (35, 37), False, 'from environs import Env\n')] |
import cv2
def image_equalize(imgA, imgB):
new_size = max(imgA.shape, imgB.shape)
new_imgA = cv2.resize(imgA, new_size)
new_imgB = cv2.resize(imgB, new_size)
return new_imgA, new_imgB
| [
"cv2.resize"
] | [((105, 131), 'cv2.resize', 'cv2.resize', (['imgA', 'new_size'], {}), '(imgA, new_size)\n', (115, 131), False, 'import cv2\n'), ((147, 173), 'cv2.resize', 'cv2.resize', (['imgB', 'new_size'], {}), '(imgB, new_size)\n', (157, 173), False, 'import cv2\n')] |
import click
import pandas as pd
@click.command()
@click.option("--input-path", "-i", default = "data/0_raw/", required=True,
help="Path to csv file to be processed.",
)
@click.option("--output-path", "-o", default="data/3_processed/",
help="Path to csv file to store the result.")
def main(input_path, output_... | [
"pandas.read_csv",
"click.option",
"click.command"
] | [((35, 50), 'click.command', 'click.command', ([], {}), '()\n', (48, 50), False, 'import click\n'), ((52, 170), 'click.option', 'click.option', (['"""--input-path"""', '"""-i"""'], {'default': '"""data/0_raw/"""', 'required': '(True)', 'help': '"""Path to csv file to be processed."""'}), "('--input-path', '-i', default... |
"""Tests for remote.py."""
import logging
from datetime import timedelta
import pytest
from custom_components.hueremote import DOMAIN
from custom_components.hueremote.data_manager import HueSensorData
from custom_components.hueremote.hue_api_response import (
parse_hue_api_response,
parse_rwl,
parse_zgp,
... | [
"logging.warning",
"pytest.mark.parametrize",
"custom_components.hueremote.hue_api_response.parse_hue_api_response",
"datetime.timedelta"
] | [((672, 992), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""raw_response, sensor_key, parsed_response, parser_func"""', "((MOCK_ZGP, 'ZGP_00:44:23:08', PARSED_ZGP, parse_zgp), (MOCK_RWL,\n 'RWL_00:17:88:01:10:3e:3a:dc-02', PARSED_RWL, parse_rwl), (\n MOCK_Z3_ROTARY, 'Z3-_ff:ff:00:0f:e7:fd:ba:b7-01-f... |
# -*- coding: utf-8 -*-
# (c) University of Strathclyde 2021
# Author: <NAME>
#
# Contact: <EMAIL>
#
# <NAME>,
# Strathclyde Institute for Pharmacy and Biomedical Sciences,
# Cathedral Street,
# Glasgow,
# G4 0RE
# Scotland,
# UK
#
# The MIT License
#
# Copyright (c) 2021 University of Strathclyde
#
# Permission is her... | [
"subprocess.run",
"shutil.which",
"platform.system",
"os.access",
"logging.getLogger"
] | [((2508, 2535), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2525, 2535), False, 'import logging\n'), ((2878, 2911), 'os.access', 'os.access', (['blastall_path', 'os.X_OK'], {}), '(blastall_path, os.X_OK)\n', (2887, 2911), False, 'import os\n'), ((3027, 3044), 'platform.system', 'platf... |
from functools import partial
from collections.abc import MutableSequence
from . import base_types
from . import tree
from . import transform
from .state import CncState
from . import point as pt
from . import action
class Assembly(tree.Tree, transform.TransformableMixin):
'''tree of assembly items'''
def __i... | [
"functools.partial"
] | [((3896, 3933), 'functools.partial', 'partial', (['action.Jog'], {'state': 'self.state'}), '(action.Jog, state=self.state)\n', (3903, 3933), False, 'from functools import partial\n'), ((3208, 3245), 'functools.partial', 'partial', (['action.Jog'], {'state': 'self.state'}), '(action.Jog, state=self.state)\n', (3215, 324... |
from django.shortcuts import render
# # from django.shortcuts import get_object_or_404
# from django.http import HttpResponseRedirect
# from django.urls import reverse
import datetime
from django.contrib.auth.decorators import permission_required
from django.views.generic.edit import CreateView, UpdateView, DeleteVi... | [
"django.shortcuts.render",
"django.urls.reverse_lazy",
"django.contrib.auth.decorators.permission_required"
] | [((2099, 2147), 'django.contrib.auth.decorators.permission_required', 'permission_required', (['"""catalog.can_mark_returned"""'], {}), "('catalog.can_mark_returned')\n", (2118, 2147), False, 'from django.contrib.auth.decorators import permission_required\n'), ((1209, 1392), 'django.shortcuts.render', 'render', (['requ... |
"""
# Read report and generate messages to fill missing scenes
#### Utility utilization
The DAG can be parameterized with run time configurations `scenes_limit`, which receives a INT as value.
* The option scenes_limit limit the number of scenes to be read from the report,
therefore limit the number of messages to be... | [
"logging.error",
"airflow.contrib.hooks.aws_sqs_hook.SQSHook",
"traceback.print_exc",
"airflow.DAG",
"odc.aws.queue.publish_messages",
"gzip.decompress",
"json.dumps",
"datetime.datetime",
"logging.info",
"utils.aws_utils.S3"
] | [((1248, 1268), 'datetime.datetime', 'datetime', (['(2021)', '(6)', '(7)'], {}), '(2021, 6, 7)\n', (1256, 1268), False, 'from datetime import datetime\n'), ((1674, 1712), 'airflow.contrib.hooks.aws_sqs_hook.SQSHook', 'SQSHook', ([], {'aws_conn_id': 'CONN_LANDSAT_SYNC'}), '(aws_conn_id=CONN_LANDSAT_SYNC)\n', (1681, 1712... |
"""Increase sql path column length to 128
Revision ID: 799310dca712
Revises: ca514840f404
Create Date: 2020-04-09 11:34:05.456439
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '799310dca712'
down_revision = 'ca514840f404'
branch_labels = None
depends_on = Non... | [
"sqlalchemy.String"
] | [((389, 403), 'sqlalchemy.String', 'sa.String', (['(128)'], {}), '(128)\n', (398, 403), True, 'import sqlalchemy as sa\n'), ((419, 439), 'sqlalchemy.String', 'sa.String', ([], {'length': '(32)'}), '(length=32)\n', (428, 439), True, 'import sqlalchemy as sa\n'), ((509, 522), 'sqlalchemy.String', 'sa.String', (['(32)'], ... |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from asylum.tests.fixtures.full import generate_all
class Command(BaseCommand):
help = 'Generates full set of test data'
def add_arguments(self, parser):
pass
def handle(self, *args, **options):
ge... | [
"asylum.tests.fixtures.full.generate_all"
] | [((318, 332), 'asylum.tests.fixtures.full.generate_all', 'generate_all', ([], {}), '()\n', (330, 332), False, 'from asylum.tests.fixtures.full import generate_all\n')] |
import numpy as np
import pyvista as pv
from pylie import SE3
class Viewer3D:
"""Visualises the lab in 3D"""
def __init__(self):
"""Sets up the 3D viewer"""
self._plotter = pv.Plotter()
# Add scene origin and plane
scene_plane = pv.Plane(i_size=1000, j_size=1000)
self... | [
"numpy.zeros",
"pyvista.Plotter",
"pyvista.Pyramid",
"pyvista.numpy_to_texture",
"pyvista.Plane",
"numpy.array",
"pyvista.Rectangle",
"pyvista.Arrow",
"numpy.diag",
"pylie.SE3",
"pyvista.Sphere"
] | [((200, 212), 'pyvista.Plotter', 'pv.Plotter', ([], {}), '()\n', (210, 212), True, 'import pyvista as pv\n'), ((273, 307), 'pyvista.Plane', 'pv.Plane', ([], {'i_size': '(1000)', 'j_size': '(1000)'}), '(i_size=1000, j_size=1000)\n', (281, 307), True, 'import pyvista as pv\n'), ((1511, 1540), 'pyvista.Sphere', 'pv.Sphere... |
import asyncio
from unittest.mock import MagicMock
class MockException(Exception):
pass
# AsyncMock is new in Python 3.8
class AsyncMock(MagicMock):
async def __call__(self, *args, **kwargs): # pylint: disable = invalid-overridden-method, useless-super-delegation
return super().__call__(*args, **kwargs)
class... | [
"asyncio.sleep"
] | [((445, 461), 'asyncio.sleep', 'asyncio.sleep', (['(1)'], {}), '(1)\n', (458, 461), False, 'import asyncio\n')] |
import sys
import os
import logging
sys.path.append(os.environ["PWD"])
from pyga import *
population_size = 10
elite_count = 2
crossover_points = 2
crossover_mutate_probability = 0.2
max_weight = 15
city_names = ['a', 'b', 'c', 'd']
distances = [
# a b c d
[ 0, 130, 180, 300], # a
[130, 0, 32... | [
"sys.path.append",
"logging.basicConfig"
] | [((37, 71), 'sys.path.append', 'sys.path.append', (["os.environ['PWD']"], {}), "(os.environ['PWD'])\n", (52, 71), False, 'import sys\n'), ((1272, 1312), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (1291, 1312), False, 'import logging\n')] |
""" Add a species to your database
usiing a log file
"""
import sys
import os
import autofile
import automol
from mechanalyzer.inf import thy as tinfo
from mechanalyzer.inf import rxn as rinfo
from mechanalyzer.inf import spc as sinfo
import elstruct
import autorun
from mechroutines.es._routines.conformer import _sav... | [
"automol.graph.set_stereo_from_geometry",
"automol.reac.Reaction",
"autofile.schema.generate_new_ring_id",
"elstruct.reader.energy",
"mechroutines.es._routines.conformer._fragment_ring_geo",
"automol.reac.relabel_for_zmatrix",
"automol.smiles.inchi",
"automol.graph.atom_keys",
"autofile.fs.species",... | [((4448, 4479), 'mechanalyzer.inf.spc.from_data', 'sinfo.from_data', (['ich', 'chg', 'mult'], {}), '(ich, chg, mult)\n', (4463, 4479), True, 'from mechanalyzer.inf import spc as sinfo\n'), ((6931, 6978), 'mechanalyzer.inf.rxn.sort', 'rinfo.sort', (['(ichs, rxn_chgs, rxn_muls, ts_mult)'], {}), '((ichs, rxn_chgs, rxn_mul... |
#!/bin/python
from deap import tools
import numpy as np
import os
statisticsNames = {'avg': 'Average profit',
'std': 'Profit variation',
'min': 'Minimum profit',
'max': 'Maximum profit',
'size': 'Population size',
'maxsize': ... | [
"deap.tools.Statistics",
"os.path.isfile",
"os.remove"
] | [((382, 433), 'deap.tools.Statistics', 'tools.Statistics', (['(lambda ind: ind.fitness.values[0])'], {}), '(lambda ind: ind.fitness.values[0])\n', (398, 433), False, 'from deap import tools\n'), ((1169, 1193), 'os.path.isfile', 'os.path.isfile', (['filename'], {}), '(filename)\n', (1183, 1193), False, 'import os\n'), (... |
#Callbacks
"""Create training callbacks"""
import os
import numpy as np
import pandas as pd
from datetime import datetime
from DeepTreeAttention.utils import metrics
from DeepTreeAttention.visualization import visualize
from tensorflow.keras.callbacks import ReduceLROnPlateau
from tensorflow.keras.callbacks import Ca... | [
"numpy.concatenate",
"numpy.argmax",
"tensorflow.keras.callbacks.ReduceLROnPlateau",
"DeepTreeAttention.utils.metrics.f1_scores",
"DeepTreeAttention.utils.metrics.site_confusion",
"DeepTreeAttention.utils.metrics.genus_confusion",
"DeepTreeAttention.visualization.visualize.plot_prediction",
"tensorflo... | [((7816, 7923), 'tensorflow.keras.callbacks.ReduceLROnPlateau', 'ReduceLROnPlateau', ([], {'monitor': '"""val_loss"""', 'factor': '(0.5)', 'patience': '(10)', 'min_delta': '(0.1)', 'min_lr': '(1e-05)', 'verbose': '(1)'}), "(monitor='val_loss', factor=0.5, patience=10, min_delta=\n 0.1, min_lr=1e-05, verbose=1)\n", (... |
import rtpipe.RT as rt
import rtpipe.parsecands as pc
import rtpipe.parsesdm as ps
import rtpipe.reproduce as reproduce
import click, os, glob
import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logging.captureWarnings(True)
logger = logging.getLogger(__... | [
"os.path.abspath",
"click.argument",
"logging.basicConfig",
"os.path.basename",
"rtpipe.RT.set_pipeline",
"rtpipe.reproduce.list_cands",
"rtpipe.reproduce.refine_cand",
"os.path.dirname",
"click.option",
"os.path.exists",
"logging.captureWarnings",
"rtpipe.parsesdm.read_scans",
"click.group"... | [((158, 265), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n", (177, 265), False, 'import logging\n'), ((261, 290), 'loggin... |
# Generated by Django 2.1.2 on 2018-12-16 13:01
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('vespene', '0008_auto_20181106_2233'),
]
operations = [
migrations.RemoveField(
model_name='workerpool',
name='sudo_password'... | [
"django.db.migrations.RemoveField"
] | [((227, 296), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""workerpool"""', 'name': '"""sudo_password"""'}), "(model_name='workerpool', name='sudo_password')\n", (249, 296), False, 'from django.db import migrations\n')] |
from unittest import TestCase
from unittest.mock import Mock, patch
from profile_generator import generator
from profile_generator.generator import (
ConfigFileReadError,
InvalidConfigFileError,
NoConfigFileError,
OutputDirCreationFailure,
ProfileWriteError,
TemplateFileReadError,
)
from profil... | [
"profile_generator.generator.get_config_files",
"profile_generator.schema.type_of",
"profile_generator.generator.create_output_dir",
"profile_generator.generator.create_profile_content",
"profile_generator.generator.persist_profile",
"unittest.mock.patch",
"profile_generator.generator.get_profile_templa... | [((410, 463), 'unittest.mock.patch', 'patch', (['"""sys.argv"""', "['app.py', 'one.json', 'two.json']"], {}), "('sys.argv', ['app.py', 'one.json', 'two.json'])\n", (415, 463), False, 'from unittest.mock import Mock, patch\n'), ((617, 646), 'unittest.mock.patch', 'patch', (['"""sys.argv"""', "['app.py']"], {}), "('sys.a... |
import logging
#store loggging file in ~/filename.log with encoding utf-8 and anything above log level logging DEBUG which is everything.
logging.basicConfig(filename="filename.log",encoding="utf-8",level = logging.DEBUG)
logging.debug()
logging.info()
logging,warning()
logging.error()
logging.critical()
# One logger... | [
"logging.error",
"logging.exception",
"logging.debug",
"logging.FileHandler",
"logging.basicConfig",
"logging.StreamHandler",
"logging.formatter",
"logging.info",
"logging.critical",
"logging.getLogger"
] | [((139, 227), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""filename.log"""', 'encoding': '"""utf-8"""', 'level': 'logging.DEBUG'}), "(filename='filename.log', encoding='utf-8', level=\n logging.DEBUG)\n", (158, 227), False, 'import logging\n'), ((223, 238), 'logging.debug', 'logging.debug', ([... |
from django.contrib.auth import authenticate
from django.contrib.auth import get_user_model
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from rest_framework.exceptions import AuthenticationFailed
from rest_framework_simplejwt.tokens import RefreshToken
User = get_user... | [
"django.utils.translation.gettext_lazy",
"django.contrib.auth.get_user_model",
"rest_framework_simplejwt.tokens.RefreshToken.for_user",
"rest_framework.serializers.CharField",
"django.contrib.auth.authenticate"
] | [((312, 328), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (326, 328), False, 'from django.contrib.auth import get_user_model\n'), ((438, 506), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(150)', 'min_length': '(6)', 'write_only': '(True)'}), '(max_... |
#!/usr/bin/env python
"""Remove embedded signalalign analyses from files"""
########################################################################
# File: remove_sa_analyses.py
# executable: remove_sa_analyses.py
#
# Author: <NAME>
# History: 02/06/19 Created
#########################################################... | [
"argparse.ArgumentParser",
"numpy.asarray",
"os.path.exists",
"signalalign.fast5.Fast5",
"os.path.join",
"py3helpers.utils.list_dir"
] | [((547, 582), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (561, 582), False, 'from argparse import ArgumentParser\n'), ((1720, 1741), 'os.path.exists', 'os.path.exists', (['fast5'], {}), '(fast5)\n', (1734, 1741), False, 'import os\n'), ((1794, 1817), 'signa... |
# 1
def max_elem(a):
max0 = a[0]
for elem in a:
if elem > max0:
max0 = elem
return max0
list0 = [2,3,4,5,6,7,1,2,3]
result = max_elem(list0)
print("#1 :",result) # return 7
# 2
list1 = [10,12,3,14,20,7,6,5]
list1.sort()
print("#2 :",list1[-1])
# 3
list2 = [3,5,9,7,... | [
"functools.reduce"
] | [((471, 489), 'functools.reduce', 'reduce', (['max', 'list3'], {}), '(max, list3)\n', (477, 489), False, 'from functools import reduce\n')] |
#!/usr/bin/env python
import orjson
from falcon import media
from app import wsgi
# custom JSON handler
JSONHandler = media.JSONHandler(dumps=orjson.dumps, loads=orjson.loads)
extra_handlers = {
"application/json": JSONHandler,
"application/json; charset=UTF-8": JSONHandler
}
wsgi.req_options.media_handlers.u... | [
"app.wsgi.resp_options.media_handlers.update",
"falcon.media.JSONHandler",
"app.wsgi.req_options.media_handlers.update"
] | [((120, 177), 'falcon.media.JSONHandler', 'media.JSONHandler', ([], {'dumps': 'orjson.dumps', 'loads': 'orjson.loads'}), '(dumps=orjson.dumps, loads=orjson.loads)\n', (137, 177), False, 'from falcon import media\n'), ((287, 341), 'app.wsgi.req_options.media_handlers.update', 'wsgi.req_options.media_handlers.update', ([... |
# -*- coding: utf-8 -*-
"""
This module
"""
import attr
import typing
from ..core.model import (
Property, Resource, Tag, GetAtt, TypeHint, TypeCheck,
)
from ..core.constant import AttrMeta
#--- Property declaration ---
@attr.s
class EnvironmentOptionSetting(Property):
"""
AWS Object Type = "AWS::Elast... | [
"attr.validators.instance_of"
] | [((1399, 1456), 'attr.validators.instance_of', 'attr.validators.instance_of', (['TypeCheck.intrinsic_str_type'], {}), '(TypeCheck.intrinsic_str_type)\n', (1426, 1456), False, 'import attr\n'), ((1775, 1832), 'attr.validators.instance_of', 'attr.validators.instance_of', (['TypeCheck.intrinsic_str_type'], {}), '(TypeChec... |
"""
Efficient serialization GPU arrays.
"""
import cupy
from .cuda import cuda_serialize, cuda_deserialize
class PatchedCudaArrayInterface:
"""This class do two things:
1) Makes sure that __cuda_array_interface__['strides']
behaves as specified in the protocol.
2) Makes sure that the cu... | [
"cupy.ndarray",
"cupy.array",
"cupy.asarray"
] | [((1298, 1322), 'cupy.array', 'cupy.array', (['x'], {'copy': '(True)'}), '(x, copy=True)\n', (1308, 1322), False, 'import cupy\n'), ((596, 611), 'cupy.ndarray', 'cupy.ndarray', (['(0)'], {}), '(0)\n', (608, 611), False, 'import cupy\n'), ((1677, 1696), 'cupy.asarray', 'cupy.asarray', (['frame'], {}), '(frame)\n', (1689... |
import autosar
ws = autosar.workspace("4.2.2")
components = ws.createPackage("ComponentTypes")
swc = components.createCompositionComponent("MyComposition")
print(swc.name)
| [
"autosar.workspace"
] | [((23, 49), 'autosar.workspace', 'autosar.workspace', (['"""4.2.2"""'], {}), "('4.2.2')\n", (40, 49), False, 'import autosar\n')] |
'''
Task
You are given a date. Your task is to find what the day is on that date.
Input Format
A single line of input containing the space separated month, day and year, respectively, in format.
Constraints
* 2000<year<3000
Output Format
Output the correct day in capital letters.
Sample Input
08 05 2015
Sampl... | [
"calendar.weekday"
] | [((653, 682), 'calendar.weekday', 'cal.weekday', (['n[2]', 'n[0]', 'n[1]'], {}), '(n[2], n[0], n[1])\n', (664, 682), True, 'import calendar as cal\n')] |
import os, json
import cmd
import asyncio
from fitbit import Fitbit
from flask import Flask, render_template, url_for, session, redirect
from authlib.integrations.flask_client import OAuth
from azure.keyvault.secrets import SecretClient
from azure.identity import DefaultAzureCredential
from azure.core.exceptions import... | [
"azure.eventhub.aio.EventHubProducerClient.from_connection_string",
"flask.Flask",
"json.dumps",
"flask.url_for",
"flask.render_template",
"fitbit.Fitbit",
"authlib.integrations.flask_client.OAuth",
"azure.identity.DefaultAzureCredential",
"asyncio.new_event_loop"
] | [((439, 454), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (444, 454), False, 'from flask import Flask, render_template, url_for, session, redirect\n'), ((524, 534), 'authlib.integrations.flask_client.OAuth', 'OAuth', (['app'], {}), '(app)\n', (529, 534), False, 'from authlib.integrations.flask_client im... |
"""Meteo-France generic test utils."""
from unittest.mock import patch
import pytest
@pytest.fixture(autouse=True)
def patch_requests():
"""Stub out services that makes requests."""
patch_client = patch("homeassistant.components.meteo_france.meteofranceClient")
patch_weather_alert = patch(
"homea... | [
"unittest.mock.patch",
"pytest.fixture"
] | [((89, 117), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (103, 117), False, 'import pytest\n'), ((208, 272), 'unittest.mock.patch', 'patch', (['"""homeassistant.components.meteo_france.meteofranceClient"""'], {}), "('homeassistant.components.meteo_france.meteofranceClient')\n", ... |
import os
from contextlib import contextmanager
from pyspark.sql import SparkSession
from .log import logger
@contextmanager
def spark_session(config=None):
pre_spark = SparkSession.builder \
.appName('science-papers-ml') \
.master(f"spark://{os.environ.get('SPARK_MASTER_HOST', 'spark-master')}:... | [
"os.environ.get",
"pyspark.sql.SparkSession.builder.appName"
] | [((177, 226), 'pyspark.sql.SparkSession.builder.appName', 'SparkSession.builder.appName', (['"""science-papers-ml"""'], {}), "('science-papers-ml')\n", (205, 226), False, 'from pyspark.sql import SparkSession\n'), ((267, 318), 'os.environ.get', 'os.environ.get', (['"""SPARK_MASTER_HOST"""', '"""spark-master"""'], {}), ... |