code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2020, constrict0r <<EMAIL>>
# GNU General Public License v3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt).
from ansible.module_utils.basic import AnsibleModule
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by':... | [
"ansible.module_utils.basic.AnsibleModule"
] | [((1237, 1303), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', ([], {'argument_spec': 'module_args', 'supports_check_mode': '(True)'}), '(argument_spec=module_args, supports_check_mode=True)\n', (1250, 1303), False, 'from ansible.module_utils.basic import AnsibleModule\n')] |
import requests
import re
from lxml import etree
import pandas as pd
import time
from tqdm import tqdm
import warnings
warnings.filterwarnings("ignore")
headers = {
"Host": "search.51job.com",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 S... | [
"requests.session",
"pandas.DataFrame",
"warnings.filterwarnings",
"time.sleep",
"lxml.etree.HTML",
"re.compile"
] | [((119, 152), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (142, 152), False, 'import warnings\n'), ((347, 365), 'requests.session', 'requests.session', ([], {}), '()\n', (363, 365), False, 'import requests\n'), ((613, 663), 're.compile', 're.compile', (['""""company_nam... |
import os
import shutil
from tempfile import gettempdir
CONVERT_DIR = os.path.join(gettempdir(), "convert")
LOCK_FILE = os.path.join(gettempdir(), "convert.lock")
INSTANCE_DIR = os.path.join(gettempdir(), "soffice")
class ConversionFailure(Exception):
# A failure related to the content or structure of the docume... | [
"shutil.rmtree",
"tempfile.gettempdir",
"os.makedirs"
] | [((84, 96), 'tempfile.gettempdir', 'gettempdir', ([], {}), '()\n', (94, 96), False, 'from tempfile import gettempdir\n'), ((134, 146), 'tempfile.gettempdir', 'gettempdir', ([], {}), '()\n', (144, 146), False, 'from tempfile import gettempdir\n'), ((192, 204), 'tempfile.gettempdir', 'gettempdir', ([], {}), '()\n', (202,... |
# -*- coding: utf-8 -*-
import unittest
from securetea.lib.antivirus.tools.file_gather import GatherFile
try:
# if python 3.x.x
from unittest.mock import patch
except ImportError: # python 2.x.x
from mock import patch
class TestGatherFile(unittest.TestCase):
"""
Test class for SecureTea AntiViru... | [
"mock.patch",
"securetea.lib.antivirus.tools.file_gather.GatherFile"
] | [((517, 575), 'mock.patch', 'patch', (['"""securetea.lib.antivirus.tools.file_gather.os.walk"""'], {}), "('securetea.lib.antivirus.tools.file_gather.os.walk')\n", (522, 575), False, 'from mock import patch\n'), ((498, 510), 'securetea.lib.antivirus.tools.file_gather.GatherFile', 'GatherFile', ([], {}), '()\n', (508, 51... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, 2015 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
"logging.getLogger"
] | [((696, 723), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (713, 723), False, 'import logging\n')] |
# Copyright 2019 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 a... | [
"os.getcwd"
] | [((810, 821), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (819, 821), False, 'import os\n')] |
"""
Denoise the input and reconstruct.
"""
from showcase_utils import *
from tbase.skeleton import Skeleton
from plotter import show_np_arrays
fs = tf.app.flags
fs.DEFINE_string('model', 'none', 'which model to use for the prediction, expected format is "model_name/run_id[ft]" [none]')
fs.DEFINE_integer('samples', 3, ... | [
"tbase.skeleton.to_global_batched"
] | [((3676, 3764), 'tbase.skeleton.to_global_batched', 'to_global_batched', (['pred_un'], {'override_trajectory': 'traj', 'override_root': 'targets[:, 0:3]'}), '(pred_un, override_trajectory=traj, override_root=targets[\n :, 0:3])\n', (3693, 3764), False, 'from tbase.skeleton import to_global_batched\n'), ((3842, 3921)... |
"""Utility methods for manipulating pandas DataFrames."""
# builtins
from typing import Dict
# 3d party/FOSS
import numpy as np
import pandas as pd
DEFAULT_INDEX = pd.Index(["pilot", "session", "run"])
def query(data: pd.DataFrame, query: Dict) -> pd.DataFrame:
"""Get unique rows from a df with a query."""
... | [
"pandas.Index"
] | [((167, 204), 'pandas.Index', 'pd.Index', (["['pilot', 'session', 'run']"], {}), "(['pilot', 'session', 'run'])\n", (175, 204), True, 'import pandas as pd\n')] |
'''
'''
import re
# from django
from django.db import models
from django.core import validators
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, UserManager
from django.conf import settings
class User(AbstractBaseUser, PermissionsMixin):
username = models.CharField('User name',
... | [
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.EmailField",
"django.db.models.DateTimeField",
"django.contrib.auth.models.UserManager",
"re.compile"
] | [((777, 817), 'django.db.models.EmailField', 'models.EmailField', (['"""E-mail"""'], {'unique': '(True)'}), "('E-mail', unique=True)\n", (794, 817), False, 'from django.db import models\n'), ((831, 883), 'django.db.models.CharField', 'models.CharField', (['"""Name"""'], {'max_length': '(100)', 'blank': '(True)'}), "('N... |
"""Dataset preprocessing scripts"""
def process_mim_gold_ner():
from pathlib import Path
import pandas as pd
from tqdm.auto import tqdm
import json
import re
from collections import defaultdict
conversion_dict = {
"O": "O",
"B-Person": "B-PER",
"I-Person": "I-PER",... | [
"pandas.DataFrame",
"io.BytesIO",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"json.dumps",
"pandas.read_json",
"collections.defaultdict",
"tqdm.auto.tqdm",
"pathlib.Path",
"pandas.DataFrame.from_records",
"re.sub",
"pandas.concat"
] | [((4317, 4337), 'pathlib.Path', 'Path', (['"""datasets/fdt"""'], {}), "('datasets/fdt')\n", (4321, 4337), False, 'from pathlib import Path\n'), ((6598, 6625), 'pathlib.Path', 'Path', (['"""datasets/wikiann_fo"""'], {}), "('datasets/wikiann_fo')\n", (6602, 6625), False, 'from pathlib import Path\n'), ((6705, 6736), 'pat... |
from flask import request
from flask_wtf import FlaskForm
from wtforms import IntegerField, StringField, SubmitField, TextAreaField, SelectField
from wtforms.validators import ValidationError, DataRequired, Length
from flask_babel import _, lazy_gettext as _l
from app.models import Equipment
class SearchForm(FlaskFor... | [
"wtforms.SubmitField",
"wtforms.validators.DataRequired",
"wtforms.SelectField",
"flask_babel.lazy_gettext"
] | [((387, 408), 'wtforms.SubmitField', 'SubmitField', (['"""Search"""'], {}), "('Search')\n", (398, 408), False, 'from wtforms import IntegerField, StringField, SubmitField, TextAreaField, SelectField\n'), ((533, 594), 'wtforms.SelectField', 'SelectField', ([], {'choices': '[]', 'coerce': 'int', 'label': '"""Choisir la s... |
# -*- coding: utf-8 -*-
# @Author : LG
import LG_flow
import LG_flow.functional as f
from LG_flow import Parameter
from collections import OrderedDict
class Module(object):
def __init__(self):
self._parameters = OrderedDict()
self._modules = OrderedDict()
self._buffers = OrderedDict()
... | [
"collections.OrderedDict",
"LG_flow.functional.linear",
"LG_flow.randn",
"LG_flow.zeros"
] | [((227, 240), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (238, 240), False, 'from collections import OrderedDict\n'), ((265, 278), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (276, 278), False, 'from collections import OrderedDict\n'), ((303, 316), 'collections.OrderedDict', 'OrderedDic... |
import platform
from PyQt5.QtGui import QStandardItem, QFont, QColor
from PyQt5.QtWidgets import QStyledItemDelegate
if platform.system() == 'Windows':
FONT_DIFF = 0
else:
FONT_DIFF = 2
class ItemDelegate(QStyledItemDelegate):
def __init__(self, window, parent_list):
super().__init__(parent_list)... | [
"platform.system",
"PyQt5.QtGui.QStandardItem",
"PyQt5.QtGui.QColor"
] | [((121, 138), 'platform.system', 'platform.system', ([], {}), '()\n', (136, 138), False, 'import platform\n'), ((1111, 1126), 'PyQt5.QtGui.QStandardItem', 'QStandardItem', ([], {}), '()\n', (1124, 1126), False, 'from PyQt5.QtGui import QStandardItem, QFont, QColor\n'), ((1632, 1647), 'PyQt5.QtGui.QStandardItem', 'QStan... |
import logging
from django.core.exceptions import PermissionDenied
from django.http.response import Http404
from rest_framework import exceptions
from rest_framework.response import Response
from rest_framework.views import set_rollback
logger = logging.getLogger(__name__)
def exception_handler(exc, context):
... | [
"rest_framework.exceptions.PermissionDenied",
"rest_framework.views.set_rollback",
"rest_framework.response.Response",
"rest_framework.exceptions.NotFound",
"logging.getLogger"
] | [((248, 275), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (265, 275), False, 'import logging\n'), ((1231, 1310), 'rest_framework.response.Response', 'Response', (["{'status': 500000, 'body': {'message': 'Unknown error.'}}"], {'status': '(500)'}), "({'status': 500000, 'body': {'message'... |
from datetime import date
import pytest
from regparser.history.versions import Version
from regparser.index import entry
from regparser.notice.citation import Citation
@pytest.mark.django_db
def test_iterator():
"""Versions should be correctly linearized"""
path = entry.Version("12", "1000")
v1 = Versio... | [
"regparser.notice.citation.Citation",
"datetime.date",
"regparser.index.entry.Version"
] | [((277, 304), 'regparser.index.entry.Version', 'entry.Version', (['"""12"""', '"""1000"""'], {}), "('12', '1000')\n", (290, 304), False, 'from regparser.index import entry\n'), ((330, 346), 'datetime.date', 'date', (['(2004)', '(4)', '(4)'], {}), '(2004, 4, 4)\n', (334, 346), False, 'from datetime import date\n'), ((34... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-04-07 01:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pfb_analysis', '0012_analysisscoremetadata'),
]
operations = [
migrations.A... | [
"django.db.models.CharField"
] | [((426, 883), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('CREATED', 'Created'), ('QUEUED', 'Queued'), ('IMPORTING',\n 'Importing Data'), ('BUILDING', 'Building Network Graph'), (\n 'CONNECTIVITY', 'Calculating Connectivity'), ('METRICS',\n 'Calculating Graph Metrics'), ('EXPORTING', ... |
#!/usr/bin/env python
import argparse
import requests
import configparser
try:
import simplejson as json
except ImportError:
import json
class Censys():
def __init__(self):
conffile = 'conf/exist.conf'
conf = configparser.SafeConfigParser()
conf.read(conffile)
self.__baseU... | [
"requests.get",
"argparse.ArgumentParser",
"configparser.SafeConfigParser",
"json.loads"
] | [((823, 967), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""This script get report from Censys.\n """', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), "(description=\n 'This script get report from Censys.\\n ', formatter_class=argparse.\n RawDescriptionHelpForm... |
"""Unit test for plot_functions.py
This Python module contains multiple unit test functions
to check if the plotting functions in plot_functions.py
return valid x and y axes 'handles'. For example in
plot_each_absolute_temperature(), if do_plot is set to False, we return
two dictionaries: one, a dictionary of <agency_... | [
"sys.path.append",
"unittest.main",
"pandas.DataFrame",
"DegreesOfClimateChange.grab_worldbank.grab_worldbank",
"warnings.simplefilter",
"DegreesOfClimateChange.plot_functions.plot_co2_against_temperature",
"DegreesOfClimateChange.grab_noaa.grab_noaa",
"DegreesOfClimateChange.grab_berkeley.grab_berkel... | [((966, 987), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (981, 987), False, 'import sys\n'), ((11677, 11692), 'unittest.main', 'unittest.main', ([], {}), '()\n', (11690, 11692), False, 'import unittest\n'), ((2611, 2637), 'DegreesOfClimateChange.grab_worldbank.grab_worldbank', 'grab_worldbank... |
# coding: utf-8
from unittest import mock
import pytest
from botocore.exceptions import ClientError
from freezegun import freeze_time
from dmutils.documents import (
generate_file_name, get_extension,
file_is_not_empty, file_is_empty, filter_empty_files,
file_is_less_than_5mb,
file_is_open_document_fo... | [
"dmutils.documents.get_signed_url",
"dmutils.documents.get_document_path",
"dmutils.documents.file_is_empty",
"dmutils.documents.degenerate_document_path_and_return_doc_name",
"pytest.mark.parametrize",
"dmutils.documents.sanitise_supplier_name",
"dmutils.documents.validate_documents",
"dmutils.docume... | [((17488, 17785), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""base_url,expected"""', "[('http://other', 'http://other/foo?after'), (None,\n 'http://example/foo?after'), ('https://other',\n 'https://other/foo?after'), ('https://other:1234',\n 'https://other:1234/foo?after'), ('https://other/agai... |
from distutils.core import setup
setup(name='oc_screenshots',
version='0.9',
description='OwnCloud Auto Screenshots Uploader',
author='<NAME>',
requires=['pyocclient', 'pyperclip', 'pync', 'watchdog'],
) | [
"distutils.core.setup"
] | [((34, 212), 'distutils.core.setup', 'setup', ([], {'name': '"""oc_screenshots"""', 'version': '"""0.9"""', 'description': '"""OwnCloud Auto Screenshots Uploader"""', 'author': '"""<NAME>"""', 'requires': "['pyocclient', 'pyperclip', 'pync', 'watchdog']"}), "(name='oc_screenshots', version='0.9', description=\n 'Own... |
"""Group (a.k.a Classroom) management."""
import base64
import csv
import io
import string
import api
from api import (
block_before_competition,
check_csrf,
PicoException,
rate_limit,
require_login,
require_teacher,
)
from bs4 import UnicodeDammit
from flask import jsonify
from flask_restplus ... | [
"api.cache.invalidate",
"api.email.send_email_invite",
"api.PicoException",
"marshmallow.fields.Email",
"api.group.create_group",
"flask.jsonify",
"api.group.elevate_team",
"csv.DictWriter",
"api.group.delete_group",
"api.team.get_team_information",
"marshmallow.ValidationError",
"api.user.get... | [((694, 745), 'flask_restplus.Namespace', 'Namespace', (['"""groups"""'], {'description': '"""Group management"""'}), "('groups', description='Group management')\n", (703, 745), False, 'from flask_restplus import Namespace, Resource\n'), ((1161, 1194), 'api.rate_limit', 'rate_limit', ([], {'limit': '(20)', 'duration': ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 11 11:10:55 2019
Turns data (in JSON format) into a pandas DataFrame. This allows
for easy reading, plotting, and writing of results.
This script takes either the single node or multinode results and turns
the results into a pandas DataFrame. A pandas DataFrame... | [
"json.load",
"logging.FileHandler",
"logging.basicConfig",
"numpy.concatenate",
"pandas.merge",
"logging.StreamHandler",
"logging.info",
"pandas.to_datetime",
"pandas.concat",
"logging.getLogger"
] | [((868, 895), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (885, 895), False, 'import logging\n'), ((1551, 1604), 'logging.info', 'logging.info', (['"""cheacking what "type" json_results is"""'], {}), '(\'cheacking what "type" json_results is\')\n', (1563, 1604), False, 'import logging\... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019 <NAME>
# wwdtm_winstreaks is relased under the terms of the Apache License 2.0
"""Calculate and display panelist win streaks from scores in the WWDTM
Stats database"""
from collections import OrderedDict
import json
import math
import os
from typing import List, Dict
import... | [
"json.load",
"numpy.sum",
"numpy.amin",
"numpy.median",
"numpy.std",
"numpy.amax",
"numpy.mean",
"collections.OrderedDict",
"os.getenv"
] | [((2118, 2131), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2129, 2131), False, 'from collections import OrderedDict\n'), ((1882, 1895), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1893, 1895), False, 'from collections import OrderedDict\n'), ((2192, 2210), 'numpy.amin', 'numpy.amin', ... |
import logging
from stix_shifter_utils.modules.base.stix_translation.base_query_translator import (
BaseQueryTranslator
)
from . import query_constructor
logger = logging.getLogger(__name__)
class QueryTranslator(BaseQueryTranslator):
def transform_antlr(self, data, antlr_parsing_object):
logger.i... | [
"logging.getLogger"
] | [((170, 197), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (187, 197), False, 'import logging\n')] |
from django.contrib import admin
from recipes import models
admin.site.register(models.Ingredient)
admin.site.register(models.Recipe)
| [
"django.contrib.admin.site.register"
] | [((61, 99), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Ingredient'], {}), '(models.Ingredient)\n', (80, 99), False, 'from django.contrib import admin\n'), ((100, 134), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Recipe'], {}), '(models.Recipe)\n', (119, 134), False... |
#!/usr/bin/env python
# Copyright 2015 The PDFium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import difflib
import sys
def main(argv):
if len(argv) != 3:
print('%s: invalid arguments'... | [
"sys.stdout.write",
"difflib.unified_diff"
] | [((538, 608), 'difflib.unified_diff', 'difflib.unified_diff', (['str1', 'str2'], {'fromfile': 'filename1', 'tofile': 'filename2'}), '(str1, str2, fromfile=filename1, tofile=filename2)\n', (558, 608), False, 'import difflib\n'), ((742, 764), 'sys.stdout.write', 'sys.stdout.write', (['diff'], {}), '(diff)\n', (758, 764),... |
#coding: utf-8
import os
import cv2
import numpy as np
from . import cvui
from ._cvpath import PYCHARMERS_OPENCV_VIDEO_DIR
from .editing import resize_aspect
from .video_image_handler import VideoCaptureCreate
from .windows import cv2key2chr
from ..utils.generic_utils import now_str
from ..utils.subprocess_utils impor... | [
"os.remove",
"cv2.VideoWriter_fourcc",
"cv2.destroyAllWindows",
"os.path.getsize",
"cv2.imwrite",
"numpy.zeros",
"cv2.imread",
"cv2.moveWindow",
"cv2.imshow",
"cv2.getWindowProperty",
"cv2.resize"
] | [((4835, 4901), 'numpy.zeros', 'np.zeros', ([], {'shape': '(monitor_height, monitor_width, 3)', 'dtype': 'np.uint8'}), '(shape=(monitor_height, monitor_width, 3), dtype=np.uint8)\n', (4843, 4901), True, 'import numpy as np\n'), ((5751, 5797), 'cv2.moveWindow', 'cv2.moveWindow', ([], {'winname': 'self.winname', 'x': '(0... |
from flask import Flask
from flask.ext.bcrypt import Bcrypt
from flask.ext.login import LoginManager
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
# password hashing
bcrypt = Bcrypt(app)
# manage logins
lm = LoginManager()
lm.init_app(app)
lm.login_view = 'login'
# SQL
app.config.from_object('c... | [
"flask.ext.sqlalchemy.SQLAlchemy",
"flask.Flask",
"flask.ext.bcrypt.Bcrypt",
"flask.ext.login.LoginManager"
] | [((153, 168), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (158, 168), False, 'from flask import Flask\n'), ((198, 209), 'flask.ext.bcrypt.Bcrypt', 'Bcrypt', (['app'], {}), '(app)\n', (204, 209), False, 'from flask.ext.bcrypt import Bcrypt\n'), ((232, 246), 'flask.ext.login.LoginManager', 'LoginManager',... |
""" Docker manager
The docker manager is responsible for communicating with the docker-
daemon and is a wrapper arround the docker module. It has methods
for creating docker networks, docker volumes, start containers
and retreive results from finisched containers
TODO the task folder is also created by this class. Th... | [
"docker.from_env",
"os.makedirs",
"os.path.exists",
"vantage6.common.docker_addons.pull_if_newer",
"time.sleep",
"os.environ.get",
"pathlib.Path",
"vantage6.node.util.logger_name",
"os.path.join",
"re.compile"
] | [((1282, 1303), 'vantage6.node.util.logger_name', 'logger_name', (['__name__'], {}), '(__name__)\n', (1293, 1303), False, 'from vantage6.node.util import logger_name\n'), ((2084, 2101), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (2099, 2101), False, 'import docker\n'), ((3741, 3765), 'os.path.exists', 'os.... |
#! /usr/bin/env python3
# coding: utf-8
from django.http import HttpResponse
from TestModel.models import Test
# 数据库操作
def testdb(request):
# insert 一个数据
test1 = Test(name='timilong')
test1.save()
return HttpResponse("<p>"+ "更新成功</p>")
"""
# 初始化
response = ""
response1 = ""
# 通过object... | [
"TestModel.models.Test",
"django.http.HttpResponse"
] | [((172, 193), 'TestModel.models.Test', 'Test', ([], {'name': '"""timilong"""'}), "(name='timilong')\n", (176, 193), False, 'from TestModel.models import Test\n'), ((222, 254), 'django.http.HttpResponse', 'HttpResponse', (["('<p>' + '更新成功</p>')"], {}), "('<p>' + '更新成功</p>')\n", (234, 254), False, 'from django.http impor... |
#!/usr/bin/env python
# Four spaces as indentation [no tabs]
from PDDL import PDDL_Parser
import pickle
def convert(list):
return tuple(i[0] for i in list)
class Constructor:
#-----------------------------------------------
# Construct
#-----------------------------------------------
def cons... | [
"pickle.dump",
"PDDL.PDDL_Parser",
"time.time"
] | [((2588, 2599), 'time.time', 'time.time', ([], {}), '()\n', (2597, 2599), False, 'import sys, time\n'), ((384, 397), 'PDDL.PDDL_Parser', 'PDDL_Parser', ([], {}), '()\n', (395, 397), False, 'from PDDL import PDDL_Parser\n'), ((3286, 3374), 'pickle.dump', 'pickle.dump', (['[transitions, initial_state]', 'handle'], {'prot... |
import packerlicious.post_processor as post_processor
class TestManifestPostProcessor(object):
def test_no_required_fields(self):
b = post_processor.Manifest()
b.to_dict()
| [
"packerlicious.post_processor.Manifest"
] | [((149, 174), 'packerlicious.post_processor.Manifest', 'post_processor.Manifest', ([], {}), '()\n', (172, 174), True, 'import packerlicious.post_processor as post_processor\n')] |
import os
from setuptools import find_packages, setup
VERSION = __import__('herald').__version__
def read_file(filename):
"""Read a file into a string"""
path = os.path.abspath(os.path.dirname(__file__))
filepath = os.path.join(path, filename)
try:
return open(filepath).read()
except IOE... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages"
] | [((231, 259), 'os.path.join', 'os.path.join', (['path', 'filename'], {}), '(path, filename)\n', (243, 259), False, 'import os\n'), ((189, 214), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (204, 214), False, 'import os\n'), ((838, 883), 'setuptools.find_packages', 'find_packages', ([], {'in... |
import os
from hacktools import common
from PIL import Image
def run(data):
infile = data + "extract_BMP/FDT/000.BIN"
outfile = data + "repack_BMP/FDT/000.BIN"
imgfiles = [data + "font_input.png", data + "font_input2.png"]
common.logMessage("Repacking FDT from", imgfiles[0], "...")
common.copyFil... | [
"hacktools.common.logError",
"PIL.Image.open",
"os.path.isfile",
"hacktools.common.copyFile",
"hacktools.common.Stream",
"hacktools.common.logMessage"
] | [((242, 301), 'hacktools.common.logMessage', 'common.logMessage', (['"""Repacking FDT from"""', 'imgfiles[0]', '"""..."""'], {}), "('Repacking FDT from', imgfiles[0], '...')\n", (259, 301), False, 'from hacktools import common\n'), ((306, 338), 'hacktools.common.copyFile', 'common.copyFile', (['infile', 'outfile'], {})... |
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from django.views import generic
from django.utils import timezone
from django.contrib.auth.decorators import login_required
import os.path
from django.http import Http404
# Create your v... | [
"django.shortcuts.render",
"django.http.Http404"
] | [((630, 660), 'django.shortcuts.render', 'render', (['request', 'template_path'], {}), '(request, template_path)\n', (636, 660), False, 'from django.shortcuts import get_object_or_404, render\n'), ((685, 735), 'django.http.Http404', 'Http404', (['"""no static site matches the given query."""'], {}), "('no static site m... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 Klimaat
from __future__ import division
import datetime
import numpy as np
import matplotlib.pyplot as plt
def join_date(y=1970, m=1, d=1, hh=0, mm=0, ss=0):
"""
Join date/time components into datetime64 object
"""
y = (np.asarray(y) - 1970).astype("<M8[Y]"... | [
"numpy.maximum",
"numpy.sum",
"numpy.abs",
"numpy.arctan2",
"numpy.clip",
"numpy.isnan",
"datetime.datetime.utcnow",
"numpy.sin",
"numpy.arange",
"numpy.exp",
"matplotlib.pyplot.tight_layout",
"numpy.zeros_like",
"numpy.arcsin",
"numpy.recarray",
"numpy.tan",
"matplotlib.pyplot.rc",
... | [((3158, 3167), 'numpy.sin', 'np.sin', (['D'], {}), '(D)\n', (3164, 3167), True, 'import numpy as np\n'), ((3179, 3188), 'numpy.cos', 'np.cos', (['D'], {}), '(D)\n', (3185, 3188), True, 'import numpy as np\n'), ((3760, 3784), 'numpy.sqrt', 'np.sqrt', (['(1 - sinDec ** 2)'], {}), '(1 - sinDec ** 2)\n', (3767, 3784), Tru... |
#######################################
# Input Example ::
# python CrimeTypePredict.py -lat 11.23 -long 76.3
# places example :::
# 9XX NICOLA ST
# 12XX ALBERNI ST
# 11XX HARO ST
import numpy as np
import pickle
import pandas as pd
import argparse
parser = argparse.ArgumentParser()
# Adding optional argument
parser.... | [
"argparse.ArgumentParser"
] | [((259, 284), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (282, 284), False, 'import argparse\n')] |
'''
Common kernels
'''
import numpy as np
def linear_kernel(x, y):
'''
Linear kernel is simply he dot product of the vectors x and y.
'''
return np.dot(x, y)
def gaussian_kernel(x, y, sigma=0.5):
'''
'''
numerator = np.dot(x-y, x-y)
denominator = 2*sigma*sigma
return np.exp(-numerator / denominator)
| [
"numpy.dot",
"numpy.exp"
] | [((151, 163), 'numpy.dot', 'np.dot', (['x', 'y'], {}), '(x, y)\n', (157, 163), True, 'import numpy as np\n'), ((226, 246), 'numpy.dot', 'np.dot', (['(x - y)', '(x - y)'], {}), '(x - y, x - y)\n', (232, 246), True, 'import numpy as np\n'), ((281, 313), 'numpy.exp', 'np.exp', (['(-numerator / denominator)'], {}), '(-nume... |
import os
from PIL import Image
def Watermark():
global background,watermark_image
watermark = os.listdir(fr'Watermark')
value = 0
for index in os.listdir('images'):
print(index)
background = Image.open(fr"images\{index}")
watermark_image = Image.open(fr"Watermark\{wat... | [
"os.listdir",
"PIL.Image.open"
] | [((109, 133), 'os.listdir', 'os.listdir', (['f"""Watermark"""'], {}), "(f'Watermark')\n", (119, 133), False, 'import os\n'), ((168, 188), 'os.listdir', 'os.listdir', (['"""images"""'], {}), "('images')\n", (178, 188), False, 'import os\n'), ((234, 264), 'PIL.Image.open', 'Image.open', (['f"""images\\\\{index}"""'], {})... |
from django.core.management.base import BaseCommand
from pfb_analysis.models import AnalysisJob
class Command(BaseCommand):
help = "Update status during an analysis job"
def add_arguments(self, parser):
# Positional arguments
parser.add_argument('job_id')
parser.add_argument('status'... | [
"pfb_analysis.models.AnalysisJob.objects.get"
] | [((492, 537), 'pfb_analysis.models.AnalysisJob.objects.get', 'AnalysisJob.objects.get', ([], {'pk': "options['job_id']"}), "(pk=options['job_id'])\n", (515, 537), False, 'from pfb_analysis.models import AnalysisJob\n')] |
# Generated by Django 2.0.2 on 2020-01-16 20:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api_test', '0009_auto_20200113_1621'),
]
operations = [
migrations.CreateModel(
name='ApiAutoma... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((379, 430), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)', 'serialize': '(False)'}), '(primary_key=True, serialize=False)\n', (395, 430), False, 'from django.db import migrations, models\n'), ((465, 519), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1024)',... |
import sublime, sublime_plugin, threading, socket, struct, os, pickle
from SublimeTogether.lib import in_cmd, out_cmd, handlers
from SublimeTogether.diff_match_patch import diff_match_patch
# SublimeTogether's socket connection
thread = None
chat = None
project = None
CHAT_TITLE = 'SublimeTogether Chat'
def load_set... | [
"sublime.message_dialog",
"pickle.loads",
"struct.unpack_from",
"sublime.save_settings",
"SublimeTogether.diff_match_patch.diff_match_patch",
"threading.enumerate",
"socket.socket",
"sublime.windows",
"sublime.active_window",
"os.path.isfile",
"sublime.load_settings",
"SublimeTogether.lib.hand... | [((11027, 11048), 'threading.enumerate', 'threading.enumerate', ([], {}), '()\n', (11046, 11048), False, 'import sublime, sublime_plugin, threading, socket, struct, os, pickle\n'), ((516, 573), 'sublime.load_settings', 'sublime.load_settings', (['"""SublimeTogether.sublime-settings"""'], {}), "('SublimeTogether.sublime... |
# -*- coding: utf-8 -*-
import functools
import six
import inflection
def convert_value(value, converter=None):
return converter(value) if converter else value
def convert_dict(data, key_converter=None, value_converter=None):
return {
convert_value(key, key_converter): convert_value(value, value_c... | [
"functools.partial",
"six.iteritems"
] | [((395, 463), 'functools.partial', 'functools.partial', (['inflection.camelize'], {'uppercase_first_letter': '(False)'}), '(inflection.camelize, uppercase_first_letter=False)\n', (412, 463), False, 'import functools\n'), ((481, 536), 'functools.partial', 'functools.partial', (['convert_dict'], {'key_converter': 'cameli... |
import hypothesis.strategies as st
from hypothesis.core import given
from hypothesis.extra.numpy import arrays
import crowddynamics.testing as testing
from crowddynamics.core.interactions import (
interaction_agent_agent_circular,
interaction_agent_agent_three_circle,
agent_agent_block_list,
agent_circ... | [
"crowddynamics.testing.reals",
"crowddynamics.core.interactions.interaction_agent_agent_circular",
"crowddynamics.core.interactions.agent_agent_block_list",
"crowddynamics.core.interactions.interaction_agent_agent_three_circle",
"hypothesis.strategies.just",
"crowddynamics.core.interactions.agent_three_ci... | [((545, 587), 'crowddynamics.testing.reals', 'testing.reals', (['(0)', '(1.0)'], {'exclude_zero': '"""near"""'}), "(0, 1.0, exclude_zero='near')\n", (558, 587), True, 'import crowddynamics.testing as testing\n'), ((601, 643), 'crowddynamics.testing.reals', 'testing.reals', (['(0)', '(1.0)'], {'exclude_zero': '"""near""... |
# Twitcaspy
# Copyright 2021 Alma-field
# See LICENSE for details.
#
# based on tweepy(https://github.com/tweepy/tweepy)
# Copyright (c) 2009-2021 <NAME>
from nose.tools import ok_, eq_, raises
from twitcaspy import API
from twitcaspy.errors import TwitcaspyException, Unauthorized, NotFound
from .config import tape... | [
"nose.tools.raises",
"twitcaspy.api.get_user_info",
"nose.tools.eq_",
"json.load"
] | [((433, 459), 'nose.tools.raises', 'raises', (['TwitcaspyException'], {}), '(TwitcaspyException)\n', (439, 459), False, 'from nose.tools import ok_, eq_, raises\n'), ((957, 977), 'nose.tools.raises', 'raises', (['Unauthorized'], {}), '(Unauthorized)\n', (963, 977), False, 'from nose.tools import ok_, eq_, raises\n'), (... |
from logging import Logger
import os
from dotenv import dotenv_values
import asyncio
import aio_pika
config = {
**dotenv_values('.env'), # load shared development variables
# **dotenv_values(".env.secret"), # load sensitive variables
**os.environ, # override loaded values with environment variables
}
a... | [
"dotenv.dotenv_values",
"asyncio.get_event_loop",
"aio_pika.connect_robust"
] | [((119, 140), 'dotenv.dotenv_values', 'dotenv_values', (['""".env"""'], {}), "('.env')\n", (132, 140), False, 'from dotenv import dotenv_values\n'), ((1053, 1077), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (1075, 1077), False, 'import asyncio\n'), ((364, 511), 'aio_pika.connect_robust', 'aio... |
import pytest
from src import main
from src.modules.distance_matrix import DistanceMatrixStep, manhattan_dist
from src.modules.dm_exponent import DmToExpStep
from src.modules.heatmap import HeatMapStep
from src.modules.nj_tree import NjStep
from src.modules.snp_to_vectors import SnpToVectorStep
from src.modules.tsne i... | [
"src.utils.Pipeline",
"src.main.main",
"src.modules.nj_tree.NjStep",
"src.modules.heatmap.HeatMapStep",
"src.modules.distance_matrix.DistanceMatrixStep",
"src.utils.get_out_path",
"src.utils.get_data_path",
"src.modules.dm_exponent.DmToExpStep"
] | [((513, 531), 'src.utils.Pipeline', 'Pipeline', (['log_file'], {}), '(log_file)\n', (521, 531), False, 'from src.utils import get_data_path, get_out_path, Pipeline\n'), ((2062, 2073), 'src.main.main', 'main.main', ([], {}), '()\n', (2071, 2073), False, 'from src import main\n'), ((432, 446), 'src.utils.get_out_path', '... |
#!/usr/bin/env python3
#================================================================================================================
#----------------------------------------------------------------------------------------------------------------
# A STAR
#--------------------------------------------------... | [
"queue.PriorityQueue",
"sys.exit"
] | [((5180, 5201), 'queue.PriorityQueue', 'queue.PriorityQueue', ([], {}), '()\n', (5199, 5201), False, 'import queue\n'), ((3640, 3677), 'sys.exit', 'sys.exit', (['"""No start or no end in map"""'], {}), "('No start or no end in map')\n", (3648, 3677), False, 'import sys\n')] |
from qcache.qframe.common import assert_len, raise_malformed, is_quoted, unquote
from qcache.qframe.constants import COMPARISON_OPERATORS
def _prepare_arg(df, arg):
if isinstance(arg, basestring):
if is_quoted(arg):
return unquote(arg)
return getattr(df, arg)
return arg
def _bu... | [
"qcache.qframe.common.raise_malformed",
"qcache.qframe.common.unquote",
"qcache.qframe.common.is_quoted",
"qcache.qframe.common.assert_len"
] | [((214, 228), 'qcache.qframe.common.is_quoted', 'is_quoted', (['arg'], {}), '(arg)\n', (223, 228), False, 'from qcache.qframe.common import assert_len, raise_malformed, is_quoted, unquote\n'), ((396, 450), 'qcache.qframe.common.raise_malformed', 'raise_malformed', (['"""Expressions must be lists"""', 'update_q'], {}), ... |
# Copyright 2019 The Texar Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
"numpy.pad",
"numpy.asarray",
"numpy.zeros",
"numpy.array",
"typing.TypeVar"
] | [((930, 946), 'typing.TypeVar', 'TypeVar', (['"""Input"""'], {}), "('Input')\n", (937, 946), False, 'from typing import Dict, List, Optional, Sequence, Tuple, TypeVar\n'), ((955, 971), 'typing.TypeVar', 'TypeVar', (['"""Value"""'], {}), "('Value')\n", (962, 971), False, 'from typing import Dict, List, Optional, Sequenc... |
# -*- coding: utf-8 -*-
import unittest
from iemlav.lib.ids.r2l_rules.wireless.deauth import Deauth
import scapy.all as scapy
from iemlav.logger import IemlAVLogger
try:
# if python 3.x.x
from unittest.mock import patch
except ImportError: # python 2.x.x
from mock import patch
class TestDeauth(unittest.... | [
"mock.patch.object",
"iemlav.lib.ids.r2l_rules.wireless.deauth.Deauth",
"mock.patch",
"scapy.all.Dot11"
] | [((879, 938), 'mock.patch', 'patch', (['"""iemlav.lib.ids.r2l_rules.wireless.deauth.time.time"""'], {}), "('iemlav.lib.ids.r2l_rules.wireless.deauth.time.time')\n", (884, 938), False, 'from mock import patch\n'), ((944, 977), 'mock.patch.object', 'patch.object', (['IemlAVLogger', '"""log"""'], {}), "(IemlAVLogger, 'log... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from elementtree import ElementTree
from pylib.xml_indent import xml_indent
FIXTURE_XML = """
<root>
<page_heading>
<title>This is a title</title>
<hr clear="auto"/>
</page_heading>
<articles>
<article id="1">
<title>This is the first article</tit... | [
"elementtree.ElementTree.tostring",
"elementtree.ElementTree.fromstring",
"pylib.xml_indent.xml_indent"
] | [((891, 926), 'elementtree.ElementTree.fromstring', 'ElementTree.fromstring', (['FIXTURE_XML'], {}), '(FIXTURE_XML)\n', (913, 926), False, 'from elementtree import ElementTree\n'), ((943, 971), 'pylib.xml_indent.xml_indent', 'xml_indent', (['parsed'], {'indent': '(0)'}), '(parsed, indent=0)\n', (953, 971), False, 'from... |
# (C) Copyright 2017- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernme... | [
"metview.mcont",
"metview.plot",
"metview.png_output",
"metview.read"
] | [((1740, 1770), 'metview.read', 'mv.read', (['"""./t2_for_UC-04.grib"""'], {}), "('./t2_for_UC-04.grib')\n", (1747, 1770), True, 'import metview as mv\n'), ((1796, 1825), 'metview.read', 'mv.read', (['"""./z_for_UC-04.grib"""'], {}), "('./z_for_UC-04.grib')\n", (1803, 1825), True, 'import metview as mv\n'), ((1839, 220... |
# Copyright 2019 WebPageTest LLC.
# Copyright 2017 Google Inc.
# Use of this source code is governed by the Apache 2.0 license that can be
# found in the LICENSE file.
"""Chrome browser on Android"""
import gzip
import logging
import os
import re
import shutil
import sys
import time
if (sys.version_info >= (3, 0)):
... | [
"shutil.copyfileobj",
"os.remove",
"logging.debug",
"gzip.open",
"os.path.basename",
"time.sleep",
"os.path.isfile",
"re.search",
"monotonic.monotonic",
"os.path.join"
] | [((5801, 5860), 'os.path.join', 'os.path.join', (["task['dir']", "self.config['command_line_file']"], {}), "(task['dir'], self.config['command_line_file'])\n", (5813, 5860), False, 'import os\n'), ((6031, 6058), 'logging.debug', 'logging.debug', (['command_line'], {}), '(command_line)\n', (6044, 6058), False, 'import l... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import numpy
from ..edges import formatEdgeString, translateEdgeNotation
class TestFile(object):
def test_translateEdgeStringArgumentType(self):
with pytest.raises(TypeError):
translateEdgeNotation(90)
def test_translateEdgeStri... | [
"pytest.raises"
] | [((225, 249), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeError)\n', (238, 249), False, 'import pytest\n'), ((357, 382), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError)\n', (370, 382), False, 'import pytest\n'), ((442, 467), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), ... |
# Copyright 2016 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | [
"jsonschema.validate",
"copy.deepcopy",
"os.path.dirname"
] | [((3721, 3745), 'copy.deepcopy', 'copy.deepcopy', (['benchSpec'], {}), '(benchSpec)\n', (3734, 3745), False, 'import copy\n'), ((1311, 1336), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1326, 1336), False, 'import os\n'), ((3058, 3096), 'jsonschema.validate', 'jsonschema.validate', (['ben... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from .. import utilities, tables
class Thing(pulumi.CustomResource):
... | [
"warnings.warn"
] | [((1425, 1500), 'warnings.warn', 'warnings.warn', (['"""explicit use of __name__ is deprecated"""', 'DeprecationWarning'], {}), "('explicit use of __name__ is deprecated', DeprecationWarning)\n", (1438, 1500), False, 'import warnings\n'), ((1583, 1682), 'warnings.warn', 'warnings.warn', (['"""explicit use of __opts__ i... |
import os, sys, time, math, copy
dpr = True
def dprint(arg):
global dpr
if dpr == True:
print(arg)
def binaryToDecimal(binary):
bin=list()
if type(binary) == str:
bin.append(int(char) for char in binary)
elif type(binary) == list:
bin = copy.deepcopy(binary)
for i ... | [
"copy.deepcopy"
] | [((1473, 1494), 'copy.deepcopy', 'copy.deepcopy', (['matrix'], {}), '(matrix)\n', (1486, 1494), False, 'import os, sys, time, math, copy\n'), ((284, 305), 'copy.deepcopy', 'copy.deepcopy', (['binary'], {}), '(binary)\n', (297, 305), False, 'import os, sys, time, math, copy\n')] |
import glob
src_files = glob.glob("./goal_src/**/*.g[cs]", recursive=True)
data_files = glob.glob("./goal_src/**/*.gd", recursive=True)
# Find how many of each have been started
src_files_started = 0
src_files_finished = 0
data_files_started = 0
for f in src_files:
with open(f, "r") as temp_file:
lines = temp... | [
"json.dump",
"glob.glob"
] | [((25, 75), 'glob.glob', 'glob.glob', (['"""./goal_src/**/*.g[cs]"""'], {'recursive': '(True)'}), "('./goal_src/**/*.g[cs]', recursive=True)\n", (34, 75), False, 'import glob\n'), ((89, 136), 'glob.glob', 'glob.glob', (['"""./goal_src/**/*.gd"""'], {'recursive': '(True)'}), "('./goal_src/**/*.gd', recursive=True)\n", (... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 20 11:20:41 2019
@author: KatreAR
"""
from fuzzywuzzy import fuzz
from itertools import combinations
import numpy
def match_scores(listofnames, matchtype='ratio'):
"""
Return a map of combinations and scores that denotes similarity between them.
The map is... | [
"itertools.combinations"
] | [((868, 896), 'itertools.combinations', 'combinations', (['listofnames', '(2)'], {}), '(listofnames, 2)\n', (880, 896), False, 'from itertools import combinations\n')] |
import unittest
from onnxmltools import convert_sklearn
from onnxmltools.convert.common.data_types import FloatTensorType, Int64TensorType, StringTensorType
class TestSklearnPipeline(unittest.TestCase):
def test_pipeline(self):
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline... | [
"sklearn.preprocessing.StandardScaler",
"onnxmltools.convert.common.data_types.FloatTensorType",
"onnxmltools.convert.common.data_types.Int64TensorType",
"sklearn.preprocessing.LabelEncoder",
"onnxmltools.convert.common.data_types.StringTensorType",
"sklearn.pipeline.Pipeline"
] | [((355, 371), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (369, 371), False, 'from sklearn.preprocessing import StandardScaler\n'), ((438, 490), 'sklearn.pipeline.Pipeline', 'Pipeline', (["[('scaler1', scaler), ('scaler2', scaler)]"], {}), "([('scaler1', scaler), ('scaler2', scaler)])\n"... |
#!/usr/bin/env python3
import sys
import os
import csv
import matplotlib.pyplot as plt
import math
# Create bar graph based on rows of CSV file
def bar(first,second,folder):
fig,ax = plt.subplots()
# Convert "second" to a list of floats
x_vals = [float(x) for x in second[1:]]
# Get title of graph
... | [
"matplotlib.pyplot.title",
"os.mkdir",
"csv.reader",
"matplotlib.pyplot.margins",
"matplotlib.pyplot.close",
"matplotlib.pyplot.bar",
"os.path.exists",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.subplots",
"sys.exit",
"matplotlib.pyplot.xlabel"
] | [((189, 203), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (201, 203), True, 'import matplotlib.pyplot as plt\n'), ((498, 550), 'matplotlib.pyplot.bar', 'plt.bar', (['x_pos', 'x_vals'], {'align': '"""center"""', 'color': 'colors'}), "(x_pos, x_vals, align='center', color=colors)\n", (505, 550), True,... |
import tensorflow as tf
from common import shrender
def loss_render(sh_pred, sh_gt, shmap):
pred = shrender(sh_pred, shmap)
gt = shrender(sh_gt, shmap)
return tf.reduce_mean(
tf.reduce_sum(tf.square(pred - gt), axis=[1,2]) / tf.cast(tf.count_nonzero(tf.reduce_sum(shmap,[-1])), tf.float32)
)
de... | [
"common.shrender",
"tensorflow.reduce_sum",
"tensorflow.constant",
"tensorflow.multiply",
"tensorflow.square"
] | [((104, 128), 'common.shrender', 'shrender', (['sh_pred', 'shmap'], {}), '(sh_pred, shmap)\n', (112, 128), False, 'from common import shrender\n'), ((138, 160), 'common.shrender', 'shrender', (['sh_gt', 'shmap'], {}), '(sh_gt, shmap)\n', (146, 160), False, 'from common import shrender\n'), ((365, 437), 'tensorflow.cons... |
import csv
import random
import warnings
import os
from locust import HttpUser, task, between
SEARCH_LINK = "/search_reserved_keyword?q=covidessentialproduct&aggregated=1"
class SastaSundarSearch(HttpUser):
host = os.getenv('TARGET_URL', 'https://search.sastasundar.com')
wait_time = between(1, 5)
def o... | [
"locust.between",
"os.getenv",
"warnings.filterwarnings"
] | [((222, 279), 'os.getenv', 'os.getenv', (['"""TARGET_URL"""', '"""https://search.sastasundar.com"""'], {}), "('TARGET_URL', 'https://search.sastasundar.com')\n", (231, 279), False, 'import os\n'), ((296, 309), 'locust.between', 'between', (['(1)', '(5)'], {}), '(1, 5)\n', (303, 309), False, 'from locust import HttpUser... |
"""Oh wow.
This is logically very similar to Dijkstra/A*, pruning search trees
based on the cheapest way to get to a certain permutation. We can both
throw away subtrees if there is a cheaper way to get to them and if
we're above the cheapest known completion. I feel like I'm missing
some heuristic for selecting the b... | [
"copy.deepcopy",
"itertools.count",
"heapq.heappop"
] | [((603, 610), 'itertools.count', 'count', ([], {}), '()\n', (608, 610), False, 'from itertools import count\n'), ((2268, 2289), 'heapq.heappop', 'heapq.heappop', (['search'], {}), '(search)\n', (2281, 2289), False, 'import heapq\n'), ((2429, 2452), 'copy.deepcopy', 'copy.deepcopy', (['occupied'], {}), '(occupied)\n', (... |
import numpy as np
import random
import matplotlib.pyplot as plt
import os
import shutil
import imageio
def create_data(N, xu=10, yu=10, xd=-10, yd=-10):
fx = lambda: random.random() * (xu - xd) + xd
fy = lambda: random.random() * (yu - yd) + yd
calDistance = lambda x, y: np.sqrt((x[0] - y[0]) ** 2 + (x[1]... | [
"matplotlib.pyplot.title",
"os.mkdir",
"imageio.mimsave",
"random.randint",
"matplotlib.pyplot.plot",
"random.shuffle",
"matplotlib.pyplot.scatter",
"imageio.imread",
"numpy.zeros",
"os.path.exists",
"numpy.argsort",
"numpy.sort",
"random.random",
"matplotlib.pyplot.cla",
"numpy.array",
... | [((428, 444), 'numpy.zeros', 'np.zeros', (['(N, N)'], {}), '((N, N))\n', (436, 444), True, 'import numpy as np\n'), ((1080, 1101), 'numpy.argsort', 'np.argsort', (['packValue'], {}), '(packValue)\n', (1090, 1101), True, 'import numpy as np\n'), ((1153, 1171), 'numpy.sort', 'np.sort', (['packValue'], {}), '(packValue)\n... |
"""
This provides classes and methods that calculate the gradient level
and surface (10-m above ground) wind speed, based on a number of
parametric profiles and boundary layer models. These classes and
methods provide the wind field at a single point in time. The complete
wind swath is evaluated in the calling classes.... | [
"numpy.arctan2",
"numpy.abs",
"numpy.ones",
"numpy.shape",
"numpy.sin",
"numpy.exp",
"logging.NullHandler",
"numpy.power",
"Utilities.metutils.convert",
"math.sqrt",
"Utilities.metutils.coriolis",
"numpy.cos",
"math.exp",
"numpy.log",
"numpy.where",
"inspect.getargspec",
"numpy.array... | [((1786, 1813), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1803, 1813), False, 'import logging\n'), ((1829, 1850), 'logging.NullHandler', 'logging.NullHandler', ([], {}), '()\n', (1848, 1850), False, 'import logging\n'), ((1722, 1753), 'logging.getLogger', 'logging.getLogger', (['"""... |
#
# Copyright 2012-2014 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | [
"multigtfs.models.base.models.ForeignKey",
"jsonfield.JSONField"
] | [((3830, 3855), 'multigtfs.models.base.models.ForeignKey', 'models.ForeignKey', (['"""Fare"""'], {}), "('Fare')\n", (3847, 3855), False, 'from multigtfs.models.base import models, Base\n'), ((3868, 3971), 'multigtfs.models.base.models.ForeignKey', 'models.ForeignKey', (['"""Route"""'], {'null': '(True)', 'blank': '(Tru... |
"""
Helper functions and class definition for conversion between schema in DSS and Tableau Hyper
"""
from tableauhyperapi import TableDefinition
from type_conversion import TypeConversion
import copy
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO, format='Plugin: Tableau ... | [
"tableauhyperapi.TableDefinition.Column",
"copy.deepcopy",
"logging.basicConfig",
"type_conversion.TypeConversion",
"logging.getLogger"
] | [((228, 255), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (245, 255), False, 'import logging\n'), ((256, 366), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""Plugin: Tableau Hyper API | %(levelname)s - %(message)s"""'}), "(level=logging.INFO,... |
from multiprocessing import Process
import keras
from sklearn.model_selection import train_test_split
from models.ResNet import ResNet18
from query_methods.RandomSampling import RandomSampling
from query_methods.CoreSet import CoreSetSampling
from query_methods.UncertaintySampling import UncertaintyEntropySampling
fr... | [
"keras.optimizers.Adadelta",
"keras.datasets.cifar10.load_data",
"sklearn.model_selection.train_test_split",
"keras.utils.to_categorical",
"multiprocessing.Process",
"al_exp.ActiveLearningExperiment"
] | [((931, 997), 'sklearn.model_selection.train_test_split', 'train_test_split', (['x_train', 'y_train'], {'test_size': '(0.2)', 'random_state': '(42)'}), '(x_train, y_train, test_size=0.2, random_state=42)\n', (947, 997), False, 'from sklearn.model_selection import train_test_split\n'), ((1368, 1402), 'keras.datasets.cif... |
import cv2
import numpy as np
##low :[ 0 208 61], high:[ 74 255 153]
##low :[ 0 187 71], high:[ 80 245 255]
class Vision():
def __init__(self, camera_port_left=1):
self.camera_port = camera_port_left
# self.cap1 = cv2.VideoCapture(2)
self.cap2 = cv2.VideoCapture(camera_port_left)
... | [
"cv2.circle",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.moments",
"cv2.imshow",
"numpy.ones",
"cv2.VideoCapture",
"numpy.array",
"cv2.erode",
"cv2.destroyAllWindows",
"cv2.inRange"
] | [((280, 314), 'cv2.VideoCapture', 'cv2.VideoCapture', (['camera_port_left'], {}), '(camera_port_left)\n', (296, 314), False, 'import cv2\n'), ((596, 633), 'cv2.cvtColor', 'cv2.cvtColor', (['left', 'cv2.COLOR_BGR2HSV'], {}), '(left, cv2.COLOR_BGR2HSV)\n', (608, 633), False, 'import cv2\n'), ((658, 680), 'numpy.array', '... |
"""
Mermaid extensions for Markdown.
Renders the output inline, eliminating the need to configure an output
directory.
Supports outputs types of SVG and PNG. The output will be taken from the
filename specified in the tag. Example:
```mermaid
graph TD
A[Client] --> B[Load Balancer]
```
Requires the mermaid cli (http... | [
"subprocess.Popen",
"tempfile.TemporaryDirectory",
"re.compile"
] | [((587, 674), 're.compile', 're.compile', (['"""^```mermaid\\\\s*\\\\n(?P<content>.*?)```\\\\s*$"""', '(re.MULTILINE | re.DOTALL)'], {}), "('^```mermaid\\\\s*\\\\n(?P<content>.*?)```\\\\s*$', re.MULTILINE | re.\n DOTALL)\n", (597, 674), False, 'import re\n'), ((1523, 1552), 'tempfile.TemporaryDirectory', 'tempfile.T... |
from textwrap import dedent
from typing import Dict, List
import pytest
import gen
from gen.tests.utils import make_arguments, true_false_msg, validate_error
class TestAdminRouterTLSConfig:
"""
Tests for the Admin Router TLS configuration on complete file configuration
level.
"""
def test_maste... | [
"textwrap.dedent",
"gen.tests.utils.make_arguments",
"gen.tests.utils.validate_error",
"gen.generate",
"pytest.mark.parametrize"
] | [((2630, 2833), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""tls_versions,ciphers"""', "[(('true', 'true', 'false'), ''), (('false', 'true', 'true'),\n 'EECDH+AES256:RSA+AES256'), (('false', 'true', 'false'),\n 'EECDH+AES256:RSA+AES256')]"], {}), "('tls_versions,ciphers', [(('true', 'true', 'false'... |
import uuid
from django.db import models
class BaseModel(models.Model):
"""Opinionated Django base model"""
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Met... | [
"django.db.models.DateTimeField",
"django.db.models.UUIDField"
] | [((125, 195), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(True)', 'default': 'uuid.uuid4', 'editable': '(False)'}), '(primary_key=True, default=uuid.uuid4, editable=False)\n', (141, 195), False, 'from django.db import models\n'), ((213, 252), 'django.db.models.DateTimeField', 'models.DateTi... |
# Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"pytest.raises",
"cirq.QasmArgs"
] | [((1121, 1171), 'pytest.raises', 'pytest.raises', (['TypeError'], {'match': '"""no _qasm_ method"""'}), "(TypeError, match='no _qasm_ method')\n", (1134, 1171), False, 'import pytest\n'), ((1216, 1281), 'pytest.raises', 'pytest.raises', (['TypeError'], {'match': '"""returned NotImplemented or None"""'}), "(TypeError, m... |
import logging
logger = logging.getLogger("main")
logger.setLevel(logging.DEBUG)
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.DEBUG)
formatter = logging.Formatter(">>> %(levelname)s : %(message)s")
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
logger.propa... | [
"logging.Formatter",
"logging.StreamHandler",
"logging.getLogger"
] | [((25, 50), 'logging.getLogger', 'logging.getLogger', (['"""main"""'], {}), "('main')\n", (42, 50), False, 'import logging\n'), ((101, 124), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (122, 124), False, 'import logging\n'), ((178, 230), 'logging.Formatter', 'logging.Formatter', (['""">>> %(leve... |
import os
import unittest
from testfixtures import tempdir, compare
import ed25519
from nacl.public import PrivateKey, PublicKey
from nacl.encoding import HexEncoder as KeyFormatter
from crypt4gh.crypt4gh import encrypt, decrypt, reencrypt, Header
from . import data as test_data
class TestCrypt4GH(unittest.TestCase... | [
"nacl.public.PublicKey",
"testfixtures.tempdir",
"crypt4gh.crypt4gh.encrypt"
] | [((410, 419), 'testfixtures.tempdir', 'tempdir', ([], {}), '()\n', (417, 419), False, 'from testfixtures import tempdir, compare\n'), ((898, 907), 'testfixtures.tempdir', 'tempdir', ([], {}), '()\n', (905, 907), False, 'from testfixtures import tempdir, compare\n'), ((628, 673), 'nacl.public.PublicKey', 'PublicKey', ([... |
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | [
"lingvo.compat.test.main",
"numpy.random.seed",
"numpy.abs",
"numpy.sum",
"numpy.einsum",
"numpy.ones",
"numpy.argmin",
"lingvo.compat.range",
"numpy.arange",
"numpy.tile",
"numpy.exp",
"lingvo.compat.global_variables_initializer",
"lingvo.core.attention_util.PositionalAttenLogits.Params",
... | [((2064, 2108), 'numpy.zeros', 'np.zeros', (['(batch, num_heads, tgtlen, srclen)'], {}), '((batch, num_heads, tgtlen, srclen))\n', (2072, 2108), True, 'import numpy as np\n'), ((3766, 3829), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('Base', False)", "('Lite', True)"], {}), "((... |
# yacon.admin.py
import logging
from django.contrib import admin
from treebeard.admin import TreeAdmin
from treebeard.forms import movenodeform_factory
from yacon.models.groupsq import GroupOfGroups
from yacon.models.hierarchy import Node
from yacon.models.pages import MetaPage, Page
logger = logging.getLogger(__na... | [
"django.contrib.admin.register",
"treebeard.forms.movenodeform_factory",
"logging.getLogger"
] | [((298, 325), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (315, 325), False, 'import logging\n'), ((609, 638), 'django.contrib.admin.register', 'admin.register', (['GroupOfGroups'], {}), '(GroupOfGroups)\n', (623, 638), False, 'from django.contrib import admin\n'), ((720, 744), 'django... |
__author__ = 'larry'
import heapq
import os
import tempfile
def file_chunk_lines(f, chunk_size=65536):
"""Read chunks of lines and yield them one by one
We default to a smaller chunk than the buffer size because we will be reading this from many files at the same time
- **parameters**, **types**, **retu... | [
"os.fdopen",
"os.mkdir",
"heapq.merge",
"tempfile.mkstemp"
] | [((1949, 1989), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {'dir': 'temp_file_location'}), '(dir=temp_file_location)\n', (1965, 1989), False, 'import tempfile\n'), ((2003, 2021), 'os.fdopen', 'os.fdopen', (['fd', '"""w"""'], {}), "(fd, 'w')\n", (2012, 2021), False, 'import os\n'), ((3550, 3578), 'os.mkdir', 'os.mkdir... |
import sys, os
sys.path.append(os.environ['d'])
import torch.nn.functional
from utils.opt import *
from build_access import *
from dataloader_access import *
from torch.optim import *
import numpy as np
gpu0 = torch.device('cpu')
if torch.cuda.is_available():
gpu0 = torch.device('cuda:0')
tprint('buiding access... | [
"sys.path.append",
"numpy.mean"
] | [((16, 48), 'sys.path.append', 'sys.path.append', (["os.environ['d']"], {}), "(os.environ['d'])\n", (31, 48), False, 'import sys, os\n'), ((2364, 2383), 'numpy.mean', 'np.mean', (['val_losses'], {}), '(val_losses)\n', (2371, 2383), True, 'import numpy as np\n'), ((2385, 2402), 'numpy.mean', 'np.mean', (['val_accs'], {}... |
import abc
import math
import datetime
import collections
import sqlalchemy as sa
import marshmallow as ma
from marshmallow.utils import isoformat
from webservices.spec import spec
def _format_value(value):
if isinstance(value, datetime.datetime):
return isoformat(value)
if isinstance(value, datetim... | [
"sqlalchemy.tuple_",
"marshmallow.fields.Integer",
"math.ceil",
"webservices.spec.spec.definition",
"marshmallow.utils.isoformat",
"marshmallow.fields.Raw",
"marshmallow.fields.Nested"
] | [((6205, 6259), 'webservices.spec.spec.definition', 'spec.definition', (['"""OffsetInfo"""'], {'schema': 'OffsetInfoSchema'}), "('OffsetInfo', schema=OffsetInfoSchema)\n", (6220, 6259), False, 'from webservices.spec import spec\n'), ((6260, 6310), 'webservices.spec.spec.definition', 'spec.definition', (['"""SeekInfo"""... |
import asyncio
import base64
import json
import logging
import tempfile
import traceback
from collections import namedtuple
from contextlib import asynccontextmanager
from pathlib import Path
from typing import AsyncGenerator, List, Optional
import aiofiles
import httpx
import yaml
from aiofiles import os as aiofiles_... | [
"tenacity.stop.stop_after_attempt",
"tempfile._get_candidate_names",
"asyncio.get_event_loop",
"pathlib.Path.home",
"aiofiles.open",
"tenacity.wait.wait_fixed",
"tenacity.before_sleep.before_sleep_log",
"json.dumps",
"httpx.AsyncClient",
"logging.info",
"pathlib.Path",
"aiofiles.os.remove",
... | [((691, 761), 'collections.namedtuple', 'namedtuple', (['"""CommandResult"""', '"""finished_without_errors, decoded_stdout"""'], {}), "('CommandResult', 'finished_without_errors, decoded_stdout')\n", (701, 761), False, 'from collections import namedtuple\n'), ((856, 883), 'logging.getLogger', 'logging.getLogger', (['__... |
# coding=utf-8
# The MIT License (MIT)
# Copyright (c) Microsoft Corporation
# 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
# t... | [
"unittest.main",
"transformers.UnilmForSeq2Seq",
"transformers.is_torch_available",
"transformers.UnilmModel.from_pretrained",
"transformers.UnilmConfig",
"shutil.rmtree",
"transformers.modeling_unilm.UNILM_PRETRAINED_MODEL_ARCHIVE_MAP.keys"
] | [((1506, 1526), 'transformers.is_torch_available', 'is_torch_available', ([], {}), '()\n', (1524, 1526), False, 'from transformers import is_torch_available\n'), ((9013, 9028), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9026, 9028), False, 'import unittest\n'), ((4750, 5292), 'transformers.UnilmConfig', 'Unil... |
def interactive():
"""
Code for all the interactive prompts throughout the chapter.
>>> import myset
>>> s1 = myset.MySet()
>>> s2 = myset.MySet()
>>> s1.add(1)
>>> s2.add('a')
>>> s1.items()
[1]
>>> s2.items()
['a']
>>> myset.MySet.__dict__
[...('__init__', <function __init__ at 0x...>),
('__module__', 'myset'... | [
"doctest.testmod"
] | [((2555, 2600), 'doctest.testmod', 'doctest.testmod', ([], {'optionflags': 'doctest.ELLIPSIS'}), '(optionflags=doctest.ELLIPSIS)\n', (2570, 2600), False, 'import doctest\n')] |
from hls4ml.converters.keras_to_hls import parse_default_keras_layer
from hls4ml.converters.keras_to_hls import keras_handler
from hls4ml.converters.keras.core import parse_dense_layer
from hls4ml.converters.keras.convolution import parse_conv1d_layer
from hls4ml.converters.keras.convolution import parse_conv2d_layer
... | [
"hls4ml.converters.keras.core.parse_dense_layer",
"hls4ml.converters.keras_to_hls.keras_handler",
"hls4ml.converters.keras_to_hls.parse_default_keras_layer",
"hls4ml.converters.keras.convolution.parse_conv1d_layer",
"hls4ml.converters.keras.convolution.parse_conv2d_layer"
] | [((393, 416), 'hls4ml.converters.keras_to_hls.keras_handler', 'keras_handler', (['"""QDense"""'], {}), "('QDense')\n", (406, 416), False, 'from hls4ml.converters.keras_to_hls import keras_handler\n'), ((924, 959), 'hls4ml.converters.keras_to_hls.keras_handler', 'keras_handler', (['"""QConv1D"""', '"""QConv2D"""'], {}),... |
"Geocoder app"
from flask import Blueprint
geocoder = Blueprint("geocoder", __name__)
| [
"flask.Blueprint"
] | [((56, 87), 'flask.Blueprint', 'Blueprint', (['"""geocoder"""', '__name__'], {}), "('geocoder', __name__)\n", (65, 87), False, 'from flask import Blueprint\n')] |
"""
Class for table approves_room_request
"""
from datetime import datetime
from . import db
class ApprovesRoomRequest(db.Model):
"""This class connects which approver is currently responsible for which room request."""
room_request_id = db.Column(db.Integer, db.ForeignKey('room_request.id'), primary_key=True)
ap... | [
"datetime.datetime.now"
] | [((474, 488), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (486, 488), False, 'from datetime import datetime\n')] |
# Copyright 2021 Intel Corporation
#
# 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... | [
"numba.core.types.Function",
"numba.core.types.ArrayFlags",
"numba.core.types.ArrayCTypes",
"numba.np.arrayobj._array_copy",
"sys.stdout.flush",
"sys.exc_info",
"numba.core.imputils.builtin_registry.functions.append",
"llvmlite.binding.add_symbol",
"numba.core.typing.npydecl.registry.register_global... | [((4380, 4409), 'numba.extending.typeof_impl.register', 'typeof_impl.register', (['ndarray'], {}), '(ndarray)\n', (4400, 4409), False, 'from numba.extending import typeof_impl, register_model, type_callable, lower_builtin\n'), ((5311, 5334), 'numba.core.pythonapi.box', 'box', (['UsmSharedArrayType'], {}), '(UsmSharedAr... |
import asyncio
word_list = ["Life", "is", "short"]
async def print_task():
for w in word_list:
await asyncio.sleep(0.1)
print(w, end=" ")
def run():
loop = asyncio.new_event_loop()
loop.run_until_complete(print_task())
loop.close()
main = run
| [
"asyncio.sleep",
"asyncio.new_event_loop"
] | [((185, 209), 'asyncio.new_event_loop', 'asyncio.new_event_loop', ([], {}), '()\n', (207, 209), False, 'import asyncio\n'), ((116, 134), 'asyncio.sleep', 'asyncio.sleep', (['(0.1)'], {}), '(0.1)\n', (129, 134), False, 'import asyncio\n')] |
# coding=utf-8
__author__ = 'menghui'
import string
import re
import shlex
import service.utils as utils
class SQLExpParseError(Exception):
'''
SQL分析器异常
'''
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class SQLDirector:
def __init__(self, buil... | [
"service.utils.convertToNumber",
"service.utils.isnumeric",
"re.findall",
"shlex.shlex",
"re.search"
] | [((8744, 8806), 're.search', 're.search', (['"""<trim\\\\s*([a-zA-Z]+\\\\s*=\\\\s*"([^"]*)"\\\\s*)*>"""', 'sql'], {}), '(\'<trim\\\\s*([a-zA-Z]+\\\\s*=\\\\s*"([^"]*)"\\\\s*)*>\', sql)\n', (8753, 8806), False, 'import re\n'), ((9984, 10044), 're.search', 're.search', (['"""<if\\\\s*([a-zA-Z]+\\\\s*=\\\\s*"([^"]*)"\\\\s*... |
from multiprocessing.connection import Client, Listener
from typing import Tuple
from .Message import Message
class ConnectionHolder:
def __init__(self):
self.conn = None
def send_message(self, message: Message):
self.conn.send(message)
def has_new_message(self):
return self.con... | [
"multiprocessing.connection.Listener",
"multiprocessing.connection.Client"
] | [((816, 831), 'multiprocessing.connection.Client', 'Client', (['address'], {}), '(address)\n', (822, 831), False, 'from multiprocessing.connection import Client, Listener\n'), ((947, 957), 'multiprocessing.connection.Listener', 'Listener', ([], {}), '()\n', (955, 957), False, 'from multiprocessing.connection import Cli... |
from blogfetch import DB
a = DB()
while True:
a.add(raw_input('Enter site: '))
| [
"blogfetch.DB"
] | [((29, 33), 'blogfetch.DB', 'DB', ([], {}), '()\n', (31, 33), False, 'from blogfetch import DB\n')] |
"""Support for LIRC devices."""
# pylint: disable=no-member, import-error
import threading
import time
import logging
import voluptuous as vol
from homeassistant.const import (
EVENT_HOMEASSISTANT_STOP, EVENT_HOMEASSISTANT_START)
_LOGGER = logging.getLogger(__name__)
BUTTON_NAME = 'button_name'
DOMAIN = 'lirc'... | [
"threading.Thread.__init__",
"lirc.deinit",
"lirc.init",
"time.sleep",
"threading.Event",
"voluptuous.Schema",
"lirc.nextcode",
"logging.getLogger"
] | [((247, 274), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (264, 274), False, 'import logging\n'), ((734, 777), 'lirc.init', 'lirc.init', (['"""home-assistant"""'], {'blocking': '(False)'}), "('home-assistant', blocking=False)\n", (743, 777), False, 'import lirc\n'), ((435, 449), 'volup... |
#!/usr/bin/env python3
import unittest
from util import connect, load_data
LISTINGS_DATA = "YVR_Airbnb_listings_summary.csv"
REVIEWS_DATA = "YVR_Airbnb_reviews.csv"
CREATE_LISTINGS_TABLE = '''
CREATE TABLE listings (
id INTEGER,
-- ID of the listing
name TEXT,
-- Title of the list... | [
"unittest.main",
"util.load_data",
"util.connect"
] | [((1126, 1150), 'util.load_data', 'load_data', (['LISTINGS_DATA'], {}), '(LISTINGS_DATA)\n', (1135, 1150), False, 'from util import connect, load_data\n'), ((1169, 1192), 'util.load_data', 'load_data', (['REVIEWS_DATA'], {}), '(REVIEWS_DATA)\n', (1178, 1192), False, 'from util import connect, load_data\n'), ((1335, 134... |
import hashlib
from typing import List, Union
from cryptography.exceptions import InvalidSignature
from webauthn.helpers import (
bytes_to_base64url,
decode_credential_public_key,
decoded_public_key_to_cryptography,
parse_authenticator_data,
parse_client_data_json,
verify_signature,
)
from web... | [
"webauthn.helpers.decoded_public_key_to_cryptography",
"webauthn.helpers.verify_signature",
"webauthn.helpers.bytes_to_base64url",
"hashlib.sha256",
"webauthn.helpers.exceptions.InvalidAuthenticationResponse",
"webauthn.helpers.parse_authenticator_data",
"webauthn.helpers.decode_credential_public_key",
... | [((2698, 2747), 'webauthn.helpers.parse_client_data_json', 'parse_client_data_json', (['response.client_data_json'], {}), '(response.client_data_json)\n', (2720, 2747), False, 'from webauthn.helpers import bytes_to_base64url, decode_credential_public_key, decoded_public_key_to_cryptography, parse_authenticator_data, pa... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-02-26 13:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('twitter', '0004_twitteraccount_events'),
]
operations = [
migrations.AlterField(
model_name='twitteraccoun... | [
"django.db.models.CharField"
] | [((382, 424), 'django.db.models.CharField', 'models.CharField', ([], {'default': '(0)', 'max_length': '(20)'}), '(default=0, max_length=20)\n', (398, 424), False, 'from django.db import migrations, models\n')] |
import html5lib
from sdklib.compat import StringIO, str, convert_bytes_to_str
from sdklib.html.base import HTMLLxmlMixin, AbstractBaseHTML, HTML5libMixin
class HTML5lib(HTML5libMixin, AbstractBaseHTML):
"""
HTML class using html5lib parser.
"""
def __init__(self, dom):
self._parse(dom=dom)
... | [
"html5lib.parse",
"sdklib.compat.convert_bytes_to_str",
"lxml.etree.HTMLParser"
] | [((404, 423), 'html5lib.parse', 'html5lib.parse', (['dom'], {}), '(dom)\n', (418, 423), False, 'import html5lib\n'), ((865, 883), 'lxml.etree.HTMLParser', 'etree.HTMLParser', ([], {}), '()\n', (881, 883), False, 'from lxml import etree\n'), ((929, 954), 'sdklib.compat.convert_bytes_to_str', 'convert_bytes_to_str', (['d... |
# -*- coding: utf-8 -*-
"""
# api clients for wangduoyun
**copyright** (c) 2021 by <NAME> <<EMAIL>>
"""
import hashlib
import datetime
from functools import wraps
import urllib.parse
from typing import Callable, Dict, Tuple
from restful_client_lite import APIClient
class WangduoyunApiClient(APIClient):
"""
... | [
"hashlib.md5",
"datetime.datetime.now",
"functools.wraps"
] | [((935, 948), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (946, 948), False, 'import hashlib\n'), ((1295, 1303), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (1300, 1303), False, 'from functools import wraps\n'), ((1792, 1800), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (1797, 1800), False, 'from functo... |
import json
from django.conf import settings
from Native_Service.lib.native_service import ProgressStages
import requests
def get_token():
"""
Function requests PayU for necessary token to make payment.
return is a dict with the following keys:
'access_token' - main result to make payment,
'tok... | [
"json.decoder.JSONDecoder",
"requests.Session",
"Native_Service.lib.native_service.ProgressStages",
"json.dumps"
] | [((677, 695), 'requests.Session', 'requests.Session', ([], {}), '()\n', (693, 695), False, 'import requests\n'), ((2203, 2221), 'json.dumps', 'json.dumps', (['values'], {}), '(values)\n', (2213, 2221), False, 'import json\n'), ((2230, 2248), 'requests.Session', 'requests.Session', ([], {}), '()\n', (2246, 2248), False,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.