code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""Neurally implanted schematic for moving around on the ship.
It is illegal for prisoners in transit to activate such an
implant. Failure to comply carries a minimum sentence of
six months.
Many parts of the ship are derelict and inaccessible.
"""
from pyntnclick.i18n import _
from pyntnclick.state i... | [
"pyntnclick.i18n._",
"pyntnclick.scenewidgets.InteractRectUnion",
"gamelib.scenes.game_widgets.make_sentence_dialog",
"pyntnclick.scenewidgets.InteractNoImage"
] | [((4806, 4930), 'pyntnclick.scenewidgets.InteractRectUnion', 'InteractRectUnion', (['((207, 227, 39, 63), (256, 225, 35, 64), (259, 322, 34, 64), (514, 380, 58,\n 66), (607, 377, 60, 70))'], {}), '(((207, 227, 39, 63), (256, 225, 35, 64), (259, 322, 34, \n 64), (514, 380, 58, 66), (607, 377, 60, 70)))\n', (4823, ... |
# -*- coding: utf-8 -*-
# This file is part of Knitlib. It is based on AYAB.
#
# Knitlib is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | [
"os.path.abspath",
"knitlib.plugins.ayab_plugin.ayab_image.ayabImage",
"os.path.join"
] | [((1256, 1284), 'knitlib.plugins.ayab_plugin.ayab_image.ayabImage', 'ayabImage', (['self.pil_image', '(2)'], {}), '(self.pil_image, 2)\n', (1265, 1284), False, 'from knitlib.plugins.ayab_plugin.ayab_image import ayabImage\n'), ((994, 1019), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (1009... |
import requests
import json
from moneymour import environments
from moneymour.crypto_utils import Signature
API_BASE_URL = 'https://api.moneymour.com'
API_SANDBOX_BASE_URL = 'https://api.sandbox.moneymour.com'
API_STAGE_BASE_URL = 'https://api.stage.moneymour.com'
API_DEVELOPMENT_BASE_URL = 'http://localhost:3000'
E... | [
"moneymour.crypto_utils.Signature.generate_expires_at_header_value",
"moneymour.environments.validate_environment",
"json.loads",
"json.dumps",
"moneymour.crypto_utils.Signature.build"
] | [((494, 540), 'moneymour.environments.validate_environment', 'environments.validate_environment', (['environment'], {}), '(environment)\n', (527, 540), False, 'from moneymour import environments\n'), ((1085, 1129), 'moneymour.crypto_utils.Signature.generate_expires_at_header_value', 'Signature.generate_expires_at_heade... |
import os
import logging
logging.basicConfig(level=logging.INFO)
import numpy as np
import matplotlib.pyplot as plt
from stompy.grid import paver
from stompy.spatial.linestring_utils import upsample_linearring,resample_linearring
from stompy.grid import paver
from stompy.spatial import field,constrained_delaunay,wkb2... | [
"stompy.spatial.field.PyApolloniusField",
"stompy.spatial.linestring_utils.upsample_linearring",
"logging.basicConfig",
"stompy.grid.paver.Paving",
"os.path.dirname",
"stompy.spatial.field.ConstantField",
"matplotlib.pyplot.axis",
"stompy.spatial.field.XYZField",
"matplotlib.pyplot.figure",
"numpy... | [((25, 64), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (44, 64), False, 'import logging\n'), ((541, 595), 'numpy.array', 'np.array', (['[[0, 0], [1000, 0], [1000, 1000], [0, 1000]]'], {}), '([[0, 0], [1000, 0], [1000, 1000], [0, 1000]])\n', (549, 595), True,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME>
from collections import defaultdict
import os
import re
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import numpy as np
from pandas import DataFrame
import scipy.stats
import seaborn as sns
import lda_metrics
N_PROPS_LIST... | [
"pandas.DataFrame",
"seaborn.heatmap",
"seaborn.factorplot",
"re.match",
"collections.defaultdict",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.mean",
"seaborn.set",
"seaborn.FacetGrid",
"matplotlib.pyplot.savefig"
] | [((138, 159), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (152, 159), False, 'import matplotlib\n'), ((426, 470), 'seaborn.set', 'sns.set', ([], {'style': '"""whitegrid"""', 'context': '"""poster"""'}), "(style='whitegrid', context='poster')\n", (433, 470), True, 'import seaborn as sns\n'), ((... |
from flask import Flask
from flask import request, jsonify
import numpy as np
import torch
from flask_cors import CORS, cross_origin
import socket
import argparse
import random
import json
import re
from tokenize_code import tokenize_code
from serverHelpers import notebook_to_frontend
from gensim.models.doc2vec impo... | [
"argparse.ArgumentParser",
"json.loads",
"flask_cors.CORS",
"flask.Flask",
"RetrievalDB_doc2vec.inferenceRNN_doc2vec",
"socket.gethostbyname",
"RetrievalDB_CodeBERT.RetrievalDB_CodeBERT",
"socket.gethostname",
"numpy.random.randint",
"flask.jsonify",
"RetrievalDB_CodeBERT.inferenceRNN_CodeBERT",... | [((835, 880), 'RetrievalDB_CodeBERT.RetrievalDB_CodeBERT', 'RetrievalDB_CodeBERT', (['PATH_TO_CODEBERT_MODELS'], {}), '(PATH_TO_CODEBERT_MODELS)\n', (855, 880), False, 'from RetrievalDB_CodeBERT import RetrievalDB_CodeBERT, inferenceRNN_CodeBERT\n'), ((887, 902), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\... |
from flask import Flask
from .views import views
def create_app() -> Flask:
app = Flask(
__name__,
static_url_path='',
static_folder='../app/build',
)
app.register_blueprint(views)
return app
| [
"flask.Flask"
] | [((90, 155), 'flask.Flask', 'Flask', (['__name__'], {'static_url_path': '""""""', 'static_folder': '"""../app/build"""'}), "(__name__, static_url_path='', static_folder='../app/build')\n", (95, 155), False, 'from flask import Flask\n')] |
# Generated by Django 3.1.7 on 2021-05-06 05:22
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('gyoithon', '0005_auto_20210506_1358'),
]
operations = [
migrations.AlterField(
... | [
"django.db.models.CharField",
"datetime.datetime"
] | [((849, 918), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""N/A"""', 'max_length': '(10)', 'verbose_name': '"""Status"""'}), "(default='N/A', max_length=10, verbose_name='Status')\n", (865, 918), False, 'from django.db import migrations, models\n'), ((431, 491), 'datetime.datetime', 'datetime.d... |
"""Copyright 2019 Cisco Systems
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... | [
"logging.info",
"logging.error"
] | [((913, 964), 'logging.error', 'logging.error', (['"""%s is not a supported OS!"""', 'os_name'], {}), "('%s is not a supported OS!', os_name)\n", (926, 964), False, 'import logging\n'), ((1045, 1119), 'logging.error', 'logging.error', (['"""%s is not a supported language for %s!"""', 'language', 'os_name'], {}), "('%s ... |
# https://www.visualcrossing.com/weather/weather-data-services?pln=plan_GqkYVnzyiNg93X#/timeline
# https://www.visualcrossing.com/weather-api
import requests
import json
# Convert degrees to compass direction
def deg_to_compass(num):
val = int((num / 22.5) + 0.5)
arr = [
"N",
"NNE",
"N... | [
"requests.get",
"json.dumps"
] | [((1082, 1099), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1094, 1099), False, 'import requests\n'), ((3159, 3189), 'json.dumps', 'json.dumps', (['api.data'], {'indent': '(4)'}), '(api.data, indent=4)\n', (3169, 3189), False, 'import json\n')] |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\sickness\sickness_commands.py
# Compiled at: 2017-08-17 00:31:58
# Size of source mod 2**32: 2877 by... | [
"sims4.commands.Command",
"server_commands.argument_helpers.TunableInstanceParam",
"services.get_sickness_service",
"server_commands.argument_helpers.get_optional_target"
] | [((458, 559), 'sims4.commands.Command', 'sims4.commands.Command', (['"""sickness.make_sick"""'], {'command_type': 'sims4.commands.CommandType.Automation'}), "('sickness.make_sick', command_type=sims4.commands.\n CommandType.Automation)\n", (480, 559), False, 'import services, sims4\n'), ((822, 917), 'sims4.commands.... |
# Copyright 2020-2021 Dolthub, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"unittest.main"
] | [((2163, 2178), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2176, 2178), False, 'import unittest\n')] |
from selenium import webdriver
from time import sleep
import json
import Client
t = Client.get_servers_raw()
if t == None:
print('Failed to get the list of servers')
raise SystemExit
if len(t) == 0:
print('The list of servers is empty')
raise SystemExit
print(f'Added {len(t)} servers to the queue')
wi... | [
"Client.get_member_count",
"selenium.webdriver.Edge",
"Client.get_servers_raw",
"time.sleep"
] | [((85, 109), 'Client.get_servers_raw', 'Client.get_servers_raw', ([], {}), '()\n', (107, 109), False, 'import Client\n'), ((434, 473), 'selenium.webdriver.Edge', 'webdriver.Edge', (['"""res\\\\msedgedriver.exe"""'], {}), "('res\\\\msedgedriver.exe')\n", (448, 473), False, 'from selenium import webdriver\n'), ((614, 622... |
# Copyright 2011 Terena. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the fol... | [
"peer.entity.feeds.ChangesFeed",
"peer.entity.feeds.EntitiesFeed",
"django.conf.urls.url"
] | [((1684, 1732), 'django.conf.urls.url', 'url', (['"""^$"""', '"""entities_list"""'], {'name': '"""entities_list"""'}), "('^$', 'entities_list', name='entities_list')\n", (1687, 1732), False, 'from django.conf.urls import patterns, url\n'), ((1796, 1841), 'django.conf.urls.url', 'url', (['"""^add$"""', '"""entity_add"""... |
import json
# From Marseille
class CDCPArgumentationDoc:
def __init__(self, file_root, merge_consecutive_spans=True):
self.doc_id = int(file_root[-5:])
self._ann_path = file_root + ".ann.json"
with open(file_root + ".txt") as f:
self.raw_text = f.read()
# annotation... | [
"json.load"
] | [((434, 446), 'json.load', 'json.load', (['f'], {}), '(f)\n', (443, 446), False, 'import json\n')] |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
# @author : <NAME>
# @Email : <EMAIL>
# @Project : Python_Files
# @File : utils.py
# @Software: PyCharm
# @Time : 2021/5/20 下午7:42
"""
import os
import struct
import sys
import time
import traceback
from datetime import datetime
from pathlib import Path
import matplotlib ... | [
"matplotlib.pyplot.title",
"os.remove",
"pandas.read_csv",
"time.strftime",
"pathlib.Path",
"time.mktime",
"matplotlib.pyplot.gca",
"pandas.set_option",
"pandas.DataFrame",
"traceback.print_exc",
"datetime.datetime.fromisoformat",
"warnings.simplefilter",
"matplotlib.dates.DateFormatter",
... | [((515, 557), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (528, 557), True, 'import pandas as pd\n'), ((577, 616), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', 'None'], {}), "('display.max_rows', None)\n", (590, 616), True, '... |
# -*- coding: utf-8 -*-
import unittest
from gilded_rose import Item, GildedRose
class GildedRoseTest(unittest.TestCase):
def test_concert_under_5(self):
items = [Item("Backstage passes to a TAFKAL80ETC concert", 2, 30)]
gilded_rose = GildedRose(items)
gilded_rose.update_quality()
... | [
"unittest.main",
"gilded_rose.GildedRose",
"gilded_rose.Item"
] | [((6033, 6048), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6046, 6048), False, 'import unittest\n'), ((258, 275), 'gilded_rose.GildedRose', 'GildedRose', (['items'], {}), '(items)\n', (268, 275), False, 'from gilded_rose import Item, GildedRose\n'), ((496, 513), 'gilded_rose.GildedRose', 'GildedRose', (['item... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 23 13:45:44 2019
@author: thomassullivan
"""
import docx
from docx.enum.dml import MSO_THEME_COLOR_INDEX
from objects import Article
def add_hyperlink(paragraph, text, url):
# This gets access to the document.xml.rels file and gets a new relati... | [
"objects.Article.get_date_formatted",
"docx.oxml.shared.qn",
"docx.Document",
"docx.oxml.shared.OxmlElement"
] | [((2974, 2989), 'docx.Document', 'docx.Document', ([], {}), '()\n', (2987, 2989), False, 'import docx\n'), ((3391, 3406), 'docx.Document', 'docx.Document', ([], {}), '()\n', (3404, 3406), False, 'import docx\n'), ((611, 654), 'docx.oxml.shared.OxmlElement', 'docx.oxml.shared.OxmlElement', (['"""w:hyperlink"""'], {}), "... |
import base64
import json
import socket
from typing import Optional, Union
from platypush.plugins import Plugin, action
class TcpPlugin(Plugin):
"""
Plugin for raw TCP communications.
"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
self._sockets = {}
def _connect(s... | [
"base64.encodebytes",
"socket.socket",
"base64.decodebytes",
"json.dumps"
] | [((494, 543), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (507, 543), False, 'import socket\n'), ((2302, 2318), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (2312, 2318), False, 'import json\n'), ((2432, 2456), 'base64.decodebyte... |
"""Week2 Test Cases Traveling Salesman Problem"""
import math
from src.course4.week2.tsp import generate_complete_euclidean_distanace_graph, traveling_salesman_problem
def test_tsp1():
points = [(1, 1), (4, 1), (1, 4), (4, 4)]
result = traveling_salesman_problem(points)
assert result == 12
def test_ts... | [
"math.floor",
"src.course4.week2.tsp.traveling_salesman_problem"
] | [((248, 282), 'src.course4.week2.tsp.traveling_salesman_problem', 'traveling_salesman_problem', (['points'], {}), '(points)\n', (274, 282), False, 'from src.course4.week2.tsp import generate_complete_euclidean_distanace_graph, traveling_salesman_problem\n'), ((377, 411), 'src.course4.week2.tsp.traveling_salesman_proble... |
#!/usr/bin/env python
import platform
from EPPs.common import SendMailEPP
class DataReleaseTrigger(SendMailEPP):
"""Notifies the bioinformatics team to release data for a project."""
def _run(self):
if len(self.projects) > 1:
raise ValueError('More than one project present in step. Only o... | [
"platform.node"
] | [((1114, 1129), 'platform.node', 'platform.node', ([], {}), '()\n', (1127, 1129), False, 'import platform\n')] |
#!/usr/bin/env python
#
# Replication repair
# Copyright (C) 2015 <NAME>
#
# Licensed under the MIT License (MIT)
#
# 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, includ... | [
"os.path.isfile",
"os.path.join",
"lib.gooey.Gooey",
"os.path.dirname",
"os.path.exists",
"shlex.split",
"shutil.copyfile",
"datetime.datetime.now",
"csv.writer",
"os.stat",
"lib.tqdm.tqdm",
"lib.argparse.ArgumentParser",
"lib.aux_funcs.recwalk",
"os.makedirs",
"lib.aux_funcs.fullpath",
... | [((1622, 1647), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1637, 1647), False, 'import sys, os\n'), ((1664, 1697), 'os.path.join', 'os.path.join', (['thispathname', '"""lib"""'], {}), "(thispathname, 'lib')\n", (1676, 1697), False, 'import sys, os\n'), ((31271, 31295), 'lib.aux_funcs.ful... |
# -*- coding: utf-8 -*-
from app import app as application
if __name__ == '__main__':
application.run(host="0.0.0.0", debug=True)
| [
"app.app.run"
] | [((93, 136), 'app.app.run', 'application.run', ([], {'host': '"""0.0.0.0"""', 'debug': '(True)'}), "(host='0.0.0.0', debug=True)\n", (108, 136), True, 'from app import app as application\n')] |
import pandas as pd
import psycopg2 as pg2
import yaml
import io
import ohio.ext.pandas
from sqlalchemy import create_engine
def open_db_connection(secrets_file="secrets.yaml", verbose=True):
"""
Opens connection to psql db
:return:
connection object
"""
try:
with open(secrets_... | [
"pandas.read_pickle",
"io.StringIO",
"pandas.DataFrame",
"psycopg2.connect"
] | [((2709, 2787), 'pandas.read_pickle', 'pd.read_pickle', (['"""/data/groups/bills1/mlpolicylab_fall20_bills1/bid_groups.pkl"""'], {}), "('/data/groups/bills1/mlpolicylab_fall20_bills1/bid_groups.pkl')\n", (2723, 2787), True, 'import pandas as pd\n'), ((2800, 2850), 'pandas.DataFrame', 'pd.DataFrame', (["object['white']"... |
from fastai.text import *
import fire
BOS = 'xbos' # beginning-of-sentence tag
FLD = 'xfld' # data field tag
BOS_LABEL = '_bos_'
PAD = '_pad_'
re1 = re.compile(r' +')
def read_file(filepath):
assert os.path.exists(filepath)
sentences = []
labels = []
with open(filepath, encoding='utf-8') as f:
... | [
"fire.Fire"
] | [((3710, 3732), 'fire.Fire', 'fire.Fire', (['create_toks'], {}), '(create_toks)\n', (3719, 3732), False, 'import fire\n')] |
from django.db import models
from django.urls import reverse
# Create your models here.
class Product(models.Model):
title = models.CharField(max_length=120)
description = models.TextField(null=True)
price = models.DecimalField(decimal_places=2, max_digits=100)
summary = models.TextFiel... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.urls.reverse",
"django.db.models.DecimalField"
] | [((136, 168), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(120)'}), '(max_length=120)\n', (152, 168), False, 'from django.db import models\n'), ((187, 214), 'django.db.models.TextField', 'models.TextField', ([], {'null': '(True)'}), '(null=True)\n', (203, 214), False, 'from django.db import m... |
import pysmurf
#S = pysmurf.SmurfControl(make_logfile=False,setup=False,epics_root='test_epics',cfg_file='/usr/local/controls/Applications/smurf/pysmurf/pysmurf/cfg_files/experiment_fp28_smurfsrv04.cfg')
import numpy as np
import time
Vrange=np.linspace(0,0.195/6.,100)+S.get_tes_bias_bipolar(3)
Vrange=[Vrange,Vrang... | [
"numpy.array",
"numpy.linspace",
"time.sleep"
] | [((246, 278), 'numpy.linspace', 'np.linspace', (['(0)', '(0.195 / 6.0)', '(100)'], {}), '(0, 0.195 / 6.0, 100)\n', (257, 278), True, 'import numpy as np\n'), ((336, 352), 'numpy.array', 'np.array', (['Vrange'], {}), '(Vrange)\n', (344, 352), True, 'import numpy as np\n'), ((447, 464), 'time.sleep', 'time.sleep', (['(0.... |
import base64
import pathlib
from typing import List, Tuple
STATIC_DIR = pathlib.Path(__file__).parent / "static"
def _get_img_uri(img_file: str) -> str:
img_path = STATIC_DIR / img_file
with img_path.open(mode="rb") as f:
img_data = f.read()
encoded = base64.b64encode(img_data).decode("ascii")
... | [
"pathlib.Path",
"base64.b64encode"
] | [((75, 97), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (87, 97), False, 'import pathlib\n'), ((277, 303), 'base64.b64encode', 'base64.b64encode', (['img_data'], {}), '(img_data)\n', (293, 303), False, 'import base64\n')] |
# Generated by Django 3.0.7 on 2020-06-11 11:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0018_auto_20200609_1810'),
]
operations = [
migrations.AddField(
model_name='beneficiaire',
name='date_creat... | [
"django.db.models.DateTimeField"
] | [((344, 394), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)', 'null': '(True)'}), '(auto_now_add=True, null=True)\n', (364, 394), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/env python3
import sys
import json
import re
from pathlib import Path
from typing import List, Optional, Any, Dict
from bs4 import BeautifulSoup, Tag
class Hit:
search: str
title: str
anchor: str
content: str
start: int
def __init__(self,
search: str,
... | [
"re.finditer",
"json.dumps",
"pathlib.Path",
"sys.stderr.write",
"re.compile"
] | [((3047, 3072), 're.finditer', 're.finditer', (['"""\\\\w+"""', 'text'], {}), "('\\\\w+', text)\n", (3058, 3072), False, 'import re\n'), ((4840, 4899), 'json.dumps', 'json.dumps', (['d'], {'default': '(lambda o: o.__dict__)', 'sort_keys': '(True)'}), '(d, default=lambda o: o.__dict__, sort_keys=True)\n', (4850, 4899), ... |
# Reference Book: Python Data Science Handbook (page:(70-77))
# Date(13 April, 2019) Day-3, Time = 3:25 PM
# This section covers the use of Boolean masks to examine and manipulate values
# within NumPy arrays.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn; seaborn.set() #set... | [
"numpy.count_nonzero",
"numpy.sum",
"numpy.median",
"pandas.read_csv",
"numpy.random.RandomState",
"numpy.any",
"numpy.max",
"numpy.array",
"numpy.arange",
"seaborn.set",
"numpy.all"
] | [((302, 315), 'seaborn.set', 'seaborn.set', ([], {}), '()\n', (313, 315), False, 'import seaborn\n'), ((1941, 1966), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5]'], {}), '([1, 2, 3, 4, 5])\n', (1949, 1966), True, 'import numpy as np\n'), ((2867, 2891), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {})... |
import sqlite3
import datetime
import yaml
class SQLButler:
"""
SQLButler handles data addition and extraction from the database. There is a csv
database version that is designed to be completely compatable and interchangable
but SQL is likely to be faster in the long run.
"""
def __init__(se... | [
"datetime.datetime.strptime",
"yaml.load",
"sqlite3.connect"
] | [((1402, 1437), 'sqlite3.connect', 'sqlite3.connect', (['self.database_name'], {}), '(self.database_name)\n', (1417, 1437), False, 'import sqlite3\n'), ((915, 953), 'yaml.load', 'yaml.load', (['ycf'], {'Loader': 'yaml.FullLoader'}), '(ycf, Loader=yaml.FullLoader)\n', (924, 953), False, 'import yaml\n'), ((5530, 5594), ... |
# TRIGGERS.PY
import logging
import sys
import time
defaultDefault = object()
class TriggerFactory:
def __init__(self, tack):
self.tack = tack
self.kinds = { "timer" : TimerTrigger,
"process" : ProcessTrigger,
"globus" : GlobusTrigger,
... | [
"threading.Thread",
"subprocess.Popen",
"Queue.Queue",
"logging.critical",
"time.time",
"logging.info",
"globusonline.transfer.api_client.TransferAPIClient",
"os.getenv",
"sys.exit"
] | [((2351, 2426), 'logging.info', 'logging.info', (['(\'New TimerTrigger "%s" (%0.3fs)\' % (self.name, self.interval))'], {}), '(\'New TimerTrigger "%s" (%0.3fs)\' % (self.name, self.interval))\n', (2363, 2426), False, 'import logging\n'), ((2477, 2488), 'time.time', 'time.time', ([], {}), '()\n', (2486, 2488), False, 'i... |
# t-SNE is a great technique for visual exploration of high dimensional datasets
# Should be applied to non-numeric features
# Import module
from sklearn.manifold import TSNE
# Non-numerical columns in the dataset
non_numeric = ['Branch', 'Gender', 'Component']
# Drop the non-numerical columns from df
df_numeric = d... | [
"sklearn.manifold.TSNE"
] | [((398, 420), 'sklearn.manifold.TSNE', 'TSNE', ([], {'learning_rate': '(50)'}), '(learning_rate=50)\n', (402, 420), False, 'from sklearn.manifold import TSNE\n')] |
"""set default to string
Revision ID: 392e1a7038a5
Revises: <PASSWORD>
Create Date: 2014-11-17 17:41:47.983000
"""
# revision identifiers, used by Alembic.
revision = '392e1a7038a5'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
# default ignored
op.drop_column... | [
"alembic.op.drop_column",
"sqlalchemy.Column"
] | [((306, 346), 'alembic.op.drop_column', 'op.drop_column', (['"""task_entity"""', '"""feature"""'], {}), "('task_entity', 'feature')\n", (320, 346), False, 'from alembic import op\n'), ((485, 525), 'alembic.op.drop_column', 'op.drop_column', (['"""task_entity"""', '"""feature"""'], {}), "('task_entity', 'feature')\n", (... |
#
import datetime
class DclUtil(object):
@staticmethod
def datetime_format():
return datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S") | [
"datetime.datetime.now"
] | [((108, 131), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (129, 131), False, 'import datetime\n')] |
import os
import json
from utils import Colors, clamp
from .controllers import Keyboard
from .managers.sprite_font import SpriteFontManager
from pygame.locals import K_UP, K_w, K_DOWN, K_s, K_LEFT, K_a, K_RIGHT, K_d, K_SPACE, K_e, K_RETURN, K_ESCAPE
def read_float(options, key, default):
try:
option = opt... | [
"json.dump",
"os.mkdir",
"json.load",
"os.path.exists",
"os.path.isfile",
"utils.clamp",
"os.path.join"
] | [((1023, 1063), 'os.path.isfile', 'os.path.isfile', (['"""datafiles/options.json"""'], {}), "('datafiles/options.json')\n", (1037, 1063), False, 'import os\n'), ((3093, 3120), 'os.path.exists', 'os.path.exists', (['"""datafiles"""'], {}), "('datafiles')\n", (3107, 3120), False, 'import os\n'), ((3134, 3155), 'os.mkdir'... |
"""
Deck of cards.
"""
import itertools
import json
import random
SUITS = (
'Hearts',
'Diamonds',
'Clubs',
'Spades'
)
RANKS = [str(x) for x in range(2, 11)] + ['Jack', 'Queen', 'King', 'Ace']
class Card(object):
"""
A single card in a classic card deck.
"""
def __init__(self, suit=Non... | [
"json.loads",
"itertools.product"
] | [((706, 726), 'json.loads', 'json.loads', (['json_str'], {}), '(json_str)\n', (716, 726), False, 'import json\n'), ((3093, 3113), 'json.loads', 'json.loads', (['json_str'], {}), '(json_str)\n', (3103, 3113), False, 'import json\n'), ((1536, 1567), 'itertools.product', 'itertools.product', (['SUITS', 'RANKS'], {}), '(SU... |
from matplotlib import cm
# (B, G, R)
mouse_colors = [
(83, 255, 18), # green
(0, 139, 232), # orange
(255, 136, 0), # blue
(0, 196, 255), # yellow
(0, 25, 255) # red
]
outline_colormap = cm.get_cmap('plasma', 100)
| [
"matplotlib.cm.get_cmap"
] | [((215, 241), 'matplotlib.cm.get_cmap', 'cm.get_cmap', (['"""plasma"""', '(100)'], {}), "('plasma', 100)\n", (226, 241), False, 'from matplotlib import cm\n')] |
from django.db import models
import os
from django.conf import settings
from django.core.exceptions import ValidationError
# Create your models here.
# Define user directory path
def file_size(value):
limit = 524000
if value.size > limit:
raise ValidationError('File too large. Size should not exceed ... | [
"django.db.models.FileField",
"django.core.exceptions.ValidationError",
"os.path.basename",
"os.path.dirname",
"os.path.join"
] | [((388, 419), 'os.path.join', 'os.path.join', (['"""files"""', 'filename'], {}), "('files', filename)\n", (400, 419), False, 'import os\n'), ((459, 529), 'django.db.models.FileField', 'models.FileField', ([], {'upload_to': '"""files"""', 'null': '(True)', 'validators': '[file_size]'}), "(upload_to='files', null=True, v... |
"""
app.utils.mail
==============
Setup app's mailer.
"""
import typing as t
from threading import Thread
from flask import Flask, current_app
from flask_mail import Message
from app.extensions import mail
def _send_async_email(app: Flask, msg: Message) -> None:
with app.app_context():
mail.send(msg)
... | [
"threading.Thread",
"flask.current_app._get_current_object",
"app.extensions.mail.send",
"flask_mail.Message"
] | [((2390, 2423), 'flask.current_app._get_current_object', 'current_app._get_current_object', ([], {}), '()\n', (2421, 2423), False, 'from flask import Flask, current_app\n'), ((2681, 2698), 'flask_mail.Message', 'Message', ([], {}), '(**kwargs)\n', (2688, 2698), False, 'from flask_mail import Message\n'), ((304, 318), '... |
from .shared.utils import *
import circus.shared.algorithms as algo
from .shared import plot
import warnings
with warnings.catch_warnings():
warnings.filterwarnings("ignore",category=FutureWarning)
import h5py
from circus.shared.probes import get_nodes_and_edges
from .shared.files import get_dead_times
from cir... | [
"h5py.File",
"warnings.filterwarnings",
"cudamat.CUDAMatrix",
"circus.shared.algorithms.detect_peaks",
"cudamat.cuda_set_device",
"circus.shared.algorithms.slice_clusters",
"circus.shared.messages.init_logging",
"cudamat.cuda_sync_threads",
"circus.shared.algorithms.merging_cc",
"gc.collect",
"c... | [((114, 139), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (137, 139), False, 'import warnings\n'), ((145, 202), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'FutureWarning'}), "('ignore', category=FutureWarning)\n", (168, 202), False, 'import warnings... |
#!/usr/bin/env python3
# replicate.py
# This master script gives me a way to record the settings I used for
# various aspects of the article "The Life Cycles of Genres," and
# (I hope) allows other scholars to reproduce the same tests.
# Generally, I've defined a separate function for each part of the
# article that... | [
"comparemodels.compare_untrained",
"datetime.date.today",
"logisticpredict.create_model"
] | [((4909, 4976), 'logisticpredict.create_model', 'logisticpredict.create_model', (['paths', 'exclusions', 'classifyconditions'], {}), '(paths, exclusions, classifyconditions)\n', (4937, 4976), False, 'import logisticpredict, comparemodels\n'), ((6707, 6774), 'logisticpredict.create_model', 'logisticpredict.create_model'... |
from django.db import models
from django.utils.translation import ugettext as _
import reversion
from tally_ho.libs.models.base_model import BaseModel
from tally_ho.apps.tally.models.user_profile import UserProfile
class QuarantineCheck(BaseModel):
class Meta:
app_label = 'tally'
user = models.Forei... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.FloatField",
"django.db.models.BooleanField",
"django.utils.translation.ugettext",
"reversion.register"
] | [((743, 778), 'reversion.register', 'reversion.register', (['QuarantineCheck'], {}), '(QuarantineCheck)\n', (761, 778), False, 'import reversion\n'), ((308, 375), 'django.db.models.ForeignKey', 'models.ForeignKey', (['UserProfile'], {'null': '(True)', 'on_delete': 'models.PROTECT'}), '(UserProfile, null=True, on_delete... |
import logging
import importlib
import multiprocessing
from alvi.tests.resources.base import Resource
logger = logging.getLogger(__name__)
class LocalPythonClient(Resource):
def __init__(self):
logger.info("setting up clients")
self._clients = []
for scene in self.scenes:
modu... | [
"multiprocessing.Process",
"importlib.import_module",
"logging.getLogger"
] | [((112, 139), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (129, 139), False, 'import logging\n'), ((384, 420), 'importlib.import_module', 'importlib.import_module', (['module_name'], {}), '(module_name)\n', (407, 420), False, 'import importlib\n'), ((492, 536), 'multiprocessing.Process... |
import pandas as pd
import glob
import csv
files = [
"a100-results.csv",
"clx-1S-results.csv",
"clx-results.csv",
"gen9-results.csv",
"mi100-results.csv",
# "rome-results-aocc.csv",
"rome-results-cce.csv"]
csv_frames = []
for f in files:
csv_frames.append(pd.read_csv(f, skipinitialspace... | [
"pandas.read_csv",
"pandas.Series",
"pandas.concat",
"csv.writer"
] | [((335, 383), 'pandas.concat', 'pd.concat', (['csv_frames'], {'axis': '(0)', 'ignore_index': '(True)'}), '(csv_frames, axis=0, ignore_index=True)\n', (344, 383), True, 'import pandas as pd\n'), ((623, 670), 'pandas.read_csv', 'pd.read_csv', (['"""peaks.csv"""'], {'skipinitialspace': '(True)'}), "('peaks.csv', skipiniti... |
# -*- python -*-
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import gdb_test
class CompleteTest(gdb_test.GdbTest):
def test_complete(self):
# Test that continue causes the debugged pr... | [
"gdb_test.Main"
] | [((685, 700), 'gdb_test.Main', 'gdb_test.Main', ([], {}), '()\n', (698, 700), False, 'import gdb_test\n')] |
#--------------------------------------------
#-- Libraries
#--------------------------------------------
# system imports
import os
import sys
# add parent path to python paths
parentdir = os.path.join(os.path.dirname(__file__), '../')
sys.path.insert(0,parentdir)
# imports
import cv2
import datasets
from nfeReader ... | [
"cv2.waitKey",
"os.path.dirname",
"cv2.imshow",
"sys.path.insert",
"cv2.imread",
"cv2.destroyAllWindows"
] | [((238, 267), 'sys.path.insert', 'sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (253, 267), False, 'import sys\n'), ((204, 229), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (219, 229), False, 'import os\n'), ((511, 559), 'cv2.imshow', 'cv2.imshow', (["('Image - %s' % im... |
"""
Constants for Idasen Desk Controller Integration
"""
import logging
LOGGER = logging.getLogger(__package__)
DOMAIN = 'idasen-desk-controller'
PLATFORMS = ["cover", "sensor", "switch"]
MIN_HEIGHT = 620
MAX_HEIGHT = 1270 # 6500
HEIGHT_TOLERANCE = 2.0
ADAPTER_NAME = 'hci0'
SCAN_TIMEOUT = 5
CONNECTION_TIMEOUT = 20
... | [
"logging.getLogger"
] | [((83, 113), 'logging.getLogger', 'logging.getLogger', (['__package__'], {}), '(__package__)\n', (100, 113), False, 'import logging\n')] |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"mock.patch.object",
"absl.testing.absltest.main",
"pyfakefs.fake_filesystem_unittest.Patcher",
"zipfile.ZipFile",
"glazier.lib.logs.Setup",
"glazier.lib.logs.Collect",
"glazier.lib.logs.GetLogsPath",
"os.path.join"
] | [((1733, 1791), 'mock.patch.object', 'mock.patch.object', (['zipfile.ZipFile', '"""write"""'], {'autospec': '(True)'}), "(zipfile.ZipFile, 'write', autospec=True)\n", (1750, 1791), False, 'import mock\n'), ((2161, 2220), 'mock.patch.object', 'mock.patch.object', (['logs.winpe', '"""check_winpe"""'], {'autospec': '(True... |
import paho.mqtt.client as mqtt
import json
import numpy as np
import pandas as pd
import cv2 as cv
from New.TrainModel import test_model, predict_location, linear_train_model, logistic_train_model, svm_train_model, \
rf_train_model
def on_connect(client, userdata, flags, rc):
print("Connected with ... | [
"New.TrainModel.rf_train_model",
"cv2.circle",
"json.loads",
"cv2.waitKey",
"cv2.destroyAllWindows",
"New.TrainModel.predict_location",
"cv2.imread",
"paho.mqtt.client.Client",
"cv2.imshow",
"New.TrainModel.test_model"
] | [((2002, 2018), 'New.TrainModel.rf_train_model', 'rf_train_model', ([], {}), '()\n', (2016, 2018), False, 'from New.TrainModel import test_model, predict_location, linear_train_model, logistic_train_model, svm_train_model, rf_train_model\n'), ((2020, 2042), 'New.TrainModel.test_model', 'test_model', (['classifier'], {}... |
import main, os
class LogLevel:
def __init__(self, levelName, directory):
self.levelName = levelName
self.unzippedFilePath = os.path.join(directory, levelName + ".log")
self.zippedFiles = []
self.totalZippedSize = 0
# add each zipped file of the logLevel to the list 'zippe... | [
"main.index",
"main.size",
"main.listLogArchives",
"os.path.join"
] | [((147, 190), 'os.path.join', 'os.path.join', (['directory', "(levelName + '.log')"], {}), "(directory, levelName + '.log')\n", (159, 190), False, 'import main, os\n'), ((362, 404), 'main.listLogArchives', 'main.listLogArchives', (['levelName', 'directory'], {}), '(levelName, directory)\n', (382, 404), False, 'import m... |
from telegram.constants import MAX_FILESIZE_DOWNLOAD
from telegram.ext import CommandHandler, ConversationHandler, Filters, MessageHandler
from pdf_bot.consts import (
BACK,
BEAUTIFY,
BY_PERCENT,
BY_SIZE,
CANCEL,
COMPRESS,
COMPRESSED,
CROP,
DECRYPT,
ENCRYPT,
EXTRACT_IMAGE,
... | [
"pdf_bot.files.rotate.ask_rotate_degree",
"pdf_bot.files.crop.ask_crop_type",
"pdf_bot.utils.cancel",
"pdf_bot.files.text.ask_text_type",
"pdf_bot.files.image.get_pdf_images",
"pdf_bot.files.ocr.add_ocr_to_pdf",
"pdf_bot.files.text.get_pdf_text",
"pdf_bot.language.set_lang",
"pdf_bot.files.document.... | [((4367, 4396), 'pdf_bot.files.document.ask_doc_task', 'ask_doc_task', (['update', 'context'], {}), '(update, context)\n', (4379, 4396), False, 'from pdf_bot.files.document import ask_doc_task\n'), ((4444, 4511), 'pdf_bot.files.image.ask_image_task', 'ask_image_task', (['update', 'context', 'update.effective_message.ph... |
#!/usr/bin/env python
"""
A script for converting the README.md to a quick-start guide for inclusion
in the documentation
"""
from m2r import convert
def build_quick_start():
replace = {'# MPAS-Analysis': '# Quick Start Guide\n',
'[![Build Status]': '',
'[![Documentation Status]': ... | [
"m2r.convert"
] | [((1145, 1164), 'm2r.convert', 'convert', (['outContent'], {}), '(outContent)\n', (1152, 1164), False, 'from m2r import convert\n')] |
# #########################################################################
# Copyright (c) 2020, UChicago Argonne, LLC. All rights reserved. #
# #
# Copyright 2020. UChicago Argonne, LLC. This software was produced #
# under U.S. Gov... | [
"orangecontrib.wavepy2.util.wavepy_objects.OasysWavePyData",
"wavepy2.util.plot.plot_tools.DefaultContextWidget",
"orangewidget.gui.checkBox",
"orangewidget.gui.rubber"
] | [((4596, 4624), 'orangewidget.gui.rubber', 'gui.rubber', (['self.controlArea'], {}), '(self.controlArea)\n', (4606, 4624), False, 'from orangewidget import gui\n'), ((5411, 5439), 'orangewidget.gui.rubber', 'gui.rubber', (['self.controlArea'], {}), '(self.controlArea)\n', (5421, 5439), False, 'from orangewidget import ... |
#!/usr/bin/env python
"""
Setup for distribution package.
"""
from setuptools import setup
setup(name='dist_pdf',
version='1.0',
description='Distribution of data',
packages=['dist_pdf'],
zip_sage=False)
| [
"setuptools.setup"
] | [((92, 208), 'setuptools.setup', 'setup', ([], {'name': '"""dist_pdf"""', 'version': '"""1.0"""', 'description': '"""Distribution of data"""', 'packages': "['dist_pdf']", 'zip_sage': '(False)'}), "(name='dist_pdf', version='1.0', description='Distribution of data',\n packages=['dist_pdf'], zip_sage=False)\n", (97, 2... |
from numpy.testing._private.utils import assert_allclose
from sysidentpy.polynomial_basis import PolynomialNarmax
from sysidentpy.utils.generate_data import get_miso_data, get_siso_data
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_equal
from numpy.testing import assert_raises
from sysi... | [
"numpy.testing.assert_raises",
"numpy.testing.assert_almost_equal",
"sysidentpy.polynomial_basis.SimulatePolynomialNarmax",
"numpy.array",
"sysidentpy.utils.generate_data.get_siso_data"
] | [((428, 454), 'sysidentpy.polynomial_basis.SimulatePolynomialNarmax', 'SimulatePolynomialNarmax', ([], {}), '()\n', (452, 454), False, 'from sysidentpy.polynomial_basis import SimulatePolynomialNarmax\n'), ((467, 513), 'numpy.array', 'np.array', (['[[1001, 0], [2001, 1001], [2002, 0]]'], {}), '([[1001, 0], [2001, 1001]... |
# Generated by Django 2.0.3 on 2018-05-14 04:55
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('chat', '0004_auto_201803... | [
"django.db.models.ForeignKey",
"django.db.migrations.swappable_dependency"
] | [((227, 284), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (258, 284), False, 'from django.db import migrations, models\n'), ((470, 608), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on... |
"""
Unit and regression test for the tau_screened_coulomb method.
"""
from ThermoElectric import tau_screened_coulomb
import numpy as np
from pytest import approx
def test_tau_screened_coulomb():
energy = np.array([[0.1]])
e_eff_mass = np.array([[0.23 * 9.109e-31]])
dielectric = 11.7
imp = np.array(... | [
"pytest.approx",
"numpy.array",
"ThermoElectric.tau_screened_coulomb"
] | [((213, 230), 'numpy.array', 'np.array', (['[[0.1]]'], {}), '([[0.1]])\n', (221, 230), True, 'import numpy as np\n'), ((248, 278), 'numpy.array', 'np.array', (['[[0.23 * 9.109e-31]]'], {}), '([[0.23 * 9.109e-31]])\n', (256, 278), True, 'import numpy as np\n'), ((311, 330), 'numpy.array', 'np.array', (['[[1e+23]]'], {})... |
import word2vec
from config import *
word2vec.word2phrase(filename_start, filename_phrases, verbose=True)
word2vec.word2vec(filename_phrases, filename_bin, size=100, verbose=True)
word2vec.word2clusters(filename_start, filename_clusters, 100, verbose=True)
| [
"word2vec.word2vec",
"word2vec.word2clusters",
"word2vec.word2phrase"
] | [((37, 105), 'word2vec.word2phrase', 'word2vec.word2phrase', (['filename_start', 'filename_phrases'], {'verbose': '(True)'}), '(filename_start, filename_phrases, verbose=True)\n', (57, 105), False, 'import word2vec\n'), ((106, 179), 'word2vec.word2vec', 'word2vec.word2vec', (['filename_phrases', 'filename_bin'], {'size... |
import json
import pytz
import datetime
from cwm_worker_operator import metrics_updater
from cwm_worker_operator import common
from .mocks.metrics import MockMetricsUpdaterMetrics
def iterate_redis_pools(dc):
for pool in ['ingress', 'internal', 'metrics']:
with getattr(dc, 'get_{}_redis'.format(pool))()... | [
"cwm_worker_operator.metrics_updater.update_release_metrics",
"datetime.datetime",
"datetime.timedelta",
"cwm_worker_operator.metrics_updater.update_agg_metrics",
"cwm_worker_operator.common.get_namespace_name_from_worker_id"
] | [((608, 673), 'cwm_worker_operator.metrics_updater.update_agg_metrics', 'metrics_updater.update_agg_metrics', (['agg_metrics', 'now', '{}'], {'limit': '(2)'}), '(agg_metrics, now, {}, limit=2)\n', (642, 673), False, 'from cwm_worker_operator import metrics_updater\n'), ((1303, 1354), 'cwm_worker_operator.common.get_nam... |
from rest_framework import mixins
from rest_framework.viewsets import ReadOnlyModelViewSet, GenericViewSet
from rules.contrib.rest_framework import AutoPermissionViewSetMixin
from .serializers import NewsSerializer
from myapp.models import DrfNews
class NewsReadOnlyModelViewSet(AutoPermissionViewSetMixin, ReadOnlyMo... | [
"myapp.models.DrfNews.objects.all"
] | [((348, 369), 'myapp.models.DrfNews.objects.all', 'DrfNews.objects.all', ([], {}), '()\n', (367, 369), False, 'from myapp.models import DrfNews\n'), ((590, 611), 'myapp.models.DrfNews.objects.all', 'DrfNews.objects.all', ([], {}), '()\n', (609, 611), False, 'from myapp.models import DrfNews\n')] |
# - * - coding: utf-8 - * -
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches
def ecg_fixpeaks(rpeaks, sampling_rate=1000, iterative=True, show=False):
"""Correct R-peaks location based on their interval (RRi).
Identify erroneous inter-beat-intervals. Lipponen &... | [
"numpy.pad",
"pandas.DataFrame",
"numpy.abs",
"numpy.concatenate",
"numpy.logical_and",
"numpy.ravel",
"numpy.zeros",
"numpy.insert",
"numpy.any",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"numpy.array",
"numpy.max",
"numpy.min",
"numpy.delete",
"numpy.all",
"numpy.... | [((3895, 3911), 'numpy.ravel', 'np.ravel', (['rpeaks'], {}), '(rpeaks)\n', (3903, 3911), True, 'import numpy as np\n'), ((4246, 4261), 'numpy.mean', 'np.mean', (['rr[1:]'], {}), '(rr[1:])\n', (4253, 4261), True, 'import numpy as np\n'), ((4513, 4539), 'numpy.ediff1d', 'np.ediff1d', (['rr'], {'to_begin': '(0)'}), '(rr, ... |
import json
from lib.Component import Component
class BlockerChecker:
def __init__(self, file: str):
self.__blocked = {}
self.__populate_blocked_list(file)
def __populate_blocked_list(self, file: str):
with open(file, 'r') as inimage:
blocked_list = json.load(inimage)
... | [
"json.load",
"lib.Component.Component"
] | [((299, 317), 'json.load', 'json.load', (['inimage'], {}), '(inimage)\n', (308, 317), False, 'import json\n'), ((387, 413), 'lib.Component.Component', 'Component', (["blocked['purl']"], {}), "(blocked['purl'])\n", (396, 413), False, 'from lib.Component import Component\n')] |
"""Functional tests of CLI."""
from offline_docs.cli import clean, python
def test_python():
"""Run 'python' command of CLI."""
python()
def test_clean():
"""Run 'clean' command of CLI."""
clean()
| [
"offline_docs.cli.python",
"offline_docs.cli.clean"
] | [((140, 148), 'offline_docs.cli.python', 'python', ([], {}), '()\n', (146, 148), False, 'from offline_docs.cli import clean, python\n'), ((211, 218), 'offline_docs.cli.clean', 'clean', ([], {}), '()\n', (216, 218), False, 'from offline_docs.cli import clean, python\n')] |
from django.contrib.auth.models import User
from django.db import models
class Category(models.Model):
"""
Categories data model per user/blog
"""
owner = models.ForeignKey(User, on_delete=models.CASCADE)
name = models.CharField(max_length=150)
created_on = models.DateTimeField(auto_now_add=... | [
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((175, 224), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'on_delete': 'models.CASCADE'}), '(User, on_delete=models.CASCADE)\n', (192, 224), False, 'from django.db import models\n'), ((236, 268), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)'}), '(max_length=150)\n', (... |
import socket
def sendmsg(msgFromClient):
bytesToSend = str.encode(msgFromClient)
serverAddressPort = ("127.0.0.1", 20001)
bufferSize = 5120
UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
UDPClientSocket.sendto(bytesToSend, serverAddressPort)
... | [
"socket.socket"
] | [((199, 259), 'socket.socket', 'socket.socket', ([], {'family': 'socket.AF_INET', 'type': 'socket.SOCK_DGRAM'}), '(family=socket.AF_INET, type=socket.SOCK_DGRAM)\n', (212, 259), False, 'import socket\n')] |
from xml.etree.ElementTree import Element,ElementTree,tostring
def create_author(autor_id,language,author_type):
author =Element('author', id =autor_id,lang =language, type= author_type)
return author
def write_authors():
author1=create_author("1","en","0")
author2=create_author("2","en","0")... | [
"xml.etree.ElementTree.Element",
"xml.etree.ElementTree.tostring"
] | [((126, 189), 'xml.etree.ElementTree.Element', 'Element', (['"""author"""'], {'id': 'autor_id', 'lang': 'language', 'type': 'author_type'}), "('author', id=autor_id, lang=language, type=author_type)\n", (133, 189), False, 'from xml.etree.ElementTree import Element, ElementTree, tostring\n'), ((373, 390), 'xml.etree.Ele... |
import os
import boto3
import click
import json
import signal
import sys
import yaml
from botocore.exceptions import ClientError
from datetime import datetime
from typing import List
from warrant import Cognito
from superai import __version__
from superai.client import Client
from superai.config import get_config_dir... | [
"superai.meta_ai.dockerizer.push_image",
"click.option",
"click.echo",
"superai.utils.load_api_key",
"warrant.Cognito",
"superai.meta_ai.dockerizer.build_image",
"superai.config.set_env_config",
"superai.utils.save_api_key",
"superai.config.settings.as_dict",
"os.path.abspath",
"json.loads",
"... | [((856, 872), 'superai.config.get_config_dir', 'get_config_dir', ([], {}), '()\n', (870, 872), False, 'from superai.config import get_config_dir, list_env_configs, set_env_config, settings\n'), ((1073, 1100), 'superai.log.logger.get_logger', 'logger.get_logger', (['__name__'], {}), '(__name__)\n', (1090, 1100), False, ... |
import json
from abc import ABCMeta, abstractmethod
class Feed(metaclass=ABCMeta):
def __init__(self, keyword):
self._stories = []
self._len = len(self._stories)
self.__iter__ = self._stories.__iter__
self._stories = self._getStories(keyword)
try:
self.sources =... | [
"json.dumps"
] | [((1616, 1631), 'json.dumps', 'json.dumps', (['res'], {}), '(res)\n', (1626, 1631), False, 'import json\n')] |
from allauth.account.adapter import DefaultAccountAdapter
from django.conf import settings
from django.utils import timezone
from django.shortcuts import resolve_url
class AccountAdapter(DefaultAccountAdapter):
def get_login_redirect_url(self, request):
"""
If the user has never logged in before w... | [
"django.utils.timezone.now",
"django.shortcuts.resolve_url"
] | [((781, 797), 'django.shortcuts.resolve_url', 'resolve_url', (['url'], {}), '(url)\n', (792, 797), False, 'from django.shortcuts import resolve_url\n'), ((611, 625), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (623, 625), False, 'from django.utils import timezone\n')] |
from django.db import models
# Create your models here.
class AddressFile(models.Model):
excel_file = models.FileField(upload_to='excel/')
| [
"django.db.models.FileField"
] | [((107, 143), 'django.db.models.FileField', 'models.FileField', ([], {'upload_to': '"""excel/"""'}), "(upload_to='excel/')\n", (123, 143), False, 'from django.db import models\n')] |
import numpy as np
import matplotlib.pyplot as plt
import sys
import math
import random
import operator
def euclidean(x, x_p):
return ((x[0] - x_p[0]) ** 2 + (x[1] - x_p[1]) ** 2) ** 0.5
def greatest_euclidean(data, centers):
maxi = {}
for x in centers:
for x_p in data:
euc = euclidean... | [
"numpy.random.uniform",
"matplotlib.pyplot.show",
"random.randint",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid",
"operator.itemgetter"
] | [((862, 886), 'random.randint', 'random.randint', (['(0)', '(N - 1)'], {}), '(0, N - 1)\n', (876, 886), False, 'import random\n'), ((2213, 2246), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""x1"""'], {'color': '"""#1C2833"""'}), "('x1', color='#1C2833')\n", (2223, 2246), True, 'import matplotlib.pyplot as plt\n'), (... |
import sys
num = int(sys.stdin.readline().strip())
n = int(sys.stdin.readline().strip())
if n:
btn = sys.stdin.readline().strip().split()
else:
btn = []
result = abs(100 - num)
for i in range(1_000_000):
for j in str(i):
if j in btn:
break
else:
result = min(result, len(st... | [
"sys.stdin.readline"
] | [((22, 42), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (40, 42), False, 'import sys\n'), ((60, 80), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (78, 80), False, 'import sys\n'), ((106, 126), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (124, 126), False, 'import sys... |
import speech_recognition
import pyttsx3
class Receptor:
def listen(self):
microphone = speech_recognition.Recognizer()
phrase = ''
with speech_recognition.Microphone() as source:
microphone.adjust_for_ambient_noise(source)
audio = microphone.listen(source)
... | [
"pyttsx3.init",
"speech_recognition.Recognizer",
"speech_recognition.Microphone"
] | [((101, 132), 'speech_recognition.Recognizer', 'speech_recognition.Recognizer', ([], {}), '()\n', (130, 132), False, 'import speech_recognition\n'), ((636, 650), 'pyttsx3.init', 'pyttsx3.init', ([], {}), '()\n', (648, 650), False, 'import pyttsx3\n'), ((167, 198), 'speech_recognition.Microphone', 'speech_recognition.Mi... |
# coding: utf-8
"""
Uptrends API v4
This document describes Uptrends API version 4. This Swagger environment also lets you execute API methods directly. Please note that this is not a sandbox environment: these API methods operate directly on your actual Uptrends account. For more information, please visit ... | [
"unittest.main",
"uptrends.api.alert_definition_api.AlertDefinitionApi"
] | [((5931, 5946), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5944, 5946), False, 'import unittest\n'), ((805, 859), 'uptrends.api.alert_definition_api.AlertDefinitionApi', 'uptrends.api.alert_definition_api.AlertDefinitionApi', ([], {}), '()\n', (857, 859), False, 'import uptrends\n')] |
from importlib import import_module
import logging
import time
import json
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings
import django.db.backends.mysql.base
WRAPPED_BACKEND = import_module('django.db.backends.mysql.base')
LOGGER = logging.getLogger('django_mt')
def lower_d... | [
"logging.getLogger",
"importlib.import_module"
] | [((219, 265), 'importlib.import_module', 'import_module', (['"""django.db.backends.mysql.base"""'], {}), "('django.db.backends.mysql.base')\n", (232, 265), False, 'from importlib import import_module\n'), ((276, 306), 'logging.getLogger', 'logging.getLogger', (['"""django_mt"""'], {}), "('django_mt')\n", (293, 306), Fa... |
import unittest
from day3 import Router, Path, Traveler
class TestRouter(unittest.TestCase):
def test_houses_visited_single_visitor_2(self):
input = '>'
expected = 2
path = Path()
Router.route(input, Traveler(path))
self.assertEqual(expected, path.houses_visited())
def... | [
"unittest.main",
"day3.Traveler",
"day3.Path"
] | [((1527, 1542), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1540, 1542), False, 'import unittest\n'), ((203, 209), 'day3.Path', 'Path', ([], {}), '()\n', (207, 209), False, 'from day3 import Router, Path, Traveler\n'), ((424, 430), 'day3.Path', 'Path', ([], {}), '()\n', (428, 430), False, 'from day3 import Rou... |
# @Time : 2016/9/1 19:09
# @Author : lixintong
import unittest
import time
from uitester.case_manager.database import DBCommandLineHelper, Tag, Case, DB
class TestDataBase(unittest.TestCase):
def setUp(self):
self.db_helper = DBCommandLineHelper()
def test_operate_tag_data(self):
ms_str... | [
"time.time",
"uitester.case_manager.database.DBCommandLineHelper"
] | [((246, 267), 'uitester.case_manager.database.DBCommandLineHelper', 'DBCommandLineHelper', ([], {}), '()\n', (265, 267), False, 'from uitester.case_manager.database import DBCommandLineHelper, Tag, Case, DB\n'), ((327, 338), 'time.time', 'time.time', ([], {}), '()\n', (336, 338), False, 'import time\n'), ((1179, 1190),... |
"""
Checks that Pylint does not complain about django lazy proxy
when using gettext_lazy
"""
from django.utils.translation import gettext_lazy
gettext_lazy('{something}').format(something='lala')
| [
"django.utils.translation.gettext_lazy"
] | [((144, 171), 'django.utils.translation.gettext_lazy', 'gettext_lazy', (['"""{something}"""'], {}), "('{something}')\n", (156, 171), False, 'from django.utils.translation import gettext_lazy\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from dataIO import js, textfile
from crawl_trulia import trulia_urlencoder, trulia_htmlparser
from crawl_trulia.packages.crawlib.spider import spider
PATH = "test.html"
address = "22 Yew Rd"
city = "Baltimore"
zipcode = "21221"
# url = urlencoder.by_address_an... | [
"crawl_trulia.trulia_urlencoder.by_address_city_and_zipcode",
"dataIO.textfile.read",
"os.path.exists",
"crawl_trulia.trulia_htmlparser.get_house_detail",
"crawl_trulia.packages.crawlib.spider.spider.get_html",
"dataIO.textfile.write",
"dataIO.js.pprint"
] | [((354, 423), 'crawl_trulia.trulia_urlencoder.by_address_city_and_zipcode', 'trulia_urlencoder.by_address_city_and_zipcode', (['address', 'city', 'zipcode'], {}), '(address, city, zipcode)\n', (399, 423), False, 'from crawl_trulia import trulia_urlencoder, trulia_htmlparser\n'), ((543, 562), 'dataIO.textfile.read', 'te... |
import os
from setuptools import Extension, setup
try:
from Cython.Build import cythonize
except ImportError:
cythonize = None
extensions = [
Extension(
name="pvrtc_decoder",
version="1.0.2",
author="K0lb3",
author_email="",
description="A PVRTC decoder for PIL",
long_description=open('README.md', 'r... | [
"Cython.Build.cythonize",
"setuptools.setup"
] | [((1195, 1224), 'setuptools.setup', 'setup', ([], {'ext_modules': 'extensions'}), '(ext_modules=extensions)\n', (1200, 1224), False, 'from setuptools import Extension, setup\n'), ((1172, 1193), 'Cython.Build.cythonize', 'cythonize', (['extensions'], {}), '(extensions)\n', (1181, 1193), False, 'from Cython.Build import ... |
# func.py
import numpy as np
from numba import njit, jit, prange
#------------------------ Distance Functions -----------------------#
def corr_dist(A):
return 1 - np.corrcoef(A)
def abs_diff(A):
target_matrix = np.zeros((len(A), len(A)))
mat_dim = target_matrix.shape[0]
for r in range(mat_dim):
for c in ra... | [
"numpy.subtract",
"numpy.log",
"numpy.corrcoef",
"numba.njit",
"numpy.zeros",
"numpy.sqrt"
] | [((2052, 2071), 'numba.njit', 'njit', ([], {'parallel': '(True)'}), '(parallel=True)\n', (2056, 2071), False, 'from numba import njit, jit, prange\n'), ((1644, 1666), 'numpy.sqrt', 'np.sqrt', (['weighted_dist'], {}), '(weighted_dist)\n', (1651, 1666), True, 'import numpy as np\n'), ((1776, 1793), 'numpy.subtract', 'np.... |
from django.urls import path, include
from django.views.generic import TemplateView
from rest_framework.schemas import get_schema_view
from rest_framework.routers import DefaultRouter
from . import views
from scraping.xe import PropertyType, Xe
router = DefaultRouter()
router.register(r'load_config', views.LoadConfig... | [
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((256, 271), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (269, 271), False, 'from rest_framework.routers import DefaultRouter\n'), ((408, 428), 'django.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (415, 428), False, 'from django.urls import path, include\n')] |
import json
import os
import argparse
import re
from comment_getter import CommentGetter
from analyzer import Analyzer
from settings_loader import SettingsLoader
DEFAULT_SETTINGS_JSON_PATH = "default_settings.json"
YOUTUBE_VIDEO_ID_PATTERN = r"\?v=([^&]+)"
def get_timed_link(video_id, sec):
return f"https://www... | [
"json.dump",
"json.load",
"argparse.ArgumentParser",
"os.path.exists",
"comment_getter.CommentGetter",
"analyzer.Analyzer",
"settings_loader.SettingsLoader",
"re.search",
"os.path.join"
] | [((396, 437), 're.search', 're.search', (['YOUTUBE_VIDEO_ID_PATTERN', 'text'], {}), '(YOUTUBE_VIDEO_ID_PATTERN, text)\n', (405, 437), False, 'import re\n'), ((558, 583), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (581, 583), False, 'import argparse\n'), ((1153, 1195), 'os.path.exists', 'os.... |
from . import generator
import os
MD5 = generator.HASH_MD5
SHA1 = generator.HASH_SHA1
SHA224 = generator.HASH_SHA224
SHA256 = generator.HASH_SHA256
SHA384 = generator.HASH_SHA384
SHA512 = generator.HASH_SHA512
class Avatar:
DEFAULT_OUTPUT_PATH = os.path.join(os.getcwd(), "output/")
DEFAULT_FILENAME = "pagan"... | [
"os.getcwd",
"os.path.join",
"os.makedirs",
"os.path.exists"
] | [((266, 277), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (275, 277), False, 'import os\n'), ((2426, 2477), 'os.path.join', 'os.path.join', (['path', "('%s.%s' % (filename, extension))"], {}), "(path, '%s.%s' % (filename, extension))\n", (2438, 2477), False, 'import os\n'), ((2112, 2132), 'os.path.exists', 'os.path.exi... |
from app.main import bp
from app import db
from flask import render_template, url_for, flash, redirect, request, current_app
from flask_login import login_required, fresh_login_required, current_user
from app.main.forms import UpdateProfileForm, StatusForm, MessageForm
from app.models import Users, Status, Messages, Bl... | [
"flask.flash",
"app.main.bp.route",
"flask_login.current_user.follow",
"flask.request.form.get",
"app.models.Status.timestamp.desc",
"datetime.datetime.utcnow",
"flask.url_for",
"flask_login.current_user.add_friend",
"app.main.forms.StatusForm",
"app.main.forms.UpdateProfileForm",
"app.models.Me... | [((357, 395), 'app.main.bp.route', 'bp.route', (['"""/"""'], {'methods': "['GET', 'POST']"}), "('/', methods=['GET', 'POST'])\n", (365, 395), False, 'from app.main import bp\n'), ((397, 440), 'app.main.bp.route', 'bp.route', (['"""/index"""'], {'methods': "['GET', 'POST']"}), "('/index', methods=['GET', 'POST'])\n", (4... |
import os
import hashlib
import base64
from binascii import hexlify
import datetime
import getpass
import select
import socket
import sys
import time
import traceback
import json
import logging
import paramiko
import subprocess
import config
from wificlient import get_active_clients
logger = logging.getLogger('eonba... | [
"subprocess.Popen",
"os.remove",
"os.makedirs",
"paramiko.RSAKey.from_private_key_file",
"logging.StreamHandler",
"os.path.exists",
"socket.socket",
"os.rename",
"paramiko.Transport",
"logging.Formatter",
"hashlib.sha256",
"json.dumps",
"datetime.datetime.utcnow",
"datetime.datetime",
"w... | [((296, 326), 'logging.getLogger', 'logging.getLogger', (['"""eonbackup"""'], {}), "('eonbackup')\n", (313, 326), False, 'import logging\n'), ((363, 386), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (384, 386), False, 'import logging\n'), ((399, 472), 'logging.Formatter', 'logging.Formatter', ([... |
import warnings
import biorbd_casadi as biorbd
import numpy as np
from scipy import interpolate
from bioptim import (
OdeSolver,
Node,
OptimalControlProgram,
ConstraintFcn,
DynamicsFcn,
ObjectiveFcn,
QAndQDotBounds,
QAndQDotAndQDDotBounds,
ConstraintList,
ObjectiveList,
Dyna... | [
"bioptim.BoundsList",
"bioptim.OdeSolver.COLLOCATION",
"bioptim.ObjectiveList",
"bioptim.PhaseTransitionList",
"bioptim.InitialGuessList",
"biorbd_casadi.Model",
"numpy.zeros",
"bioptim.QAndQDotBounds",
"numpy.array",
"bioptim.OptimalControlProgram",
"numpy.linspace",
"bioptim.ConstraintList",... | [((864, 887), 'bioptim.OdeSolver.COLLOCATION', 'OdeSolver.COLLOCATION', ([], {}), '()\n', (885, 887), False, 'from bioptim import OdeSolver, Node, OptimalControlProgram, ConstraintFcn, DynamicsFcn, ObjectiveFcn, QAndQDotBounds, QAndQDotAndQDDotBounds, ConstraintList, ObjectiveList, DynamicsList, Bounds, BoundsList, Ini... |
# 需要安装 openpyxl, pandas, BeautifulSoup
# pip install 即可
import requests
import re
import pandas as pd
from bs4 import BeautifulSoup
region = ['ganjingzi', 'shahekou', 'zhongshan', 'xigang', 'gaoxinyuanqu']
#这个变量里放区域名称的拼音
regnam = ['甘井子', '沙河口', '中山', '西岗', '高新园']#这个变量里放区域名称的中文
page = 5
reTryTime = 5
pr... | [
"pandas.DataFrame",
"re.findall",
"requests.get",
"bs4.BeautifulSoup",
"re.compile"
] | [((3022, 3155), 'pandas.DataFrame', 'pd.DataFrame', (["{'总价': price, '每平米均价': uprice, '房屋名称': house, '格局': room, '面积': area, '朝向':\n direct, '装修': decorate, '电梯': elevator}"], {}), "({'总价': price, '每平米均价': uprice, '房屋名称': house, '格局': room, '面积':\n area, '朝向': direct, '装修': decorate, '电梯': elevator})\n", (3034, 3... |
from GetAllDanmuInfo_V2 import GetAllDanmuInfo
from GetClearCommandInstruction import GetClearCommandInstruction
from GetVideoTitle import GetVideoTitle
from ExportAllDanmu import ExportAllDanmu
from CheckLoginSituation import CheckLoginSituation
import base64
import Sqlite3_Bilibili
import sys
import os
headers = {
... | [
"Sqlite3_Bilibili.Bilibili_Danmu_Index_Server",
"os.makedirs",
"GetAllDanmuInfo_V2.GetAllDanmuInfo",
"ExportAllDanmu.ExportAllDanmu",
"os.path.exists",
"os.system",
"base64.b64decode",
"GetVideoTitle.GetVideoTitle",
"CheckLoginSituation.CheckLoginSituation",
"GetClearCommandInstruction.GetClearCom... | [((1133, 1161), 'GetClearCommandInstruction.GetClearCommandInstruction', 'GetClearCommandInstruction', ([], {}), '()\n', (1159, 1161), False, 'from GetClearCommandInstruction import GetClearCommandInstruction\n'), ((1181, 1241), 'Sqlite3_Bilibili.Bilibili_Danmu_Index_Server', 'Sqlite3_Bilibili.Bilibili_Danmu_Index_Serv... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, <NAME> (@briantist)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import subprocess
import re
import g... | [
"subprocess.run",
"getopt.getopt",
"pathlib.Path",
"re.findall",
"re.search",
"pathlib.Path.cwd",
"re.sub"
] | [((425, 452), 're.findall', 're.findall', (['patpat', 'pattern'], {}), '(patpat, pattern)\n', (435, 452), False, 'import re\n'), ((467, 499), 're.sub', 're.sub', (['patpat', '"""(.*?)"""', 'pattern'], {}), "(patpat, '(.*?)', pattern)\n", (473, 499), False, 'import re\n'), ((513, 538), 're.search', 're.search', (['match... |
import os
import random
import string
import time
from flask_testing import TestCase
from cellphonedb.src.app.cellphonedb_app import cellphonedb_app
from cellphonedb.src.local_launchers.local_collector_launcher import LocalCollectorLauncher
from cellphonedb.utils import utils
class CellphoneFlaskTestCase(TestCase):... | [
"os.remove",
"cellphonedb.src.local_launchers.local_collector_launcher.LocalCollectorLauncher",
"cellphonedb.src.app.cellphonedb_app.cellphonedb_app.cellphonedb.database_manager.database.drop_everything",
"os.path.realpath",
"random.choice",
"cellphonedb.src.app.cellphonedb_app.cellphonedb_app.cellphonedb... | [((562, 633), 'cellphonedb.src.app.cellphonedb_app.cellphonedb_app.cellphonedb.database_manager.database.drop_everything', 'cellphonedb_app.cellphonedb.database_manager.database.drop_everything', ([], {}), '()\n', (631, 633), False, 'from cellphonedb.src.app.cellphonedb_app import cellphonedb_app\n'), ((642, 708), 'cel... |
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
import re
#from kivy.config import Config
from telas import *
#from kivy.garden.mapview import MapView, MapMarker
from kivy.uix.textinput import TextInput
from kivy.clock import Clock, mainthread
from kivy.uix.popup import Popup
#from pl... | [
"re.sub",
"kivy.metrics.sp",
"re.compile"
] | [((1021, 1041), 're.compile', 're.compile', (['"""[^0-9]"""'], {}), "('[^0-9]')\n", (1031, 1041), False, 'import re\n'), ((974, 980), 'kivy.metrics.sp', 'sp', (['(20)'], {}), '(20)\n', (976, 980), False, 'from kivy.metrics import sp\n'), ((1165, 1191), 're.sub', 're.sub', (['pat', '""""""', 'substring'], {}), "(pat, ''... |
from celery import task
from c2g.models import ExamRecord, Course, Exam
from django.core.mail import EmailMessage, get_connection
from django.core.mail import send_mail
from storages.backends.s3boto import S3BotoStorage
import json
import settings
import datetime
FILE_DIR = getattr(settings, 'FILE_UPLOAD_TEMP_DIR', '... | [
"c2g.models.ExamRecord.objects.filter",
"c2g.models.ExamRecord.objects.values",
"json.loads",
"celery.task",
"c2g.models.Exam.objects.get",
"django.core.mail.EmailMessage",
"storages.backends.s3boto.S3BotoStorage",
"datetime.datetime.now",
"c2g.models.Course.objects.get"
] | [((552, 558), 'celery.task', 'task', ([], {}), '()\n', (556, 558), False, 'from celery import task\n'), ((641, 673), 'c2g.models.Course.objects.get', 'Course.objects.get', ([], {'id': 'course_id'}), '(id=course_id)\n', (659, 673), False, 'from c2g.models import ExamRecord, Course, Exam\n'), ((685, 713), 'c2g.models.Exa... |
from collections import namedtuple
from pytest import fixture, raises
from pyorbs.orbs import Orbs
@fixture
def orbs(tmp_path):
orbs = Orbs(str(tmp_path))
orbs.orbs = ['test']
return orbs
@fixture
def orb(mocker, orbs):
mocker.patch('pyorbs.orbs.exists', return_value=True)
return orbs.orb('tes... | [
"pyorbs.orbs.Orbs",
"pytest.raises",
"collections.namedtuple"
] | [((894, 912), 'pytest.raises', 'raises', (['ValueError'], {}), '(ValueError)\n', (900, 912), False, 'from pytest import fixture, raises\n'), ((954, 972), 'pytest.raises', 'raises', (['ValueError'], {}), '(ValueError)\n', (960, 972), False, 'from pytest import fixture, raises\n'), ((1374, 1392), 'pytest.raises', 'raises... |
from django.contrib import admin
from .models import GiropayTransaction
class GiropayTransactionAdmin(admin.ModelAdmin):
list_display = ('merchant_tx_id', 'reference', 'latest_response_code')
list_filter = ('latest_response_code',)
ordering = ('-created_at',)
fields = ('merchant_tx_id', 'reference', ... | [
"django.contrib.admin.site.register"
] | [((345, 409), 'django.contrib.admin.site.register', 'admin.site.register', (['GiropayTransaction', 'GiropayTransactionAdmin'], {}), '(GiropayTransaction, GiropayTransactionAdmin)\n', (364, 409), False, 'from django.contrib import admin\n')] |
import pytest
from scrapyscript import Job, Processor, ScrapyScriptException
from spiders import ParamReturnSpider, TitleSpider
def test_job_raises_if_no_spider_provided():
with pytest.raises(TypeError):
Job()
def test_create_valid_job():
spider = TitleSpider
job = Job(spider)
assert isinst... | [
"pytest.raises",
"scrapyscript.Job"
] | [((291, 302), 'scrapyscript.Job', 'Job', (['spider'], {}), '(spider)\n', (294, 302), False, 'from scrapyscript import Job, Processor, ScrapyScriptException\n'), ((185, 209), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeError)\n', (198, 209), False, 'import pytest\n'), ((219, 224), 'scrapyscript.Job', 'J... |
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../'))
import unittest
from test import test_rc
if __name__ == '__main__':
SeTestSuite = unittest.defaultTestLoader.discover(start_dir='./')
unittest.TextTestRunner(verbosity=2).run(unittest.TestSuite(SeTestSuite))
| [
"unittest.defaultTestLoader.discover",
"os.path.dirname",
"unittest.TextTestRunner",
"unittest.TestSuite"
] | [((177, 228), 'unittest.defaultTestLoader.discover', 'unittest.defaultTestLoader.discover', ([], {'start_dir': '"""./"""'}), "(start_dir='./')\n", (212, 228), False, 'import unittest\n'), ((54, 79), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (69, 79), False, 'import os\n'), ((274, 305), '... |
# Copyright 2014 Midokura SARL
#
# 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... | [
"mdts.tests.utils.utils.get_midonet_api",
"hamcrest.not_none",
"time.sleep",
"mdts.tests.utils.utils.check_all_midolman_hosts",
"mdts.tests.utils.utils.stop_midolman_agents",
"mdts.tests.utils.utils.start_midolman_agents",
"mdts.lib.physical_topology_manager.PhysicalTopologyManager",
"nose.plugins.att... | [((1138, 1230), 'mdts.lib.physical_topology_manager.PhysicalTopologyManager', 'PhysicalTopologyManager', (['"""../topologies/mmm_physical_test_midolman_and_interfaces.yaml"""'], {}), "(\n '../topologies/mmm_physical_test_midolman_and_interfaces.yaml')\n", (1161, 1230), False, 'from mdts.lib.physical_topology_manager... |