code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from __future__ import division
from __future__ import print_function
from pathlib import Path
import sys
project_path = Path(__file__).resolve().parents[1]
sys.path.append(str(project_path))
from keras.layers import Dense, Activation, Dropout
from keras.models import Model, Sequential
from keras.regularize... | [
"tensorflow.random.set_seed",
"sklearn.preprocessing.normalize",
"numpy.random.seed",
"pathlib.Path"
] | [((623, 643), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (637, 643), True, 'import numpy as np\n'), ((645, 669), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['seed'], {}), '(seed)\n', (663, 669), True, 'import tensorflow as tf\n'), ((1912, 1935), 'sklearn.preprocessing.normalize', 'norm... |
import io
import zlib
import numpy as np
def maybe_compress(str, compress):
return zlib.compress(str) if compress else str
def maybe_decompress(str, decompress):
return zlib.decompress(str) if decompress else str
def serialize_numpy(arr: np.ndarray, compress: bool = False) -> str:
"""Serializes numpy... | [
"io.BytesIO",
"zlib.compress",
"numpy.save",
"numpy.load",
"zlib.decompress"
] | [((616, 628), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (626, 628), False, 'import io\n'), ((672, 689), 'numpy.save', 'np.save', (['buf', 'arr'], {}), '(buf, arr)\n', (679, 689), True, 'import numpy as np\n'), ((1232, 1247), 'io.BytesIO', 'io.BytesIO', (['str'], {}), '(str)\n', (1242, 1247), False, 'import io\n'), ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import xml.etree.ElementTree as ET
tree = ET.parse(sys.argv[1])
old_doc = tree.getroot()
tree = ET.parse(sys.argv[2])
new_doc = tree.getroot()
f = file(sys.argv[3], "wb")
tab = 0
old_classes = {}
def write_string(_f, text, newline=True):
for t in rang... | [
"xml.etree.ElementTree.parse"
] | [((102, 123), 'xml.etree.ElementTree.parse', 'ET.parse', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (110, 123), True, 'import xml.etree.ElementTree as ET\n'), ((157, 178), 'xml.etree.ElementTree.parse', 'ET.parse', (['sys.argv[2]'], {}), '(sys.argv[2])\n', (165, 178), True, 'import xml.etree.ElementTree as ET\n')] |
import click
from .definition_group.apply import apply
from .definition_group.diff import diff
from .definition_group.generate import generate
from .definition_group.create import create
# from .definition_group.lint import lint
@click.group(short_help="Manage API definition configuration")
@click.pass_context
def d... | [
"click.group"
] | [((233, 294), 'click.group', 'click.group', ([], {'short_help': '"""Manage API definition configuration"""'}), "(short_help='Manage API definition configuration')\n", (244, 294), False, 'import click\n')] |
from linkedlist import LinkedList
from node import Node
class IRes:
def __init__(self, result, node):
self.result = result
self.node = node
def print_nodes(n):
while(n != None):
print(n.data)
n = n.next
def tail_and_size(n):
ctr = 0
while n.next:
ctr += 1
... | [
"node.Node"
] | [((1066, 1073), 'node.Node', 'Node', (['(1)'], {}), '(1)\n', (1070, 1073), False, 'from node import Node\n'), ((1082, 1089), 'node.Node', 'Node', (['(2)'], {}), '(2)\n', (1086, 1089), False, 'from node import Node\n'), ((1098, 1105), 'node.Node', 'Node', (['(7)'], {}), '(7)\n', (1102, 1105), False, 'from node import No... |
from flask import jsonify, request, g, url_for, current_app
from app_core import db
from app_core.api import api
from app_core.api.decorators import permission_required
from app_core.models import Post, Permission, Comment
@api.route('/comments/')
def get_comments():
page = request.args.get('page', 1, type=int)
... | [
"app_core.models.Comment.from_json",
"flask.request.args.get",
"app_core.db.session.commit",
"app_core.api.decorators.permission_required",
"app_core.models.Comment.timestamp.asc",
"app_core.models.Post.query.get_or_404",
"flask.url_for",
"app_core.models.Comment.timestamp.desc",
"app_core.db.sessio... | [((227, 250), 'app_core.api.api.route', 'api.route', (['"""/comments/"""'], {}), "('/comments/')\n", (236, 250), False, 'from app_core.api import api\n'), ((907, 946), 'app_core.api.api.route', 'api.route', (['"""/comments/<int:comment_id>"""'], {}), "('/comments/<int:comment_id>')\n", (916, 946), False, 'from app_core... |
#!/usr/bin/env python
"""
File Description: File used for definition of State Class.
"""
# ****************************************** Libraries to be imported ****************************************** #
from copy import deepcopy
# ****************************************** Class Declaration Start *****... | [
"copy.deepcopy"
] | [((1924, 1938), 'copy.deepcopy', 'deepcopy', (['self'], {}), '(self)\n', (1932, 1938), False, 'from copy import deepcopy\n')] |
from ckantoolkit import get_or_bust, side_effect_free, ObjectNotFound
from ckanext.scheming.helpers import (
scheming_dataset_schemas, scheming_get_dataset_schema,
scheming_group_schemas, scheming_get_group_schema,
scheming_organization_schemas, scheming_get_organization_schema,
)
@side_effect_free
d... | [
"ckanext.scheming.helpers.scheming_get_group_schema",
"ckanext.scheming.helpers.scheming_get_organization_schema",
"ckanext.scheming.helpers.scheming_group_schemas",
"ckanext.scheming.helpers.scheming_get_dataset_schema",
"ckanext.scheming.helpers.scheming_organization_schemas",
"ckantoolkit.get_or_bust",... | [((750, 780), 'ckantoolkit.get_or_bust', 'get_or_bust', (['data_dict', '"""type"""'], {}), "(data_dict, 'type')\n", (761, 780), False, 'from ckantoolkit import get_or_bust, side_effect_free, ObjectNotFound\n'), ((836, 876), 'ckanext.scheming.helpers.scheming_get_dataset_schema', 'scheming_get_dataset_schema', (['t', 'e... |
import os
import sys
import jinja2
import yaml
with open(".information.yml") as fp:
information = yaml.safe_load(fp)
loader = jinja2.FileSystemLoader(searchpath="")
environment = jinja2.Environment(loader=loader, keep_trailing_newline=True)
template = environment.get_template(sys.argv[1])
result = template.rend... | [
"yaml.safe_load",
"jinja2.FileSystemLoader",
"jinja2.Environment"
] | [((133, 171), 'jinja2.FileSystemLoader', 'jinja2.FileSystemLoader', ([], {'searchpath': '""""""'}), "(searchpath='')\n", (156, 171), False, 'import jinja2\n'), ((186, 247), 'jinja2.Environment', 'jinja2.Environment', ([], {'loader': 'loader', 'keep_trailing_newline': '(True)'}), '(loader=loader, keep_trailing_newline=T... |
# Generated by Django 3.2.9 on 2021-11-27 12:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('notice', '0002_auto_20211127_0236'),
]
operations = [
migrations.AlterField(
model_name='event',
name='priority',
... | [
"django.db.models.IntegerField"
] | [((336, 472), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'choices': "[(1, 'Низкий приоритет'), (2, 'Средний приоритет'), (3, 'Высокий приоритет')]", 'verbose_name': '"""Приоритет"""'}), "(choices=[(1, 'Низкий приоритет'), (2,\n 'Средний приоритет'), (3, 'Высокий приоритет')], verbose_name='Приорит... |
import math
import re
from data_extraction.scraper import Scraper
class SozialeinsatzScraper(Scraper):
"""Scrapes the website www.sozialeinsatz.de."""
base_url = 'https://www.sozialeinsatz.de'
debug = True
def parse(self, response, url):
"""Handles the soupified response of a detail page in... | [
"re.findall",
"math.ceil",
"time.sleep",
"re.compile"
] | [((5119, 5141), 'time.sleep', 'time.sleep', (['self.delay'], {}), '(self.delay)\n', (5129, 5141), False, 'import time\n'), ((4049, 4074), 'math.ceil', 'math.ceil', (['(entries / 25.0)'], {}), '(entries / 25.0)\n', (4058, 4074), False, 'import math\n'), ((956, 980), 're.compile', 're.compile', (['"""Aufgaben.*"""'], {})... |
# encoding: utf8
import numpy as np
import pandas as pd
from collections import OrderedDict
from senti_analysis import config
from senti_analysis import constants
from senti_analysis.preprocess import (load_tokenizer, load_sentences,
encode_sentence, label_transform)
def load_... | [
"senti_analysis.preprocess.load_sentences",
"collections.OrderedDict",
"senti_analysis.preprocess.encode_sentence",
"pandas.read_csv",
"senti_analysis.preprocess.label_transform",
"senti_analysis.preprocess.load_tokenizer"
] | [((452, 486), 'pandas.read_csv', 'pd.read_csv', (['config.TRAIN_SET_PATH'], {}), '(config.TRAIN_SET_PATH)\n', (463, 486), True, 'import pandas as pd\n'), ((513, 552), 'pandas.read_csv', 'pd.read_csv', (['config.VALIDATION_SET_PATH'], {}), '(config.VALIDATION_SET_PATH)\n', (524, 552), True, 'import pandas as pd\n'), ((5... |
from django.conf import settings
from django.urls import include, path, re_path
from django.contrib import admin
from ariadne_django.views import GraphQLView
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls
from p... | [
"django.urls.include",
"django.conf.urls.static.static",
"django.contrib.staticfiles.urls.staticfiles_urlpatterns",
"ariadne_django.views.GraphQLView.as_view",
"django.urls.path"
] | [((461, 499), 'django.urls.path', 'path', (['"""django-admin/"""', 'admin.site.urls'], {}), "('django-admin/', admin.site.urls)\n", (465, 499), False, 'from django.urls import include, path, re_path\n'), ((882, 907), 'django.contrib.staticfiles.urls.staticfiles_urlpatterns', 'staticfiles_urlpatterns', ([], {}), '()\n',... |
from io import open
from typing import List
from pyknp import KNP, BList
def read_knp_result_file(filename: str) -> List[BList]:
"""Read a KNP result file.
Args:
filename: A filename.
Returns:
A list of :class:`pyknp.knp.blist.BList` objects.
"""
knp = KNP()
blists = []
... | [
"pyknp.KNP",
"io.open"
] | [((294, 299), 'pyknp.KNP', 'KNP', ([], {}), '()\n', (297, 299), False, 'from pyknp import KNP, BList\n'), ((325, 381), 'io.open', 'open', (['filename', '"""rt"""'], {'encoding': '"""utf-8"""', 'errors': '"""replace"""'}), "(filename, 'rt', encoding='utf-8', errors='replace')\n", (329, 381), False, 'from io import open\... |
from cv2 import fastNlMeansDenoisingColored
from cv2 import cvtColor
from cv2 import bitwise_not,threshold,getRotationMatrix2D
from cv2 import warpAffine,filter2D,imread
from cv2 import THRESH_BINARY,COLOR_BGR2GRAY,THRESH_OTSU
from cv2 import INTER_CUBIC,BORDER_REPLICATE,minAreaRect
from numpy import column_stack,array... | [
"matplotlib.pyplot.imshow",
"cv2.warpAffine",
"cv2.getRotationMatrix2D",
"matplotlib.pyplot.xticks",
"cv2.fastNlMeansDenoisingColored",
"cv2.threshold",
"numpy.where",
"cv2.filter2D",
"cv2.minAreaRect",
"numpy.array",
"matplotlib.pyplot.yticks",
"cv2.cvtColor",
"pytesseract.image_to_string",... | [((576, 631), 'cv2.fastNlMeansDenoisingColored', 'fastNlMeansDenoisingColored', (['image', 'None', '(20)', '(10)', '(7)', '(21)'], {}), '(image, None, 20, 10, 7, 21)\n', (603, 631), False, 'from cv2 import fastNlMeansDenoisingColored\n'), ((804, 835), 'cv2.cvtColor', 'cvtColor', (['image', 'COLOR_BGR2GRAY'], {}), '(ima... |
from test.base import BaseTestCase, user_payload
import json
class TestAuth(BaseTestCase):
def test_authenticate(self):
response = self.client.post('/auth', data=json.dumps(user_payload), content_type='application/json')
response_data = json.loads(response.data)
self.assert200(response)
self.assertEqual(re... | [
"json.loads",
"json.dumps"
] | [((246, 271), 'json.loads', 'json.loads', (['response.data'], {}), '(response.data)\n', (256, 271), False, 'import json\n'), ((509, 534), 'json.loads', 'json.loads', (['response.data'], {}), '(response.data)\n', (519, 534), False, 'import json\n'), ((169, 193), 'json.dumps', 'json.dumps', (['user_payload'], {}), '(user... |
import os
import fnmatch
from pathlib import Path
from jinja2 import Template
from .Metadata import Metadata
class JSGenerator:
def __init__(self, j):
"""
"""
self._j = j
self._generated = False
def _check_process_file(self, path):
bname = os.path.basename(path)
... | [
"os.path.exists",
"os.makedirs",
"pathlib.Path",
"os.path.join",
"jinja2.Template",
"os.path.dirname",
"os.path.basename",
"fnmatch.filter",
"os.fspath"
] | [((293, 315), 'os.path.basename', 'os.path.basename', (['path'], {}), '(path)\n', (309, 315), False, 'import os\n'), ((1705, 1718), 'pathlib.Path', 'Path', (['rootDir'], {}), '(rootDir)\n', (1709, 1718), False, 'from pathlib import Path\n'), ((4442, 4460), 'jinja2.Template', 'Template', (['template'], {}), '(template)\... |
from collections import defaultdict
from typing import List, Tuple
from aocd import get_data, submit
DAY = 5
YEAR = 2021
def part1(data: str) -> str:
segments = read(data)
covered = defaultdict(int)
for segment in segments:
x1, y1, x2, y2 = segment
if x1 != x2 and y1 != y2:
c... | [
"collections.defaultdict",
"aocd.get_data",
"aocd.submit"
] | [((194, 210), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (205, 210), False, 'from collections import defaultdict\n'), ((741, 757), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (752, 757), False, 'from collections import defaultdict\n'), ((1835, 1863), 'aocd.get_data', 'ge... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | [
"re.compile"
] | [((1708, 2053), 're.compile', 're.compile', (['"""^ ([\\\\w.]*\\\\.)? # class name(s)\n (\\\\w+(?: \\\\[[^\\\\]]+\\\\])?) \\\\s* # thing name\n (?: \\\\(\\\\s*(.*)\\\\s*\\\\) # optional: arguments\n (?:\\\\s* -> \\\\s* (.*))? # return annotation\n ... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="parentopticon",
version="0.0.1",
author="<NAME>",
author_email="<EMAIL>",
description="A system for controlling kids access to computers.",
long_description=long_description,
long_description_content_type... | [
"setuptools.find_packages"
] | [((399, 425), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (423, 425), False, 'import setuptools\n')] |
import cv2
import numpy as np
import matplotlib.pyplot as plt
from findpoint import FindPoint
class LineDetector:
def __init__(self,img):
self.frame = None
self.leftx = None
self.rightx = None
# self.output = None
self.frame = 0
self.frame_list = []
self.fi... | [
"cv2.rectangle",
"numpy.dstack",
"numpy.mean",
"findpoint.FindPoint",
"numpy.argmax",
"numpy.max",
"numpy.array",
"cv2.circle"
] | [((330, 344), 'findpoint.FindPoint', 'FindPoint', (['img'], {}), '(img)\n', (339, 344), False, 'from findpoint import FindPoint\n'), ((444, 470), 'numpy.dstack', 'np.dstack', (['(img, img, img)'], {}), '((img, img, img))\n', (453, 470), True, 'import numpy as np\n'), ((629, 649), 'numpy.array', 'np.array', (['nonzero[0... |
from django.db import models
from django.db.models import Q
from django.utils import timezone
class BroadcastManager(models.Manager):
"""
Manager class to show only active broadcast messages
"""
def active(self):
"""Return only active messages"""
return super(BroadcastManager, self).f... | [
"django.utils.timezone.now",
"django.db.models.Q"
] | [((547, 565), 'django.db.models.Q', 'Q', ([], {'start_time': 'None'}), '(start_time=None)\n', (548, 565), False, 'from django.db.models import Q\n'), ((473, 487), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (485, 487), False, 'from django.utils import timezone\n'), ((529, 543), 'django.utils.timezone... |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | [
"proto.Field",
"proto.module",
"proto.MapField"
] | [((705, 874), 'proto.module', 'proto.module', ([], {'package': '"""google.cloud.gkehub.v1"""', 'manifest': "{'Membership', 'MembershipEndpoint', 'GkeCluster', 'KubernetesMetadata',\n 'MembershipState', 'Authority'}"}), "(package='google.cloud.gkehub.v1', manifest={'Membership',\n 'MembershipEndpoint', 'GkeCluster... |
# Units tests to directly cover both task wrapper modules -
# not possible with pytest parametrization
import pytest
import sys
from collections import defaultdict
from peeringdb import _tasks_sequential
TASKS_MODS = [_tasks_sequential]
# pre-async compat. import
if sys.version_info >= (3, 5):
from peeringdb imp... | [
"pytest.mark.parametrize",
"collections.defaultdict"
] | [((1459, 1507), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""tasks_mod"""', 'TASKS_MODS'], {}), "('tasks_mod', TASKS_MODS)\n", (1482, 1507), False, 'import pytest\n'), ((674, 691), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (685, 691), False, 'from collections import defaultdic... |
from user_portrait import SaveUserProfile
from action_profile_recall import save_inverted_table, SaveUserRecall
from movie_recall import SaveMovieRecall
from movie_portrait import save_topic_weights_normal, save_predata, save_textrank, save_cut_words, save_tfidf, \
save_topK_idf_textrank, save_topK_tfidf_textrank, ... | [
"stat_factor.save_movie_year_factor",
"action_similar_recall.SaveUserSimilarRecall",
"content_recall.Update",
"action_profile_recall.save_inverted_table",
"stat_factor.save_movie_hot_factor",
"movie_portrait.get_cv_idf_model",
"movie_recall.SaveMovieRecall",
"stat_factor.save_movie_score_factor",
"s... | [((750, 766), 'movie_portrait.save_cut_words', 'save_cut_words', ([], {}), '()\n', (764, 766), False, 'from movie_portrait import save_topic_weights_normal, save_predata, save_textrank, save_cut_words, save_tfidf, save_topK_idf_textrank, save_topK_tfidf_textrank, save_keyword_weights, save_topic_words, save_movie_profi... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
# pyre-strict
from typing import Union
import libcst
import libcst.matchers as m
from libcst import parse_expression
from libcst.codemod imp... | [
"libcst.parse_expression",
"libcst.matchers.Annotation",
"libcst.codemod.visitors.AddImportsVisitor.add_needed_import"
] | [((1654, 1732), 'libcst.codemod.visitors.AddImportsVisitor.add_needed_import', 'AddImportsVisitor.add_needed_import', (['self.context', '"""__future__"""', '"""annotations"""'], {}), "(self.context, '__future__', 'annotations')\n", (1689, 1732), False, 'from libcst.codemod.visitors import AddImportsVisitor\n'), ((1854,... |
from typing import Dict, Union
from nasa_fevo.Cache import Cache
from datetime import datetime
CACHE_EXPIRATION_TIMER_MINUTES = 10
# very simple in-memory cache
# meant for small # of items
class InMemoryCache(Cache):
def __init__(self):
self.store: Dict[str, object] = {}
def get(self, key: str) -> ... | [
"datetime.datetime.now"
] | [((839, 853), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (851, 853), False, 'from datetime import datetime\n')] |
# -------------------------------------------------------------------------------
# Name: sfp_psbdmp
# Purpose: Query psbdmp.cc for potentially hacked e-mail addresses.
#
# Author: <NAME> <<EMAIL>>
#
# Created: 21/11/2016
# Copyright: (c) <NAME>
# Licence: MIT
# -----------------------------... | [
"spiderfoot.SpiderFootEvent",
"json.loads",
"re.escape"
] | [((2120, 2146), 'json.loads', 'json.loads', (["res['content']"], {}), "(res['content'])\n", (2130, 2146), False, 'import json\n'), ((3020, 3076), 'spiderfoot.SpiderFootEvent', 'SpiderFootEvent', (['"""LEAKSITE_URL"""', 'n', 'self.__name__', 'event'], {}), "('LEAKSITE_URL', n, self.__name__, event)\n", (3035, 3076), Fal... |
import os
import re
import socket
from dotenv import load_dotenv
from dcr.scenario_utils.common_utils import execute_command_and_raise_on_error
from dcr.scenario_utils.models import get_vm_data_from_env
def test_agent_version():
stdout, _ = execute_command_and_raise_on_error(['waagent', '-version'], timeout=30)... | [
"socket.gethostbyname",
"os.listdir",
"os.environ.get",
"dcr.scenario_utils.models.get_vm_data_from_env",
"re.match",
"dotenv.load_dotenv",
"os.path.join",
"dcr.scenario_utils.common_utils.execute_command_and_raise_on_error"
] | [((249, 320), 'dcr.scenario_utils.common_utils.execute_command_and_raise_on_error', 'execute_command_and_raise_on_error', (["['waagent', '-version']"], {'timeout': '(30)'}), "(['waagent', '-version'], timeout=30)\n", (283, 320), False, 'from dcr.scenario_utils.common_utils import execute_command_and_raise_on_error\n'),... |
#!/usr/bin/env python3
#
# This file includes mainly a class "randomEpisode" that:
# - draws localization of vehicle
# - draws number of rocks
# - draws position of each rock
# - save in a json file
# Author: Michele
# Project: SmartLoader - Innovation
import json
import random
from ge... | [
"os.path.exists",
"random.uniform",
"geometry_msgs.msg.Vector3",
"os.getenv",
"json.dump",
"os.path.join",
"random.seed",
"geometry_msgs.msg.PoseStamped",
"src.Unity2RealWorld.euler_to_quaternion",
"random.randint",
"os.walk",
"os.remove"
] | [((501, 525), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (515, 525), False, 'import os\n'), ((658, 671), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (665, 671), False, 'import os\n'), ((798, 815), 'os.getenv', 'os.getenv', (['"""HOME"""'], {}), "('HOME')\n", (807, 815), False, 'import... |
#!/usr/bin/env python
# Copyright (c) 2009-2016 <NAME> <<EMAIL>>
#
# This module is free software. You can redistribute it and/or modify it under
# the terms of the MIT License, see the file COPYING included with this
# distribution.
from gimmemotifs.motif import pwmfile_to_motifs
def logo(args):
inputfile = ar... | [
"gimmemotifs.motif.pwmfile_to_motifs"
] | [((349, 377), 'gimmemotifs.motif.pwmfile_to_motifs', 'pwmfile_to_motifs', (['inputfile'], {}), '(inputfile)\n', (366, 377), False, 'from gimmemotifs.motif import pwmfile_to_motifs\n')] |
import numpy as np
from matplotlib import _api
from .axes_divider import make_axes_locatable, Size
from .mpl_axes import Axes
@_api.delete_parameter("3.3", "add_all")
def make_rgb_axes(ax, pad=0.01, axes_class=None, add_all=True, **kwargs):
"""
Parameters
----------
pad : float
Fraction of th... | [
"numpy.dstack",
"matplotlib._api.delete_parameter",
"numpy.zeros_like",
"matplotlib._api.deprecated"
] | [((130, 169), 'matplotlib._api.delete_parameter', '_api.delete_parameter', (['"""3.3"""', '"""add_all"""'], {}), "('3.3', 'add_all')\n", (151, 169), False, 'from matplotlib import _api\n'), ((1527, 1596), 'matplotlib._api.deprecated', '_api.deprecated', (['"""3.3"""'], {'alternative': '"""ax.imshow(np.dstack([r, g, b])... |
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
# The only required parameter for the ChatBot is a name. This can be anything you want.
chatbot = ChatBot("My First Chatbot")
# Training your ChatBot
conversation = [
"Hello",
"Hi there!",
"How are you doing?",
"I'm doing great.... | [
"chatterbot.ChatBot",
"chatterbot.trainers.ListTrainer"
] | [((173, 200), 'chatterbot.ChatBot', 'ChatBot', (['"""My First Chatbot"""'], {}), "('My First Chatbot')\n", (180, 200), False, 'from chatterbot import ChatBot\n'), ((404, 424), 'chatterbot.trainers.ListTrainer', 'ListTrainer', (['chatbot'], {}), '(chatbot)\n', (415, 424), False, 'from chatterbot.trainers import ListTrai... |
# -*- coding: utf-8 -*-
from functools import wraps
from flask import abort, jsonify
from flask_login import current_user
def admin_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if not current_user.active or not current_user.is_admin:
abort(403)
return f(*args, *... | [
"flask.abort",
"functools.wraps",
"flask.jsonify"
] | [((153, 161), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (158, 161), False, 'from functools import wraps\n'), ((387, 395), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (392, 395), False, 'from functools import wraps\n'), ((284, 294), 'flask.abort', 'abort', (['(403)'], {}), '(403)\n', (289, 294), False, 'fr... |
# Copyright 2015 Huawei Technologies Co.,LTD.
#
# 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 agree... | [
"magnum.conductor.handlers.common.cert_manager.create_client_files",
"requests.request"
] | [((1488, 1535), 'magnum.conductor.handlers.common.cert_manager.create_client_files', 'create_client_files', (['self.cluster', 'self.context'], {}), '(self.cluster, self.context)\n', (1507, 1535), False, 'from magnum.conductor.handlers.common.cert_manager import create_client_files\n'), ((1626, 1734), 'requests.request'... |
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import logging, os, sys
from pprint import pprint as pp
from secret.project import get_project
from secret.cli import prepare
def trollius_log(level=logging.CRITICAL):
os.environ['TROLLIUSDEBUG'] = "1" # more inform... | [
"logging.basicConfig",
"secret.project.get_project",
"boto3.session.Session",
"os.getenv",
"secret.storage.S3",
"secret.cli.prepare",
"boto3.set_stream_logger",
"secret.output.prettyprint",
"trollius.get_event_loop"
] | [((341, 373), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'level'}), '(level=level)\n', (360, 373), False, 'import logging, os, sys\n'), ((621, 647), 'secret.project.get_project', 'get_project', (['args.datafile'], {}), '(args.datafile)\n', (632, 647), False, 'from secret.project import get_project\n')... |
###
#Various nose tests. If you want to adapt this for your own use, be aware that the start/end block list has a very specific formatting.
###
import get_freebusy
import arrow
from operator import itemgetter
from pymongo import MongoClient
import secrets.admin_secrets
import secrets.client_secrets
MONGO_CLI... | [
"pymongo.MongoClient",
"get_freebusy.get_freebusy"
] | [((540, 569), 'pymongo.MongoClient', 'MongoClient', (['MONGO_CLIENT_URL'], {}), '(MONGO_CLIENT_URL)\n', (551, 569), False, 'from pymongo import MongoClient\n'), ((1359, 1404), 'get_freebusy.get_freebusy', 'get_freebusy.get_freebusy', (['ranges', 'start', 'end'], {}), '(ranges, start, end)\n', (1384, 1404), False, 'impo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of the SCICO package. Details of the copyright
# and user license can be found in the 'LICENSE.txt' file distributed
# with the package.
r"""
Regularized Abel Inversion
==========================
This example demonstrates a TV-regularized Abel inversio... | [
"scico.linop.abel.AbelProjector",
"scico.functional.L1Norm",
"scico.plot.subplots",
"scico.plot.matplotlib.colors.Normalize",
"numpy.random.normal",
"scico.examples.create_circular_phantom",
"scico.plot.imview",
"scico.linop.FiniteDifference",
"scico.optimize.admm.LinearSubproblemSolver",
"numpy.r... | [((748, 821), 'scico.examples.create_circular_phantom', 'create_circular_phantom', (['(N, N)', '[0.4 * N, 0.2 * N, 0.1 * N]', '[1, 0, 0.5]'], {}), '((N, N), [0.4 * N, 0.2 * N, 0.1 * N], [1, 0, 0.5])\n', (771, 821), False, 'from scico.examples import create_circular_phantom\n'), ((894, 919), 'scico.linop.abel.AbelProjec... |
from django.shortcuts import render
from .forms import RegistrationForm, UserUpdateForm, ProfileUpdateForm
from django.shortcuts import redirect
from .models import Profile
from django.contrib.auth.decorators import login_required
def registration(request):
if request.method == 'POST':
form = RegistrationForm(reque... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"django.contrib.auth.decorators.login_required"
] | [((544, 560), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {}), '()\n', (558, 560), False, 'from django.contrib.auth.decorators import login_required\n'), ((486, 540), 'django.shortcuts.render', 'render', (['request', '"""users/register.html"""', "{'form': form}"], {}), "(request, 'users/regi... |
import numpy as np
import scipy.stats as sp
from concept import Concept
def info_gain(prev_dist, new_dist):
return sp.entropy(prev_dist) - sp.entropy(new_dist)
def main():
attributes = range(10)
num_concepts = 5
concept_size = 4
concept_space = Concept(attributes, num_concepts, concept_size)
problem1 = [(1, 2,... | [
"scipy.stats.entropy",
"numpy.ones",
"concept.Concept"
] | [((253, 300), 'concept.Concept', 'Concept', (['attributes', 'num_concepts', 'concept_size'], {}), '(attributes, num_concepts, concept_size)\n', (260, 300), False, 'from concept import Concept\n'), ((117, 138), 'scipy.stats.entropy', 'sp.entropy', (['prev_dist'], {}), '(prev_dist)\n', (127, 138), True, 'import scipy.sta... |
import aiohttp
import discord
from discord.ext import commands
from discord.commands import Option, slash_command, SlashCommandGroup
import json
with open ('././config/guilds.json', 'r') as f:
data = json.load(f)
guilds = data['guilds']
with open ('././config/api.json', 'r') as f:
ApiData = json.load(f)
githubApi... | [
"aiohttp.ClientSession",
"discord.commands.Option",
"discord.ext.commands.slash_command",
"json.load",
"discord.Embed"
] | [((202, 214), 'json.load', 'json.load', (['f'], {}), '(f)\n', (211, 214), False, 'import json\n'), ((297, 309), 'json.load', 'json.load', (['f'], {}), '(f)\n', (306, 309), False, 'import json\n'), ((423, 501), 'discord.ext.commands.slash_command', 'commands.slash_command', ([], {'description': '"""Search any github use... |
# SPDX-License-Identifier: Apache-2.0
# Licensed to the Ed-Fi Alliance under one or more agreements.
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
# See the LICENSE and NOTICES files in the project root for more information.
from os import path
from sys import platform
from ed... | [
"edfi_lms_extractor_lib.csv_generation.write._normalized_directory_template"
] | [((949, 1019), 'edfi_lms_extractor_lib.csv_generation.write._normalized_directory_template', '_normalized_directory_template', (['OUTPUT_DIRECTORY', 'USERS_ROOT_DIRECTORY'], {}), '(OUTPUT_DIRECTORY, USERS_ROOT_DIRECTORY)\n', (979, 1019), False, 'from edfi_lms_extractor_lib.csv_generation.write import _normalized_direct... |
from random import shuffle
"""
Will search a list of integers for a value using a linear search algorithm.
Does not require a sorted list to be passed in.
Returns -1 if item is not found
Linear Search:
Best - O(1)
Worst - O(n)
Average - O(n)
Space Complexity - O(1)
"""
def search(data: list, value: int) -> int:
... | [
"random.shuffle"
] | [((544, 557), 'random.shuffle', 'shuffle', (['data'], {}), '(data)\n', (551, 557), False, 'from random import shuffle\n')] |
"""
The MIT License (MIT)
Copyright (c) 2017 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publi... | [
"utils.run"
] | [((2929, 3015), 'utils.run', 'utils.run', (['"""git"""', "['log', '--all', '-1', '--format=%cI']", 'self.__project.location'], {}), "('git', ['log', '--all', '-1', '--format=%cI'], self.__project.\n location)\n", (2938, 3015), False, 'import utils\n'), ((2415, 2544), 'utils.run', 'utils.run', (['"""git"""', "['log',... |
# -*- coding: utf-8 -*-
# %reset -f
"""
@author: <NAME>
"""
# Demonstration of MAEcce in PLS modeling
import matplotlib.figure as figure
import matplotlib.pyplot as plt
import numpy as np
from dcekit.validation import mae_cce
from sklearn import datasets
from sklearn.cross_decomposition import PLSRegressi... | [
"sklearn.datasets.make_regression",
"matplotlib.pyplot.hist",
"sklearn.cross_decomposition.PLSRegression",
"matplotlib.pyplot.ylabel",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.figure.figaspect",
"numpy.array",
"matplotlib.pyplot.... | [((719, 946), 'sklearn.datasets.make_regression', 'datasets.make_regression', ([], {'n_samples': '(number_of_training_samples + number_of_test_samples)', 'n_features': 'number_of_x_variables', 'n_informative': '(10)', 'noise': '(30)', 'random_state': '(number_of_training_samples + number_of_x_variables)'}), '(n_samples... |
#!/home/admica/python3/bin/python3
#Discord eve bot by admica
import asyncio, discord, time, threading, websocket, json
from discord.ext import commands
from discord.ext.commands import Bot
import aiohttp
import re
from queue import Queue
from datetime import timedelta
from datetime import datetime
import os, sys
impo... | [
"discord.Game",
"time.sleep",
"sys.exc_info",
"sys.exit",
"datetime.timedelta",
"os.walk",
"os.remove",
"os.path.exists",
"discord.ext.commands.Bot",
"asyncio.new_event_loop",
"asyncio.Queue",
"os.execv",
"os.mkdir",
"asyncio.sleep",
"random.randint",
"json.loads",
"pickle.load",
"... | [((151583, 151596), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (151593, 151596), False, 'import time\n'), ((1404, 1436), 're.sub', 're.sub', (['"""Light Missile"""', '"""LM"""', 's'], {}), "('Light Missile', 'LM', s)\n", (1410, 1436), False, 'import re\n'), ((1444, 1476), 're.sub', 're.sub', (['"""Heavy Missil... |
# -----------------------------------------------------------------------------
# Copyright (c) <NAME>. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------
"""Tests that -h ... | [
"subprocess.Popen",
"nose2.main"
] | [((18778, 18790), 'nose2.main', 'nose2.main', ([], {}), '()\n', (18788, 18790), False, 'import nose2\n'), ((11468, 11525), 'subprocess.Popen', 'Popen', (['help_command'], {'shell': '(True)', 'stdout': 'PIPE', 'stderr': 'PIPE'}), '(help_command, shell=True, stdout=PIPE, stderr=PIPE)\n', (11473, 11525), False, 'from subp... |
# coding=utf-8
# Copyright 2020 The Google Research 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 applicab... | [
"clustering_normalized_cuts.setup.set_mnist_params",
"absl.flags.adopt_module_key_flags",
"clustering_normalized_cuts.setup.seed_init",
"absl.app.run",
"clustering_normalized_cuts.cnc_net.run_net",
"collections.defaultdict",
"clustering_normalized_cuts.data_loader.get_data"
] | [((938, 973), 'absl.flags.adopt_module_key_flags', 'flags.adopt_module_key_flags', (['setup'], {}), '(setup)\n', (966, 973), False, 'from absl import flags\n'), ((1075, 1113), 'collections.defaultdict', 'collections.defaultdict', (['(lambda : None)'], {}), '(lambda : None)\n', (1098, 1113), False, 'import collections\n... |
#!/usr/bin/env python
import math, random, subprocess, time
sin=math.sin
commands=["/usr/bin/setterm","/usr/bin/xset"]
fname = ""
file = None
type = None
_test = ""
cmd = None
class SystemError(BaseException):
pass
for c in commands:
_test = subprocess.getoutput("setterm --blength 256")
if not _test:
... | [
"subprocess.getoutput",
"subprocess.run",
"time.sleep"
] | [((821, 923), 'subprocess.run', 'subprocess.run', (["(cmd, '--bfreq' if setterm else 'b', '400', '--blength' if setterm else '',\n '200')"], {}), "((cmd, '--bfreq' if setterm else 'b', '400', '--blength' if\n setterm else '', '200'))\n", (835, 923), False, 'import math, random, subprocess, time\n'), ((250, 295), ... |
import stomasimulator.geom.geom_utils as geom
class AttributeCalculator(object):
""" Abstraction for calculations performed on XPLT state data """
def __init__(self, prefix, reference_data, dimensionality, lambda_fn=None):
self.prefix = '' if prefix is None else prefix
self.reference_data = r... | [
"stomasimulator.geom.geom_utils.calculate_surface_area",
"stomasimulator.geom.geom_utils.calculate_polygon_area",
"stomasimulator.geom.geom_utils.calculate_volume_and_area"
] | [((4327, 4372), 'stomasimulator.geom.geom_utils.calculate_polygon_area', 'geom.calculate_polygon_area', (['updated_pore_pts'], {}), '(updated_pore_pts)\n', (4354, 4372), True, 'import stomasimulator.geom.geom_utils as geom\n'), ((4806, 4867), 'stomasimulator.geom.geom_utils.calculate_surface_area', 'geom.calculate_surf... |
# -*- coding: utf-8 -*-
'''
@author: <NAME>
May 2018
'''
# import code
# code.interact(local=locals())
import os
import pickle
# from fordclassifier.classifier.classifier import Classifier
import numpy as np
import pandas as pd
from sklearn.metrics import roc_curve, auc
import json
import matplot... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"sklearn.metrics.auc",
"numpy.ascontiguousarray",
"numpy.argsort",
"numpy.nanmean",
"sklearn.metrics.roc_curve",
"pandas.read_excel",
"operator.itemgetter",
"matplotlib.pyplot.imshow",
"numpy.mean",
"collections.OrderedDict.fromkeys",
"ma... | [((4723, 4784), 'os.path.join', 'os.path.join', (['self._project_path', 'self._subfolders[subfolder]'], {}), '(self._project_path, self._subfolders[subfolder])\n', (4735, 4784), False, 'import os\n'), ((14515, 14600), 'os.path.join', 'os.path.join', (["(self._project_path + self._subfolders['test_data'])", '"""test_dat... |
# %% Import
import numpy as np
import pandas as pd
import requests
import os
from bs4 import BeautifulSoup
"""
Takes a dictionary of relevant brands and their URLs and returns a raw csv file
"""
# %% Functions
def outlets_crawl(brand, url):
"""
Returns a raw, unformatted df of outlets with it's brand from t... | [
"requests.get",
"bs4.BeautifulSoup",
"os.path.isfile",
"pandas.DataFrame",
"os.system",
"pandas.concat",
"os.remove"
] | [((355, 372), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (367, 372), False, 'import requests\n'), ((384, 419), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page.content', '"""lxml"""'], {}), "(page.content, 'lxml')\n", (397, 419), False, 'from bs4 import BeautifulSoup\n'), ((962, 979), 'pandas.DataFrame', 'p... |
import docker, os, platform, requests, shutil, subprocess, sys
from .infrastructure import *
# Runs a command without displaying its output and returns the exit code
def _runSilent(command):
result = SubprocessUtils.capture(command, check=False)
return result.returncode
# Performs setup for Linux hosts
def _setupLi... | [
"os.makedirs",
"subprocess.run",
"os.path.join",
"requests.get",
"platform.system",
"docker.types.Mount"
] | [((3796, 3846), 'os.path.join', 'os.path.join', (["os.environ['SystemRoot']", '"""System32"""'], {}), "(os.environ['SystemRoot'], 'System32')\n", (3808, 3846), False, 'import docker, os, platform, requests, shutil, subprocess, sys\n'), ((2137, 2193), 'subprocess.run', 'subprocess.run', (["['sc.exe', 'stop', 'docker']"]... |
import sys
import time
from tia.trad.tools.io.follow import followMonitor
import tia.configuration as conf
from tia.trad.tools.errf import eReport
import ujson as json
import matplotlib.pyplot as plt
import math
import collections
import logging
from tia.trad.tools.ipc.processLogger import PROCESS_NAME
LOGGER_NAME = P... | [
"logging.getLogger",
"collections.deque",
"math.sqrt",
"matplotlib.pyplot.figure",
"math.fabs",
"ujson.loads",
"sys.exit",
"matplotlib.pyplot.ion",
"tia.trad.tools.errf.eReport",
"tia.trad.tools.io.follow.followMonitor"
] | [((368, 398), 'logging.getLogger', 'logging.getLogger', (['LOGGER_NAME'], {}), '(LOGGER_NAME)\n', (385, 398), False, 'import logging\n'), ((552, 584), 'math.sqrt', 'math.sqrt', (['(t[0] ** 2 + t[1] ** 2)'], {}), '(t[0] ** 2 + t[1] ** 2)\n', (561, 584), False, 'import math\n'), ((821, 859), 'math.fabs', 'math.fabs', (['... |
import re
from ..utils import Report, fetch
SITE = "fileinfo.com"
PATH = "/extension"
def extract(extension: str) -> list[Report]:
soup = fetch(site=SITE, path=PATH, extension=extension)
description_short = soup.find_all("h2")[0].text.strip()
infoboxes = soup.find_all(attrs={"class": "infoBox"})
de... | [
"re.sub"
] | [((381, 422), 're.sub', 're.sub', (['"""\\\\n+"""', '"""\n\n"""', 'infoboxes[1].text'], {}), "('\\\\n+', '\\n\\n', infoboxes[1].text)\n", (387, 422), False, 'import re\n')] |
from fastapi import APIRouter
from pydantic import BaseModel
from style.predict.servable.serve import get_servable
router = APIRouter()
class PredictionRequest(BaseModel):
text: str
model_name: str
@router.get("/")
async def index():
return {"success": True, "message": "Predictions Router is working!... | [
"fastapi.APIRouter",
"style.predict.servable.serve.get_servable"
] | [((127, 138), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (136, 138), False, 'from fastapi import APIRouter\n'), ((412, 444), 'style.predict.servable.serve.get_servable', 'get_servable', (['request.model_name'], {}), '(request.model_name)\n', (424, 444), False, 'from style.predict.servable.serve import get_serv... |
from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed()
ipshell()
| [
"IPython.Shell.IPShellEmbed"
] | [((50, 64), 'IPython.Shell.IPShellEmbed', 'IPShellEmbed', ([], {}), '()\n', (62, 64), False, 'from IPython.Shell import IPShellEmbed\n')] |
#!/usr/bin/python3
"""
(C) Copyright 2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
import time
from pool_test_base import PoolTestBase
from server_utils import ServerFailed
class PoolCreateTests(PoolTestBase):
# pylint: disable=too-many-ancestors,too-few-public-methods
"""Pool cre... | [
"time.time"
] | [((1573, 1584), 'time.time', 'time.time', ([], {}), '()\n', (1582, 1584), False, 'import time\n'), ((1743, 1754), 'time.time', 'time.time', ([], {}), '()\n', (1752, 1754), False, 'import time\n')] |
import subprocess
import sys
from collections import defaultdict
import pandas as pd
import networkx
import random
import functools
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from .model import Network, Link, Frame, Node
import io
if sys.platform == 'darwin':
matplo... | [
"networkx.draw_networkx_edge_labels",
"matplotlib.use",
"random.Random",
"networkx.spring_layout",
"networkx.draw_networkx_nodes",
"networkx.draw_networkx_labels",
"functools.partial",
"collections.defaultdict",
"io.StringIO",
"networkx.draw_networkx_edges",
"matplotlib.pyplot.subplots",
"matp... | [((314, 337), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (328, 337), False, 'import matplotlib\n'), ((871, 923), 'networkx.spring_layout', 'networkx.spring_layout', (['self._graph'], {'seed': '(0)', 'scale': '(3)'}), '(self._graph, seed=0, scale=3)\n', (893, 923), False, 'import networkx\... |
# Author: <NAME>
# this class handle the functions tests of controller of the component of the numerical features
import pytest
import sys
from PyQt5 import QtWidgets
from ui.mainTest import StaticObjects
@pytest.mark.parametrize('slider', [1, 2.9, False, ('t1', 't2'), None])
def test_CIR_setSlider_wrong_paramet... | [
"pytest.mark.parametrize",
"ui.mainTest.StaticObjects.staticCounterfactualInterfaceSlider3RangesView",
"pytest.raises",
"PyQt5.QtWidgets.QApplication"
] | [((213, 283), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""slider"""', "[1, 2.9, False, ('t1', 't2'), None]"], {}), "('slider', [1, 2.9, False, ('t1', 't2'), None])\n", (236, 283), False, 'import pytest\n'), ((786, 818), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.... |
#!/usr/bin/env python3
import argparse
import pathlib
GENERATED_EXTENSIONS = ["pb.go", "pb.gw.go", "swagger.json"]
def find_files(path, fileglob):
files_full = list(path.glob(fileglob))
return files_full
def strip_path_extension(filelist):
# We cannot use Path.stem directly as it doesn't handle doubl... | [
"argparse.ArgumentParser",
"pathlib.Path"
] | [((1195, 1220), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1218, 1220), False, 'import argparse\n'), ((492, 507), 'pathlib.Path', 'pathlib.Path', (['f'], {}), '(f)\n', (504, 507), False, 'import pathlib\n')] |
"""Define different helper functions."""
import datetime
import json
import re
import sys
import urllib.parse
from urllib.request import Request, urlopen
import icu
import markdown
from flask import current_app, g, make_response, render_template, request, url_for
from flask_babel import gettext
from . import static_... | [
"flask.render_template",
"markdown.markdown",
"json.loads",
"flask.current_app.open_resource",
"urllib.request.Request",
"re.match",
"icu.Locale",
"flask.g.mc_pool.reserve",
"flask.url_for",
"datetime.datetime.now",
"flask_babel.gettext",
"re.sub",
"flask.make_response",
"re.findall",
"u... | [((1504, 1567), 'urllib.request.Request', 'Request', (["('%s/%s' % (current_app.config['KARP_BACKEND'], action))"], {}), "('%s/%s' % (current_app.config['KARP_BACKEND'], action))\n", (1511, 1567), False, 'from urllib.request import Request, urlopen\n'), ((1692, 1733), 'flask.current_app.config.get', 'current_app.config... |
#!/usr/bin/env python3
# do not hesitate to debug
import pdb
# python computation modules and visualization
import numpy as np
import sympy as sy
import scipy as sp
import matplotlib.pyplot as plt
from sympy import Q as syQ
sy.init_printing(use_latex=True,forecolor="White")
def Lyapunov_stability_test_linear(ev):
... | [
"sympy.sin",
"numpy.sqrt",
"sympy.re",
"sympy.lambdify",
"sympy.Matrix",
"sympy.init_printing",
"sympy.symbols",
"numpy.linspace",
"sympy.solve",
"matplotlib.pyplot.subplots"
] | [((227, 278), 'sympy.init_printing', 'sy.init_printing', ([], {'use_latex': '(True)', 'forecolor': '"""White"""'}), "(use_latex=True, forecolor='White')\n", (243, 278), True, 'import sympy as sy\n'), ((4294, 4320), 'sympy.symbols', 'sy.symbols', (['"""t"""'], {'real': '(True)'}), "('t', real=True)\n", (4304, 4320), Tru... |
#coding=utf-8
import numpy as np
import tensorflow as tf
import os
import sys
import time
import shutil
import re
import signal
import subprocess
import numpy as np
import math
from Policy import *
np.set_printoptions(threshold=np.inf)
BASELINES = 1
class MultiBaseline:
def __init__(self, baseline_number):
... | [
"tensorflow.reduce_sum",
"math.cos",
"numpy.array",
"tensorflow.nn.softmax",
"numpy.mean",
"tensorflow.random_normal",
"tensorflow.Session",
"tensorflow.placeholder",
"tensorflow.assign",
"tensorflow.one_hot",
"tensorflow.add",
"tensorflow.train.GradientDescentOptimizer",
"shutil.copy",
"t... | [((199, 236), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (218, 236), True, 'import numpy as np\n'), ((2315, 2332), 'numpy.array', 'np.array', (['rewards'], {}), '(rewards)\n', (2323, 2332), True, 'import numpy as np\n'), ((3569, 3584), 'numpy.mean', 'np.mean'... |
import numpy as np
import os,sys,time
import torch
import torch.nn.functional as torch_F
import collections
from easydict import EasyDict as edict
import util
class Pose():
def __call__(self,R=None,t=None):
assert(R is not None or t is not None)
if R is None:
if not isinstance(t,torch... | [
"torch.ones_like",
"torch.eye",
"torch.stack",
"torch.tensor",
"torch.arange",
"torch.meshgrid",
"torch.linspace",
"torch.zeros_like",
"torch.zeros",
"torch.cat"
] | [((2286, 2305), 'torch.zeros_like', 'torch.zeros_like', (['a'], {}), '(a)\n', (2302, 2305), False, 'import torch\n'), ((2314, 2332), 'torch.ones_like', 'torch.ones_like', (['a'], {}), '(a)\n', (2329, 2332), False, 'import torch\n'), ((839, 875), 'torch.cat', 'torch.cat', (['[R, t[..., None]]'], {'dim': '(-1)'}), '([R, ... |
from __future__ import print_function
import time
import sys
import os
import shutil
import csv
import boto3
from awsglue.utils import getResolvedOptions
import pyspark
from pyspark.sql import SparkSession
from pyspark.ml import Pipeline
from pyspark.ml.feature import StringIndexer, VectorIndexer, OneHotEncoder, Vec... | [
"tarfile.open",
"pyspark.ml.Pipeline",
"zipfile.ZipFile",
"pyspark.ml.feature.StringIndexer",
"os.remove",
"mleap.pyspark.spark_support.SimpleSparkSerializer",
"boto3.resource",
"awsglue.utils.getResolvedOptions",
"pyspark.sql.SparkSession.builder.appName",
"shutil.rmtree",
"pyspark.ml.feature.V... | [((716, 868), 'awsglue.utils.getResolvedOptions', 'getResolvedOptions', (['sys.argv', "['s3_input_data_location', 's3_output_bucket', 's3_output_bucket_prefix',\n 's3_model_bucket', 's3_model_bucket_prefix']"], {}), "(sys.argv, ['s3_input_data_location', 's3_output_bucket',\n 's3_output_bucket_prefix', 's3_model_... |
from datetime import datetime
__author__ = 'aGn'
__copyright__ = "Copyright 2018, Planet Earth"
class Response(object):
"""Response Class"""
def __init__(self):
self.socket = None
@staticmethod
def publisher(
module, meta_data,
**kwargs
):
"""
Pack... | [
"datetime.datetime.now"
] | [((786, 800), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (798, 800), False, 'from datetime import datetime\n')] |
import mimetypes
import os
from pathlib import Path
def ignore_files(dir: str, files: list[str]):
"""
Returns a list of files to ignore.
To be used by shutil.copytree()
"""
return [f for f in files if Path(dir, f).is_file()]
def get_input_images(input_folder: Path, output_path: Path):
"""
... | [
"mimetypes.guess_type",
"os.walk",
"pathlib.Path"
] | [((579, 600), 'os.walk', 'os.walk', (['input_folder'], {}), '(input_folder)\n', (586, 600), False, 'import os\n'), ((653, 679), 'mimetypes.guess_type', 'mimetypes.guess_type', (['file'], {}), '(file)\n', (673, 679), False, 'import mimetypes\n'), ((224, 236), 'pathlib.Path', 'Path', (['dir', 'f'], {}), '(dir, f)\n', (22... |
from typing import List
from PySide2.QtGui import QVector3D
from nexus_constructor.common_attrs import SHAPE_GROUP_NAME, CommonAttrs
from nexus_constructor.model.component import Component
from nexus_constructor.model.geometry import OFFGeometryNoNexus
class SlitGeometry:
def __init__(self, component: Component... | [
"nexus_constructor.model.geometry.OFFGeometryNoNexus",
"PySide2.QtGui.QVector3D"
] | [((4267, 4330), 'nexus_constructor.model.geometry.OFFGeometryNoNexus', 'OFFGeometryNoNexus', (['self.vertices', 'self.faces', 'SHAPE_GROUP_NAME'], {}), '(self.vertices, self.faces, SHAPE_GROUP_NAME)\n', (4285, 4330), False, 'from nexus_constructor.model.geometry import OFFGeometryNoNexus\n'), ((2333, 2375), 'PySide2.Qt... |
# -*- coding: utf-8 -*-
#################################################################################
# Author : Webkul Software Pvt. Ltd. (<https://webkul.com/>)
# Copyright(c): 2015-Present Webkul Software Pvt. Ltd.
# License URL : https://store.webkul.com/license.html/
# All Rights Reserved.
#
#
#
# This pr... | [
"logging.getLogger",
"odoo.fields.Binary",
"odoo.fields.Float",
"odoo.fields.Html",
"odoo.fields.Many2one",
"odoo.api.onchange",
"odoo.fields.Integer",
"odoo.fields.Text",
"odoo.tools.translate._",
"odoo.fields.Char",
"odoo.fields.Boolean"
] | [((782, 809), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (799, 809), False, 'import logging\n'), ((1307, 1352), 'odoo.fields.Boolean', 'fields.Boolean', ([], {'string': '"""Auto Product Approve"""'}), "(string='Auto Product Approve')\n", (1321, 1352), False, 'from odoo import models, ... |
# -*- coding: utf-8 -*-
import sys
import os
import json
import http.client
import urllib
import time
sys.path.append("../")
from models.ApiInstance import ApiInstance
from utils.ConstantUtils import ConstantUtils
'''
NetworkingUtils is responsible for holding the external URLs and the default parameters
o... | [
"json.loads",
"models.ApiInstance.ApiInstance",
"time.sleep",
"utils.ConstantUtils.ConstantUtils",
"sys.path.append"
] | [((104, 126), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (119, 126), False, 'import sys\n'), ((527, 542), 'utils.ConstantUtils.ConstantUtils', 'ConstantUtils', ([], {}), '()\n', (540, 542), False, 'from utils.ConstantUtils import ConstantUtils\n'), ((2085, 2105), 'json.loads', 'json.loads',... |
import numpy as np
from scipy.special import factorial
from itertools import permutations, product
from pysat.solvers import Minisat22, Minicard
from pysat.pb import PBEnc
from clauses import build_clauses, build_max_min_clauses
from clauses import build_permutation_clauses
from clauses import build_cardinality_lits,... | [
"clauses.build_exclusivity_lits",
"pysat.solvers.Minicard",
"clauses.build_permutation_clauses",
"scipy.special.factorial",
"itertools.product",
"clauses.build_cardinality_lits",
"pysat.solvers.Minisat22",
"numpy.argsort",
"numpy.array",
"clauses.build_max_min_clauses",
"clauses.build_clauses",
... | [((5231, 5273), 'itertools.product', 'product', (['*[dice_solution[k] for k in keys]'], {}), '(*[dice_solution[k] for k in keys])\n', (5238, 5273), False, 'from itertools import permutations, product\n'), ((5738, 5884), 'clauses.build_clauses', 'build_clauses', (['d', 'dice_names', 'scores'], {'card_clauses': 'cardinal... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | [
"aiida.common.timezone.now",
"uuid.uuid4"
] | [((1700, 1714), 'aiida.common.timezone.now', 'timezone.now', ([], {}), '()\n', (1712, 1714), False, 'from aiida.common import timezone\n'), ((1734, 1748), 'aiida.common.timezone.now', 'timezone.now', ([], {}), '()\n', (1746, 1748), False, 'from aiida.common import timezone\n'), ((1970, 1984), 'aiida.common.timezone.now... |
import time
import unittest
from Data.parameters import Data
from SI.MAP.check_infrascore_with_download_functionality import SchoolInfra_scores
from SI.MAP.check_sc_map_clusterwise_records import test_school_map_schoollevel_records
from SI.MAP.click_on_anydistrict_and_download_csv import download_icon
from SI.MAP.clic... | [
"SI.MAP.check_infrascore_with_download_functionality.SchoolInfra_scores",
"SI.MAP.click_on_district_and_homeicon.district_home",
"SI.MAP.click_on_clusters_and_scores.cluster_btn_scores",
"SI.MAP.click_on_schools_and_scores.schools_btn_scores",
"SI.MAP.click_on_schools.click_schoolbutton",
"SI.MAP.click_on... | [((1084, 1093), 'reuse_func.GetData', 'GetData', ([], {}), '()\n', (1091, 1093), False, 'from reuse_func import GetData\n'), ((1238, 1251), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (1248, 1251), False, 'import time\n'), ((1318, 1331), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (1328, 1331), False, '... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 3 15:24:46 2020
@author: hamishgibbs
"""
import pandas as pd
import re
import numpy as np
#%%
ox = pd.read_csv('https://raw.githubusercontent.com/OxCGRT/covid-policy-tracker/master/data/OxCGRT_latest_withnotes.csv')
#%%
ox = ox[0:100]
#%%
ox.fil... | [
"pandas.DataFrame",
"re.findall",
"pandas.read_csv"
] | [((174, 300), 'pandas.read_csv', 'pd.read_csv', (['"""https://raw.githubusercontent.com/OxCGRT/covid-policy-tracker/master/data/OxCGRT_latest_withnotes.csv"""'], {}), "(\n 'https://raw.githubusercontent.com/OxCGRT/covid-policy-tracker/master/data/OxCGRT_latest_withnotes.csv'\n )\n", (185, 300), True, 'import pand... |
#!/usr/bin/env python3
"""
Implements a TF Model class by inheriting the Model base class.
@author: <NAME>
@version: 1.0
"""
from base.base_model import BaseModel
import tensorflow as tf
class MnistModel(BaseModel):
def __init__(self, config):
"""
Constructor to initialize the TF model class by ... | [
"tensorflow.random_normal",
"tensorflow.nn.relu",
"tensorflow.placeholder",
"tensorflow.train.Saver",
"tensorflow.train.GradientDescentOptimizer",
"tensorflow.argmax",
"tensorflow.clip_by_value",
"tensorflow.matmul",
"tensorflow.cast",
"tensorflow.log"
] | [((783, 806), 'tensorflow.placeholder', 'tf.placeholder', (['tf.bool'], {}), '(tf.bool)\n', (797, 806), True, 'import tensorflow as tf\n'), ((927, 966), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, 784]'], {}), '(tf.float32, [None, 784])\n', (941, 966), True, 'import tensorflow as tf\n'), ((1047,... |
try:
import pathlib
except ImportError as e:
try:
import pathlib2 as pathlib
except ImportError:
raise e
def name_to_asserted_group_path(name):
path = pathlib.PurePosixPath(name)
if path.is_absolute():
raise NotImplementedError(
"Absolute paths are currently not... | [
"pathlib2.PurePosixPath"
] | [((185, 212), 'pathlib2.PurePosixPath', 'pathlib.PurePosixPath', (['name'], {}), '(name)\n', (206, 212), True, 'import pathlib2 as pathlib\n'), ((654, 681), 'pathlib2.PurePosixPath', 'pathlib.PurePosixPath', (['name'], {}), '(name)\n', (675, 681), True, 'import pathlib2 as pathlib\n')] |
#!/usr/bin/env python
#
# import modules used here -- sys is a very standard one
from __future__ import print_function
import argparse
import csv
import logging
import zipfile
from collections import OrderedDict
from glob import glob
import os
import sys
import nibabel as nb
import json
import pandas as pd
import num... | [
"os.path.exists",
"collections.OrderedDict",
"pandas.read_csv",
"nibabel.load",
"zipfile.ZipFile",
"json.dumps",
"os.path.join",
"numpy.argmax",
"os.path.split",
"sys.stderr.write",
"sys.exit",
"pandas.DataFrame"
] | [((538, 564), 'os.path.split', 'os.path.split', (['sidecarJSON'], {}), '(sidecarJSON)\n', (551, 564), False, 'import os\n'), ((3938, 3951), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (3949, 3951), False, 'from collections import OrderedDict\n'), ((13537, 13563), 'pandas.DataFrame', 'pd.DataFrame', (['i... |
from .base import *
import os
import dj_database_url
ALLOWED_HOSTS = ['*']
DEBUG = False
MIDDLEWARE += [
'whitenoise.middleware.WhiteNoiseMiddleware'
]
INSTALLED_APPS = [
'whitenoise.runserver_nostatic',
] + INSTALLED_APPS
DATABASES = {
'default': dj_database_url.config()
}
EMAIL_USE_TLS = True
EM... | [
"dj_database_url.config",
"os.environ.get"
] | [((331, 359), 'os.environ.get', 'os.environ.get', (['"""EMAIL_HOST"""'], {}), "('EMAIL_HOST')\n", (345, 359), False, 'import os\n'), ((378, 411), 'os.environ.get', 'os.environ.get', (['"""EMAIL_HOST_USER"""'], {}), "('EMAIL_HOST_USER')\n", (392, 411), False, 'import os\n'), ((434, 471), 'os.environ.get', 'os.environ.ge... |
"""
>>> G = Graph(6)
>>> G.insert(0, 1, 3)
>>> G.insert(0, 2, 7)
>>> G.insert(0, 4, 8)
>>> G.insert(0, 5, 1)
>>> G.insert(1, 2, 2)
>>> G.insert(1, 4, 13)
>>> G.insert(2, 3, 15)
>>> G.insert(3, 5, 17)
>>> G.insert(4, 5, 9)
>>> G.dijkstra(0)[0]
[0, 3, 5, 20, 8, 1]
>>> G... | [
"heapq.heappop",
"collections.defaultdict"
] | [((843, 851), 'collections.defaultdict', 'dd', (['dict'], {}), '(dict)\n', (845, 851), True, 'from collections import defaultdict as dd\n'), ((948, 955), 'collections.defaultdict', 'dd', (['int'], {}), '(int)\n', (950, 955), True, 'from collections import defaultdict as dd\n'), ((1453, 1470), 'heapq.heappop', 'heapq.he... |
# Example of faking classes with a closure
import sys
class ClosureInstance:
def __init__(self, locals=None):
if locals is None:
locals = sys._getframe(1).f_locals
# Update instance dictionary with callables
self.__dict__.update((key,value) for key, value in locals.items()
... | [
"sys._getframe"
] | [((163, 179), 'sys._getframe', 'sys._getframe', (['(1)'], {}), '(1)\n', (176, 179), False, 'import sys\n')] |
'''
Utilities useful for datasets
'''
import os
from functools import partial
from urllib.request import urlretrieve
import requests
from tqdm import tqdm
from torch.utils.data.dataloader import DataLoader
from torch.utils.data.sampler import BatchSampler, RandomSampler, SequentialSampler
from data.sampler import Se... | [
"os.path.exists",
"requests.Session",
"os.makedirs",
"urllib.request.urlretrieve",
"os.path.dirname",
"functools.partial",
"os.path.basename"
] | [((1361, 1386), 'os.path.dirname', 'os.path.dirname', (['filepath'], {}), '(filepath)\n', (1376, 1386), False, 'import os\n'), ((1464, 1488), 'os.path.exists', 'os.path.exists', (['filepath'], {}), '(filepath)\n', (1478, 1488), False, 'import os\n'), ((1773, 1799), 'os.path.basename', 'os.path.basename', (['filepath'],... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
##===-----------------------------------------------------------------------------*- Python -*-===##
##
## S E R I A L B O X
##
## This file is distributed under terms of BSD license.
## See LICENSE.txt for more information.
##
##===-... | [
"numpy.allclose",
"numpy.random.rand",
"shutil.rmtree",
"os.path.realpath",
"time.time",
"serialbox.Savepoint",
"serialbox.Serializer"
] | [((1139, 1158), 'serialbox.Savepoint', 'ser.Savepoint', (['"""sp"""'], {}), "('sp')\n", (1152, 1158), True, 'import serialbox as ser\n'), ((1244, 1312), 'serialbox.Serializer', 'ser.Serializer', (['ser.OpenModeKind.Write', '"""./async"""', '"""Field"""', '"""Binary"""'], {}), "(ser.OpenModeKind.Write, './async', 'Field... |
from dataclasses import dataclass
from datetime import datetime, timedelta
import json
import os.path
from dateutil.parser import parse
import pytz
import redis
from redis.lock import LockError
import requests
from . import settings
from .logger import logger
UNCACHED_HEADERS = (
'Age',
'Cache-Control',
... | [
"dateutil.parser.parse",
"redis.Redis.from_url",
"json.loads",
"requests.head",
"datetime.datetime.now",
"json.load",
"datetime.timedelta"
] | [((2121, 2146), 'redis.Redis.from_url', 'redis.Redis.from_url', (['url'], {}), '(url)\n', (2141, 2146), False, 'import redis\n'), ((2337, 2354), 'json.loads', 'json.loads', (['value'], {}), '(value)\n', (2347, 2354), False, 'import json\n'), ((3051, 3096), 'datetime.timedelta', 'timedelta', ([], {'seconds': 'settings.M... |
'''
File: discretizer.py
Description: function definition
History:
Date Programmer SAR# - Description
---------- ---------- ----------------------------
Author: <NAME> 29Apr2016 - Created
'''
import numpy as np
from . import pinm as pinm
from stl import mesh
from mpl_toolkits import mplot3d
fro... | [
"mpl_toolkits.mplot3d.art3d.Poly3DCollection",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.draw",
"numpy.sqrt",
"matplotlib.pyplot.show",
"numpy.absolute",
"matplotlib.widgets.Button",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.axes",
"matplotlib.cm.ScalarMappable"... | [((522, 537), 'matplotlib.pyplot.figure', 'pyplot.figure', ([], {}), '()\n', (535, 537), False, 'from matplotlib import pyplot\n'), ((542, 576), 'matplotlib.pyplot.subplots_adjust', 'pyplot.subplots_adjust', ([], {'bottom': '(0.2)'}), '(bottom=0.2)\n', (564, 576), False, 'from matplotlib import pyplot\n'), ((588, 610),... |
from urllib.parse import parse_qs, urlencode, urlparse
from .. import settings
def normalize(request, url: str) -> str:
parts = urlparse(url)
url = f"{settings.BASE_URL}{parts.path}"
if "background" in parts.query:
background = parse_qs(parts.query)["background"][0]
else:
background =... | [
"urllib.parse.urlencode",
"urllib.parse.parse_qs",
"urllib.parse.urlparse"
] | [((135, 148), 'urllib.parse.urlparse', 'urlparse', (['url'], {}), '(url)\n', (143, 148), False, 'from urllib.parse import parse_qs, urlencode, urlparse\n'), ((410, 426), 'urllib.parse.urlencode', 'urlencode', (['query'], {}), '(query)\n', (419, 426), False, 'from urllib.parse import parse_qs, urlencode, urlparse\n'), (... |
from ...forms.checks import check_is_logged
from django.shortcuts import redirect
def no_login_required(view_function):
def exec_view_function(*args, **kwargs):
request = args[0]
if check_is_logged(request):
return redirect('/')
return view_function(*args, **kwargs) ... | [
"django.shortcuts.redirect"
] | [((255, 268), 'django.shortcuts.redirect', 'redirect', (['"""/"""'], {}), "('/')\n", (263, 268), False, 'from django.shortcuts import redirect\n')] |
from collections import defaultdict
from pathlib import Path
from typing import Dict, Iterable, List, Optional, Tuple, Union
import networkx as nx
import onnx
from . import graph_ir as g
from .onnx_attr import get_node_shape, node_attr_to_dict, node_to_shape
PathLike = Union[str, Path]
GraphT = onnx.GraphProto
NodeT... | [
"networkx.relabel_nodes",
"networkx.topological_sort",
"networkx.drawing.nx_agraph.to_agraph",
"pathlib.Path",
"onnx.checker.check_graph",
"networkx.DiGraph",
"collections.defaultdict",
"networkx.compose"
] | [((12461, 12497), 'networkx.relabel_nodes', 'nx.relabel_nodes', (['graph', 'single_node'], {}), '(graph, single_node)\n', (12477, 12497), True, 'import networkx as nx\n'), ((13407, 13423), 'networkx.drawing.nx_agraph.to_agraph', 'to_agraph', (['graph'], {}), '(graph)\n', (13416, 13423), False, 'from networkx.drawing.nx... |
import csv
import json
import matplotlib.pyplot as plt
import numpy as np
if __name__ == '__main__':
formats = ['png', 'pdf', 'svg', 'eps']
metrics = [
{'gmetric': 'groc', 'lmetric': 'lroc', 'metric': 'AUC'},
{'gmetric': 'gauc', 'lmetric': 'lauc', 'metric': 'PRAUC'},
]
datasets = [
... | [
"json.loads",
"numpy.median",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.figure",
"numpy.quantile",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.title",
"csv.reader",
"matpl... | [((2763, 2791), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 4.5)'}), '(figsize=(6, 4.5))\n', (2773, 2791), True, 'import matplotlib.pyplot as plt\n'), ((3977, 4019), 'matplotlib.pyplot.yticks', 'plt.yticks', (['[0.5, 0.6, 0.7, 0.8, 0.9, 1.0]'], {}), '([0.5, 0.6, 0.7, 0.8, 0.9, 1.0])\n', (3987, 4019)... |
# Copyright (c) 2020 StackHPC Ltd.
#
# 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 wr... | [
"ansible.errors.AnsibleFilterError",
"os.path.join"
] | [((1568, 1596), 'os.path.join', 'os.path.join', (['directory', 'key'], {}), '(directory, key)\n', (1580, 1596), False, 'import os\n'), ((848, 941), 'ansible.errors.AnsibleFilterError', 'errors.AnsibleFilterError', (['("Inventory hostname \'%s\' not in hostvars" % inventory_hostname)'], {}), '("Inventory hostname \'%s\'... |
#!/usr/bin/env python
from flask import Flask, request,Response
import logging
import os
import json
import cognitoHelper as cog
#logging config
logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s',level=logging.INFO,datefmt='%Y-%m-%d %H:%M:%S')
logger = logging.getLogger(__name__)
#globals
MODULE = "... | [
"logging.basicConfig",
"logging.getLogger",
"flask.request.args.get",
"cognitoHelper.create_client",
"flask.Flask",
"os.urandom",
"cognitoHelper.login",
"json.dumps",
"flask.request.cookies.get",
"cognitoHelper.decode_cognito_token"
] | [((146, 269), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(levelname)-8s %(message)s"""', 'level': 'logging.INFO', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(format='%(asctime)s %(levelname)-8s %(message)s', level\n =logging.INFO, datefmt='%Y-%m-%d %H:%M:%S')\n", (165, 269), False, ... |
#!/usr/bin/env python3
# Copyright (c) 2019 Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
"""This script checks for checker for unwanted TCP/UDP open ports."""
import os
import json
import logging
from enum import Enum
import mbl.open_ports_checker.connection as connect... | [
"logging.getLogger",
"mbl.open_ports_checker.connection.is_equal_port",
"mbl.open_ports_checker.netstatutils.netstat",
"mbl.open_ports_checker.connection.is_equal_executable",
"json.load"
] | [((797, 834), 'logging.getLogger', 'logging.getLogger', (['"""OpenPortsChecker"""'], {}), "('OpenPortsChecker')\n", (814, 834), False, 'import logging\n'), ((4284, 4297), 'mbl.open_ports_checker.netstatutils.netstat', 'nsu.netstat', ([], {}), '()\n', (4295, 4297), True, 'import mbl.open_ports_checker.netstatutils as ns... |
# Copyright (C) <NAME> 2019. All rights reserved.
import argparse
from kitti_odometry import KittiEvalOdom
parser = argparse.ArgumentParser(description='KITTI evaluation')
parser.add_argument('--result', type=str, required=True,
help="Result directory")
parser.add_argument('--align', type=str,
... | [
"kitti_odometry.KittiEvalOdom",
"argparse.ArgumentParser"
] | [((119, 174), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""KITTI evaluation"""'}), "(description='KITTI evaluation')\n", (142, 174), False, 'import argparse\n'), ((686, 701), 'kitti_odometry.KittiEvalOdom', 'KittiEvalOdom', ([], {}), '()\n', (699, 701), False, 'from kitti_odometry impo... |
import pygame
import random
import os
import time
import neat
import visualize
import pickle
import bcolors as b
pygame.font.init()
SCORE_MAX = [0, 0, 0]
WIN_WIDTH = 600
WIN_HEIGHT = 800
FLOOR = 730
STAT_FONT = pygame.font.SysFont("comicsans", 50)
END_FONT = pygame.font.SysFont("comicsans", 70)
DRAW_LINES = False
WI... | [
"pygame.quit",
"neat.StatisticsReporter",
"pygame.mask.from_surface",
"pygame.display.set_mode",
"neat.nn.FeedForwardNetwork.create",
"pygame.font.init",
"pygame.display.update",
"pygame.transform.flip",
"neat.StdOutReporter",
"random.randrange",
"os.path.dirname",
"pygame.time.Clock",
"neat... | [((113, 131), 'pygame.font.init', 'pygame.font.init', ([], {}), '()\n', (129, 131), False, 'import pygame\n'), ((213, 249), 'pygame.font.SysFont', 'pygame.font.SysFont', (['"""comicsans"""', '(50)'], {}), "('comicsans', 50)\n", (232, 249), False, 'import pygame\n'), ((261, 297), 'pygame.font.SysFont', 'pygame.font.SysF... |
import os
import pytest
from assertpy import assert_that
from ..models.granule import Granule
from ..models.granule_count import GranuleCount
from ..models.status import Status
from ..session import _get_url, get_session, get_session_maker
@pytest.mark.usefixtures("db_connection_secret")
def test_that_db_correctly_... | [
"assertpy.assert_that",
"pytest.mark.usefixtures"
] | [((245, 292), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""db_connection_secret"""'], {}), "('db_connection_secret')\n", (268, 292), False, 'import pytest\n'), ((680, 727), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""db_connection_secret"""'], {}), "('db_connection_secret')\n", (703, 727)... |
import numpy as np
import pytest
from arbol import aprint
from dexp.processing.utils.normalise import Normalise
from dexp.utils.backends import Backend
from dexp.utils.testing.testing import execute_both_backends
@execute_both_backends
@pytest.mark.parametrize(
"dexp_nuclei_background_data",
[dict(length_xy=... | [
"dexp.processing.utils.normalise.Normalise",
"arbol.aprint",
"dexp.utils.backends.Backend.get_xp_module"
] | [((548, 627), 'dexp.processing.utils.normalise.Normalise', 'Normalise', (['image'], {'low': '(-0.5)', 'high': '(1)', 'in_place': '(False)', 'clip': '(True)', 'dtype': 'np.float32'}), '(image, low=-0.5, high=1, in_place=False, clip=True, dtype=np.float32)\n', (557, 627), False, 'from dexp.processing.utils.normalise impo... |
# -*- coding: utf-8 -*-
import atexit
import os
import signal
import time
from flask_restful import Api
from actinia_core.testsuite import ActiniaTestCaseBase, URL_PREFIX
from actinia_core.core.common.config import global_config
from actinia_core.core.common.app import flask_app, flask_api
from actinia_statistic_plugin... | [
"actinia_statistic_plugin.endpoints.create_endpoints",
"os.kill",
"actinia_core.endpoints.create_endpoints",
"time.sleep",
"os.spawnl",
"actinia_core.core.common.config.global_config.read",
"atexit.register"
] | [((650, 676), 'actinia_core.endpoints.create_endpoints', 'create_actinia_endpoints', ([], {}), '()\n', (674, 676), True, 'from actinia_core.endpoints import create_endpoints as create_actinia_endpoints\n'), ((677, 704), 'actinia_statistic_plugin.endpoints.create_endpoints', 'create_endpoints', (['flask_api'], {}), '(fl... |
# -*- coding: utf-8 -*-
from importlib import import_module
def get_annotations_compiler_flag() -> int:
future = import_module("__future__")
assert future is not None
annotations = getattr(future, "annotations")
assert annotations is not None
compiler_flag = getattr(annotations, "compiler_flag")
... | [
"importlib.import_module"
] | [((120, 147), 'importlib.import_module', 'import_module', (['"""__future__"""'], {}), "('__future__')\n", (133, 147), False, 'from importlib import import_module\n')] |
#! /usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import hashlib
import json
import os
import subprocess
import sys
parser = argp... | [
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"json.dumps",
"os.path.join",
"os.path.realpath",
"os.path.isdir",
"os.mkdir",
"subprocess.call"
] | [((316, 380), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate an addon package"""'}), "(description='Generate an addon package')\n", (339, 380), False, 'import argparse\n'), ((785, 823), 'os.path.join', 'os.path.join', (['addons_path', '"""generated"""'], {}), "(addons_path, 'gen... |
import os
import sys
# import common package in parent directory
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
import mongodb_client
import news_topic_modeling_service_client
if __name__ == '__main__':
db = mongodb_client.get_db()
cursor = db['news'].find({})
count = 0
for ... | [
"mongodb_client.get_db",
"os.path.dirname",
"news_topic_modeling_service_client.classify"
] | [((241, 264), 'mongodb_client.get_db', 'mongodb_client.get_db', ([], {}), '()\n', (262, 264), False, 'import mongodb_client\n'), ((95, 120), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (110, 120), False, 'import os\n'), ((593, 649), 'news_topic_modeling_service_client.classify', 'news_topi... |