code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import re
pattern = r"(.+) \1"
"""Note, that "(.+) \1" is not the same as "(.+) (.+)", because \1 refers to
the first group's subexpression, which is the matched expression itself, and
not the regex pattern."""
match = re.match(pattern, "word word")
if match:
print("Match 1")
print(match.group(1))
print(... | [
"re.match"
] | [((222, 252), 're.match', 're.match', (['pattern', '"""word word"""'], {}), "(pattern, 'word word')\n", (230, 252), False, 'import re\n'), ((344, 370), 're.match', 're.match', (['pattern', '"""?! ?!"""'], {}), "(pattern, '?! ?!')\n", (352, 370), False, 'import re\n'), ((462, 490), 're.match', 're.match', (['pattern', '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
from setuptools import setup, find_packages
NAME = 'GolemFlavor'
DESCRIPTION = 'GolemFlavor: A Python package for Astrophysical Flavor analysis with GolemFit'
MAINTAINER = '<NAME>'
MAINTAINER_EMAIL = '<EMAIL>'
URL = 'https://github.com/ShiveshM/GolemFl... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join",
"io.open"
] | [((366, 391), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (381, 391), False, 'import os\n'), ((750, 781), 'os.path.join', 'os.path.join', (['here', '"""README.md"""'], {}), "(here, 'README.md')\n", (762, 781), False, 'import os\n'), ((1051, 1089), 'os.path.join', 'os.path.join', (['here', ... |
r"""
Piezo-elasticity problem - linear elastic material with piezoelectric
effects.
Find :math:`\ul{u}`, :math:`\phi` such that:
.. math::
- \omega^2 \int_{Y} \rho\ \ul{v} \cdot \ul{u}
+ \int_{Y} D_{ijkl}\ e_{ij}(\ul{v}) e_{kl}(\ul{u})
- \int_{Y_2} g_{kij}\ e_{ij}(\ul{v}) \nabla_k \phi
= 0
\;, \qu... | [
"numpy.tile",
"numpy.eye",
"numpy.ones",
"os.path.dirname",
"sfepy.discrete.fem.MeshIO.any_from_filename"
] | [((1055, 1080), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1070, 1080), False, 'import os\n'), ((1086, 1146), 'sfepy.discrete.fem.MeshIO.any_from_filename', 'MeshIO.any_from_filename', (['filename_mesh'], {'prefix_dir': 'conf_dir'}), '(filename_mesh, prefix_dir=conf_dir)\n', (1110, 1146)... |
import json
import time
from pybbn.graph.dag import Bbn
from pybbn.pptc.inferencecontroller import InferenceController
def do_it(join_tree):
InferenceController.reapply(join_tree, {0: [0.5, 0.5]})
with open('singly-bbn.json', 'r') as f:
s = time.time()
bbn = Bbn.from_dict(json.loads(f.read()))
e = ... | [
"time.time",
"pybbn.pptc.inferencecontroller.InferenceController.apply",
"pybbn.pptc.inferencecontroller.InferenceController.reapply"
] | [((148, 205), 'pybbn.pptc.inferencecontroller.InferenceController.reapply', 'InferenceController.reapply', (['join_tree', '{(0): [0.5, 0.5]}'], {}), '(join_tree, {(0): [0.5, 0.5]})\n', (175, 205), False, 'from pybbn.pptc.inferencecontroller import InferenceController\n'), ((254, 265), 'time.time', 'time.time', ([], {})... |
"""CLI entrypoint to shapi."""
import json
import click
from . import __version__
from .client import SHClient
sh_client = SHClient()
@click.group()
@click.version_option(version=__version__)
def cli() -> None:
"""SHApi - Software Heritage(SH) API.
A Python client to interact with software heritage API
... | [
"click.group",
"click.argument",
"click.version_option"
] | [((140, 153), 'click.group', 'click.group', ([], {}), '()\n', (151, 153), False, 'import click\n'), ((155, 196), 'click.version_option', 'click.version_option', ([], {'version': '__version__'}), '(version=__version__)\n', (175, 196), False, 'import click\n'), ((611, 642), 'click.argument', 'click.argument', (['"""url""... |
"""Script to download all the data we need for GPV experiments"""
import argparse
import logging
import os
import shutil
import tarfile
import tempfile
from collections import defaultdict
from os import makedirs
from os.path import exists, join, dirname
from tqdm import tqdm
from gpv2 import file_paths
from gpv2.dat... | [
"gpv2.utils.downloader.download_zip",
"os.path.exists",
"gpv2.utils.downloader.download_s3_folder",
"argparse.ArgumentParser",
"gpv2.utils.downloader.download_images",
"tqdm.tqdm",
"os.path.join",
"fiftyone.zoo.load_zoo_dataset",
"gpv2.utils.py_utils.add_stdout_logger",
"os.path.dirname",
"colle... | [((1240, 1276), 'os.path.join', 'join', (['file_paths.COCO_IMAGES', 'subset'], {}), '(file_paths.COCO_IMAGES, subset)\n', (1244, 1276), False, 'from os.path import exists, join, dirname\n'), ((4112, 4156), 'logging.info', 'logging.info', (['f"""Downloading DCE annotations"""'], {}), "(f'Downloading DCE annotations')\n"... |
from .base import GnuRecipe
import os
import shutil
class StandardNotesRecipe(GnuRecipe):
def __init__(self, *args, **kwargs):
super(StandardNotesRecipe, self).__init__(*args, **kwargs)
self.sha256 = '4ebfe83945062d665c85034929b5d6d0' \
'83d6baf1229addf0f6a9e68c608a5241'
... | [
"os.path.join"
] | [((1042, 1095), 'os.path.join', 'os.path.join', (['self.prefix_dir', '"""bin"""', '"""standardnotes"""'], {}), "(self.prefix_dir, 'bin', 'standardnotes')\n", (1054, 1095), False, 'import os\n')] |
import plotly.plotly as py
py.sign_in('rsjudka', 'APIKEY')
import plotly.graph_objs as go
import numpy as np
from collections import OrderedDict
#creating a list of various banned words across multiple websites
banned = []
with open('banned.txt', 'r') as banned_words:
for word in banned_words:
if... | [
"plotly.graph_objs.Figure",
"plotly.graph_objs.Heatmap",
"plotly.plotly.sign_in",
"plotly.plotly.iplot"
] | [((28, 59), 'plotly.plotly.sign_in', 'py.sign_in', (['"""rsjudka"""', '"""APIKEY"""'], {}), "('rsjudka', 'APIKEY')\n", (38, 59), True, 'import plotly.plotly as py\n'), ((3049, 3084), 'plotly.graph_objs.Figure', 'go.Figure', ([], {'data': 'data', 'layout': 'layout'}), '(data=data, layout=layout)\n', (3058, 3084), True, ... |
#!/usr/bin/env python
# -*- encoding: utf-8
import pytest
from text_transforms import apply_markdown_blockquotes, cleanup_blockquote_whitespace
@pytest.mark.parametrize('description, expected', [
("hello world", "hello world"),
("<blockquote>hello world</blockquote>", "<blockquote>hello world</blockquote>")... | [
"pytest.mark.parametrize",
"text_transforms.apply_markdown_blockquotes",
"text_transforms.cleanup_blockquote_whitespace"
] | [((149, 897), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""description, expected"""', '[(\'hello world\', \'hello world\'), (\'<blockquote>hello world</blockquote>\',\n \'<blockquote>hello world</blockquote>\'), (\n """<blockquote>\nhello world</blockquote>""",\n \'<blockquote>hello world</block... |
#! /usr/bin/env python
# encoding: utf-8
from waflib import Task, Options, Utils, Errors
from waflib.TaskGen import extension, feature, after_method
import os
from tempfile import NamedTemporaryFile
from contextlib import contextmanager
@contextmanager
def Wrapper(script):
wrapper = NamedTemporaryFile(delete=Fal... | [
"waflib.Errors.WafError",
"waflib.TaskGen.feature",
"os.chmod",
"waflib.Utils.subprocess.Popen",
"waflib.TaskGen.after_method",
"os.unlink",
"tempfile.NamedTemporaryFile"
] | [((1427, 1452), 'waflib.TaskGen.after_method', 'after_method', (['"""apply_tut"""'], {}), "('apply_tut')\n", (1439, 1452), False, 'from waflib.TaskGen import extension, feature, after_method\n'), ((1454, 1469), 'waflib.TaskGen.feature', 'feature', (['"""gcov"""'], {}), "('gcov')\n", (1461, 1469), False, 'from waflib.Ta... |
#!/usr/bin/python3
import argparse
import csv
import sys
import os.path
# ./merge.py -a file1 -b file2 -1 name1 -2 name2 -c name_after
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument(
"-a",
"--file1",
required=True,
help="provide filename for f... | [
"csv.DictReader",
"csv.reader",
"argparse.ArgumentParser"
] | [((177, 202), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (200, 202), False, 'import argparse\n'), ((2407, 2440), 'csv.DictReader', 'csv.DictReader', (['f'], {'delimiter': '"""\t"""'}), "(f, delimiter='\\t')\n", (2421, 2440), False, 'import csv\n'), ((3347, 3376), 'csv.reader', 'csv.reader',... |
import requests
def download(url, path, filename):
r = requests.get(url)
f = open(path+filename,'wb');
for chunk in r.iter_content(chunk_size=255):
if chunk:
f.write(chunk)
f.close() | [
"requests.get"
] | [((60, 77), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (72, 77), False, 'import requests\n')] |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 2 16:14:47 2019
@author: <NAME>
"""
import numpy as np
import matplotlib.pyplot as plt
from lbl_ir.data_objects.ir_map import sample_info, ir_map
def lorentzian(x,x0,gamma=10):
return 1/(np.power((x-x0)/gamma,2)+1)
def gaussian(x,x0=0,sigma=10):
return 1/... | [
"numpy.random.rand",
"lbl_ir.data_objects.ir_map.ir_map",
"numpy.where",
"matplotlib.pyplot.plot",
"numpy.linspace",
"numpy.random.seed",
"numpy.flipud",
"numpy.random.multivariate_normal",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.py... | [((3933, 3966), 'numpy.random.seed', 'np.random.seed', ([], {'seed': 'random_state'}), '(seed=random_state)\n', (3947, 3966), True, 'import numpy as np\n'), ((4070, 4120), 'numpy.zeros', 'np.zeros', (['(self.ptsPerCluster * self.Nclusters, 3)'], {}), '((self.ptsPerCluster * self.Nclusters, 3))\n', (4078, 4120), True, '... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as sts
from pprint import pprint
import os
from mnkutil import *
sns.set_style('white')
sns.set_style('white')
sns.set_context('poster')
sns.set_palette(['#E97F02', '#490A3D', '#BD1550'])
def get_computer_se... | [
"os.listdir",
"seaborn.set_palette",
"pandas.read_csv",
"seaborn.set_context",
"seaborn.set_style",
"pandas.concat"
] | [((177, 199), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (190, 199), True, 'import seaborn as sns\n'), ((200, 222), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (213, 222), True, 'import seaborn as sns\n'), ((223, 248), 'seaborn.set_context', 'sns.set_cont... |
import numpy
from pymodm import MongoModel, fields, EmbeddedMongoModel
from sklearn import metrics
from sklearn.metrics import confusion_matrix
from newsgac.common.fields import ObjectField
from newsgac.common.mixins import CreatedUpdated, DeleteObjectsMixin
from newsgac.learners import LearnerSVC
from newsgac.learne... | [
"sklearn.metrics.f1_score",
"sklearn.metrics.confusion_matrix",
"pymodm.fields.DateTimeField",
"newsgac.pipelines.get_sk_pipeline.get_sk_pipeline",
"newsgac.common.fields.ObjectField",
"newsgac.tasks.models.TrackedTask",
"sklearn.metrics.precision_score",
"pymodm.fields.FloatField",
"numpy.array",
... | [((604, 623), 'pymodm.fields.FloatField', 'fields.FloatField', ([], {}), '()\n', (621, 623), False, 'from pymodm import MongoModel, fields, EmbeddedMongoModel\n'), ((643, 662), 'pymodm.fields.FloatField', 'fields.FloatField', ([], {}), '()\n', (660, 662), False, 'from pymodm import MongoModel, fields, EmbeddedMongoMode... |
# Generated by Django 2.2.5 on 2019-10-30 23:58
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | [
"django.db.models.OneToOneField",
"django.db.models.UniqueConstraint",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.SmallIntegerField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.Cha... | [((247, 304), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (278, 304), False, 'from django.db import migrations, models\n'), ((2621, 2700), 'django.db.models.UniqueConstraint', 'models.UniqueConstraint', ([], {'fields... |
from custom_gym.envs.myxpc import xpc2 as xpc
def top_left():
print('top_left')
with xpc.XPlaneConnect() as client:
# Verify connection
try:
# If X-Plane does not respond to the request, a timeout error
# will be raised.
client.getDREF("sim/test/test_float"... | [
"custom_gym.envs.myxpc.xpc2.XPlaneConnect"
] | [((96, 115), 'custom_gym.envs.myxpc.xpc2.XPlaneConnect', 'xpc.XPlaneConnect', ([], {}), '()\n', (113, 115), True, 'from custom_gym.envs.myxpc import xpc2 as xpc\n'), ((588, 607), 'custom_gym.envs.myxpc.xpc2.XPlaneConnect', 'xpc.XPlaneConnect', ([], {}), '()\n', (605, 607), True, 'from custom_gym.envs.myxpc import xpc2 ... |
from airflow.models import DAG
from airflow.operators.python_operator import PythonOperator
from datetime import timedelta, date
from airflow.utils.dates import days_ago
from pathlib import Path
default_args = {
'owner': 'airflow',
'retries': 2,
'retry_delay': timedelta(minutes=1)
}
dag = DAG(
'logana... | [
"datetime.timedelta",
"airflow.operators.python_operator.PythonOperator",
"airflow.utils.dates.days_ago"
] | [((904, 1051), 'airflow.operators.python_operator.PythonOperator', 'PythonOperator', ([], {'task_id': '"""create_directory"""', 'python_callable': 'analyze_file', 'provide_context': '(True)', 'op_kwargs': "{'file': 'create_directory'}", 'dag': 'dag'}), "(task_id='create_directory', python_callable=analyze_file,\n pr... |
from functools import partial
import numpy as np
import matplotlib.pyplot as plt
from open_spiel.python.project.part_1.dynamics_lenient_boltzmannq import dynamics_lb
# True for field plot, False for phase plot
PLOT_FLAG = False
payoff_stag_hunt = np.array([[[1, 0], [2 / 3, 2 / 3]], [[1, 2 / 3], [0, 2 / 3]]])
# Sta... | [
"numpy.array",
"matplotlib.pyplot.figure",
"functools.partial",
"matplotlib.pyplot.show"
] | [((251, 313), 'numpy.array', 'np.array', (['[[[1, 0], [2 / 3, 2 / 3]], [[1, 2 / 3], [0, 2 / 3]]]'], {}), '([[[1, 0], [2 / 3, 2 / 3]], [[1, 2 / 3], [0, 2 / 3]]])\n', (259, 313), True, 'import numpy as np\n'), ((333, 361), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 10)'}), '(figsize=(10, 10))\n', (3... |
import functools
import flask_login
import signals
import inspect
from mocha import (utils,
abort,
request,
)
from mocha.core import apply_function_to_members
from . import (is_authenticated,
not_authenticated,
ROLES_ADMIN,
... | [
"mocha.abort",
"mocha.core.apply_function_to_members",
"flask_login.logout_user",
"signals.user_logout",
"functools.wraps",
"mocha.utils.get_decorators_list",
"inspect.isclass",
"flask_login.current_user.has_any_roles"
] | [((803, 824), 'inspect.isclass', 'inspect.isclass', (['func'], {}), '(func)\n', (818, 824), False, 'import inspect\n'), ((1504, 1525), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (1519, 1525), False, 'import functools\n'), ((1731, 1749), 'functools.wraps', 'functools.wraps', (['f'], {}), '(f)\n', ... |
import re
import pandas as pd
df = pd.read_json('jawiki-country.json', lines=True)
text = df.query('title=="イギリス"')['text'].values[0]
for section in re.findall(r'(=+)([^=]+)\1\n', text):
print('{}: {}'.format(section[0], len(section[0]) - 1))
| [
"re.findall",
"pandas.read_json"
] | [((36, 83), 'pandas.read_json', 'pd.read_json', (['"""jawiki-country.json"""'], {'lines': '(True)'}), "('jawiki-country.json', lines=True)\n", (48, 83), True, 'import pandas as pd\n'), ((150, 187), 're.findall', 're.findall', (['"""(=+)([^=]+)\\\\1\\\\n"""', 'text'], {}), "('(=+)([^=]+)\\\\1\\\\n', text)\n", (160, 187)... |
# You can freely modify this file.
# However, you need to have a function that is named get_model and returns a Keras Model.
import tensorflow as tf
from tensorflow.python.keras import models
from tensorflow.python.keras import layers
from tensorflow.python.keras import utils
def get_model():
img_height = 256
... | [
"tensorflow.keras.applications.ResNet50"
] | [((370, 414), 'tensorflow.keras.applications.ResNet50', 'tf.keras.applications.ResNet50', ([], {'weights': 'None'}), '(weights=None)\n', (400, 414), True, 'import tensorflow as tf\n')] |
from django.shortcuts import render
from django.views import View
from portfolio.utils import get_repo_data
class IndexView(View):
template_name = 'portfolio/index.html'
def get(self, request):
repos = get_repo_data()
return render(request, self.template_name, {'repos': repos[:6]})
class P... | [
"django.shortcuts.render",
"portfolio.utils.get_repo_data"
] | [((222, 237), 'portfolio.utils.get_repo_data', 'get_repo_data', ([], {}), '()\n', (235, 237), False, 'from portfolio.utils import get_repo_data\n'), ((253, 310), 'django.shortcuts.render', 'render', (['request', 'self.template_name', "{'repos': repos[:6]}"], {}), "(request, self.template_name, {'repos': repos[:6]})\n",... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.hello, name='hello'),
path('filter', views.filter_this, name='filter'),
]
| [
"django.urls.path"
] | [((75, 110), 'django.urls.path', 'path', (['""""""', 'views.hello'], {'name': '"""hello"""'}), "('', views.hello, name='hello')\n", (79, 110), False, 'from django.urls import path\n'), ((116, 164), 'django.urls.path', 'path', (['"""filter"""', 'views.filter_this'], {'name': '"""filter"""'}), "('filter', views.filter_th... |
from django.http import HttpResponse
from django.template import loader
from django.shortcuts import render_to_response
import requests
import json
#Bridge Threshold
minPanel = 5
maxPanel = 50
#Status Constant
WALK = 1
RUN = 2
BACK = 3
LEAVE = 4
STOP = 5
#Registration Constant
GHC = ... | [
"requests.post",
"json.dumps",
"django.template.loader.get_template"
] | [((437, 479), 'django.template.loader.get_template', 'loader.get_template', (['"""demoshow/index.html"""'], {}), "('demoshow/index.html')\n", (456, 479), False, 'from django.template import loader\n'), ((1240, 1284), 'django.template.loader.get_template', 'loader.get_template', (['"""demoshow/process.html"""'], {}), "(... |
import sys
if __name__ == "__main__":
from common import powerset
from log_star_decider import _is_log_star_solvable
else:
from .common import powerset
from .log_star_decider import _is_log_star_solvable
from .constant_synthesizer import find_algorithm
VERBOSE = False
def is_constant_solvable(co... | [
"common.powerset"
] | [((398, 414), 'common.powerset', 'powerset', (['labels'], {}), '(labels)\n', (406, 414), False, 'from common import powerset\n')] |
# Generated by Django 2.1.7 on 2019-03-01 13:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('menu', '0008_auto_20181120_0041'),
]
operations = [
migrations.AlterField(
model_name='menuitem',
name='all_day',
... | [
"django.db.models.BooleanField"
] | [((336, 382), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'blank': '(True)', 'default': '(False)'}), '(blank=True, default=False)\n', (355, 382), False, 'from django.db import migrations, models\n'), ((508, 554), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'blank': '(True)', 'default... |
import os
import argparse
import socket
from id_driver import IDDriver
print("NAAL_FPGA board start")
parser = argparse.ArgumentParser(
description='Generic script for running the ID Extractor on the ' +
'FPGA board.')
# Socket communication arguments
parser.add_argument(
'--host_ip', type=str, default='... | [
"socket.socket",
"argparse.ArgumentParser",
"id_driver.IDDriver"
] | [((113, 224), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': "('Generic script for running the ID Extractor on the ' + 'FPGA board.')"}), "(description=\n 'Generic script for running the ID Extractor on the ' + 'FPGA board.')\n", (136, 224), False, 'import argparse\n'), ((1355, 1365), 'id... |
import sharebuyCalculator , sharesellCalculator
from django.contrib import admin
from django.urls import path , include
from .import views
urlpatterns = [
path('',views.index,name='home'),
path('share-buy-calculator/',include('sharebuyCalculator.urls')),
path('share-sell-calculator/',include('sharesellCal... | [
"django.urls.path",
"django.urls.include"
] | [((161, 195), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""home"""'}), "('', views.index, name='home')\n", (165, 195), False, 'from django.urls import path, include\n'), ((341, 372), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (345, 372... |
import pandas as pd
import numpy as np
class Maze:
def __init__(self,goal=[3,3],trap1=[0,3],trap2=[3,1],position=0):
pass
'''
def printTable(self,p=None):
p = random_position()
table = pd.DataFrame(np.zeros((4,4),dtype=int),columns=None)
table.iloc[3,3]='X'
... | [
"pandas.DataFrame",
"numpy.random.randint",
"numpy.zeros"
] | [((783, 807), 'numpy.random.randint', 'np.random.randint', (['(0)', '(16)'], {}), '(0, 16)\n', (800, 807), True, 'import numpy as np\n'), ((1459, 1598), 'pandas.DataFrame', 'pd.DataFrame', (["{'linhas': [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3], 'colunas': [0,\n 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]}"]... |
import pytest
import netCDF4
from cloudnetpy.utils import seconds2hours
import os
YEAR = 2020
N_VALID_FILES = 3
N_TIME_IN_SINGLE_FILE = 10
class TestCHM15kConcatenation:
@pytest.fixture(autouse=True)
def _fetch_params(self, params):
self._full_path = params['full_path']
def test_file_arrived(se... | [
"pytest.fixture",
"cloudnetpy.utils.seconds2hours",
"netCDF4.Dataset",
"os.path.isfile"
] | [((179, 207), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (193, 207), False, 'import pytest\n'), ((340, 371), 'os.path.isfile', 'os.path.isfile', (['self._full_path'], {}), '(self._full_path)\n', (354, 371), False, 'import os\n'), ((429, 461), 'netCDF4.Dataset', 'netCDF4.Dataset... |
from collections import defaultdict
from math import exp, ceil
from typing import List
from jchord.midi import MidiNote
# Notes separated by less than this much belong to one chord
MIN_SEP_INTERVAL = 0.1
# Bucket size for the KDE algorithm
KDE_BUCKETS_PER_SECOND = 1 / MIN_SEP_INTERVAL
def kernel_defau... | [
"math.ceil",
"math.exp",
"collections.defaultdict"
] | [((384, 424), 'math.exp', 'exp', (['(-(distance / MIN_SEP_INTERVAL) ** 2)'], {}), '(-(distance / MIN_SEP_INTERVAL) ** 2)\n', (387, 424), False, 'from math import exp, ceil\n'), ((1582, 1599), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1593, 1599), False, 'from collections import defaultdict\... |
import logging
from functools import partial
import cv2
import os
import json
from collections import defaultdict
import numpy as np
import pandas as pd
import torch
from tensorboardX import SummaryWriter
from torch.utils.data import DataLoader
from evaluation.inception import InceptionScore
from sg2im.data.dataset_par... | [
"logging.getLogger",
"sg2im.utils.log_scalar_dict",
"evaluation.inception.InceptionScore",
"sg2im.model.get_conv_converse",
"sg2im.meta_models.MetaGeneratorModel",
"scripts.args.get_args",
"numpy.mean",
"tensorboardX.SummaryWriter",
"torch.mean",
"sg2im.data.dataset_params.get_dataset",
"scripts... | [((5334, 5373), 'sg2im.data.dataset_params.get_dataset', 'get_dataset', (['args.dataset', '"""test"""', 'args'], {}), "(args.dataset, 'test', args)\n", (5345, 5373), False, 'from sg2im.data.dataset_params import get_dataset, get_collate_fn\n'), ((5419, 5439), 'sg2im.data.dataset_params.get_collate_fn', 'get_collate_fn'... |
import string
from model.IdentifierModel import IdentifierModel
from nltk.corpus import stopwords
from resources import stopwords_smart
class StopWordModel():
stop_words_nltk: set = None
stop_words_smart: set = None
def __init__(self):
self.stop_words_nltk = set(stopwords.words("english"))
... | [
"nltk.corpus.stopwords.words"
] | [((285, 311), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (300, 311), False, 'from nltk.corpus import stopwords\n')] |
# -*- coding: utf-8 -*-
import re
import urllib.request
from bs4 import BeautifulSoup
#存储全国大学数据
from spider_colleage.DBUtil import DBUtil
index_url = 'http://www.huaue.com/gxmd.htm'
def load_page_content(link):
url_request = urllib.request.Request(link)
url_response = urllib.request.urlopen(url_request)
... | [
"spider_colleage.DBUtil.DBUtil",
"re.compile"
] | [((599, 614), 'spider_colleage.DBUtil.DBUtil', 'DBUtil', (['"""think"""'], {}), "('think')\n", (605, 614), False, 'from spider_colleage.DBUtil import DBUtil\n'), ((529, 567), 're.compile', 're.compile', (['"""http://www.huaue.com/gx*"""'], {}), "('http://www.huaue.com/gx*')\n", (539, 567), False, 'import re\n')] |
# Generated by Django 3.2.9 on 2021-11-27 14:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0010_alter_courses_name'),
]
operations = [
migrations.AddField(
model_name='student',
name='initial',
... | [
"django.db.models.CharField"
] | [((337, 400), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""test .t"""', 'max_length': '(35)', 'unique': '(True)'}), "(default='test .t', max_length=35, unique=True)\n", (353, 400), False, 'from django.db import migrations, models\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 02 20:35:11 2016
@author: perrytsao
"""
import numpy as np
import matplotlib.pyplot as plt
import sys
import glob
import os
plt.close('all')
if len(sys.argv)>1:
fltname='flight_data\\'+sys.argv[1]
else:
search_dir = "flight_data\\"
# remove anything fro... | [
"matplotlib.pyplot.hold",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"glob.glob",
"os.path.getmtime",
"numpy.load",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((174, 190), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (183, 190), True, 'import matplotlib.pyplot as plt\n'), ((761, 798), 'numpy.load', 'np.load', (["(fltname + '_controldata.npy')"], {}), "(fltname + '_controldata.npy')\n", (768, 798), True, 'import numpy as np\n'), ((813, 854), 'num... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 7 23:24:19 2019
@author: usuario
"""
import cv2
import numpy
cam = cv2.VideoCapture(0)
kernel = numpy.ones((5 ,5), numpy.uint8)
while (True):
ret, frame = cam.read()
rangomax = numpy.array([50, 255, 50]) # B, G, R
rangomin = numpy.... | [
"numpy.ones",
"cv2.inRange",
"cv2.imshow",
"numpy.array",
"cv2.morphologyEx",
"cv2.circle",
"cv2.VideoCapture",
"cv2.waitKey",
"cv2.boundingRect"
] | [((142, 161), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (158, 161), False, 'import cv2\n'), ((171, 202), 'numpy.ones', 'numpy.ones', (['(5, 5)', 'numpy.uint8'], {}), '((5, 5), numpy.uint8)\n', (181, 202), False, 'import numpy\n'), ((262, 288), 'numpy.array', 'numpy.array', (['[50, 255, 50]'], {}),... |
#!/usr/bin/env python3
# check out every commit added by the current branch, blackify them,
# and generate diffs to reconstruct the original commits, but then
# blackified
import logging
import os
import sys
from subprocess import check_output, run, Popen, PIPE
def git(*args: str) -> str:
return check_output(["gi... | [
"logging.getLogger",
"os.path.exists",
"subprocess.check_output",
"logging.StreamHandler",
"argparse.FileType",
"argparse.ArgumentParser",
"subprocess.Popen",
"subprocess.run"
] | [((2509, 2534), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2532, 2534), False, 'import argparse\n'), ((2769, 2796), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2786, 2796), False, 'import logging\n'), ((663, 685), 'os.path.exists', 'os.path.exists', (['""... |
"""
Neucore API
Client library of Neucore API # noqa: E501
The version of the OpenAPI document: 1.26.0
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import neucore_api
from neucore_api.model.eve_login import EveLogin
from neucore_api.model.group import Group
from neuc... | [
"unittest.main"
] | [((824, 839), 'unittest.main', 'unittest.main', ([], {}), '()\n', (837, 839), False, 'import unittest\n')] |
"""Test the 'services.py' module."""
from graphviz import Digraph
from stochastic_service_composition.rendering import service_to_graphviz
from stochastic_service_composition.services import Service, build_system_service
class TestInitialization:
"""Test class to test initialization and getters."""
@classme... | [
"stochastic_service_composition.rendering.service_to_graphviz",
"stochastic_service_composition.services.build_system_service",
"stochastic_service_composition.services.Service"
] | [((1926, 1996), 'stochastic_service_composition.services.build_system_service', 'build_system_service', (['kitchen_exhaust_fan_device', 'bathroom_door_device'], {}), '(kitchen_exhaust_fan_device, bathroom_door_device)\n', (1946, 1996), False, 'from stochastic_service_composition.services import Service, build_system_se... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'stockswindow.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore,... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QTableWidget",
"PyQt5.QtWidgets.QMainWindow.setCentralWidget",
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QMainWindow.setStatusBar",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QStatusBar",
"pyqtgraph.PlotWidget... | [((4394, 4416), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (4406, 4416), False, 'from PyQt5.QtWidgets import QApplication, QDialog, QMainWindow, QMessageBox\n'), ((1029, 1068), 'PyQt5.QtWidgets.QMainWindow.setObjectName', 'QMainWindow.setObjectName', (['"""MainWindow"""'], {}), ... |
# Generated by Django 2.2.6 on 2019-11-07 15:55
from django.db import migrations, models
import django.db.models.deletion
def move_data(apps, schema_editor):
Storage = apps.get_model('storage', 'Storage')
Device = apps.get_model('storage', 'Device')
queryset = Storage.objects.all()
for storage in que... | [
"django.db.models.AutoField",
"django.db.migrations.RunPython",
"django.db.migrations.RemoveField",
"django.db.models.ForeignKey"
] | [((2911, 2942), 'django.db.migrations.RunPython', 'migrations.RunPython', (['move_data'], {}), '(move_data)\n', (2931, 2942), False, 'from django.db import migrations, models\n'), ((2952, 3009), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""storage"""', 'name': '"""part"""'}), "(... |
import glob
import os
from setuptools import setup, find_packages
here = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(here, "README.md")) as f:
long_description = f.read()
setup(
name="spire-pipeline",
version="1.2.0",
description="Run software pipelines using doit",
lon... | [
"os.path.abspath",
"setuptools.find_packages",
"os.path.join"
] | [((91, 116), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (106, 116), False, 'import os\n'), ((128, 159), 'os.path.join', 'os.path.join', (['here', '"""README.md"""'], {}), "(here, 'README.md')\n", (140, 159), False, 'import os\n'), ((1050, 1082), 'setuptools.find_packages', 'find_packages'... |
# -*- coding: utf-8 -*-
import math
# The length of the shoulder in metres.
S_LEN = 0.065
# The length of the elbow in metres.
E_LEN = 0.12
# The precision of the angles returned.
PRECISION = 3
# Conversion factor from radians to degrees.
RAD_TO_DEG = 180 / math.pi
def calcAngles(objPos):
"""
Calculate ... | [
"math.sqrt",
"math.atan2"
] | [((2720, 2748), 'math.sqrt', 'math.sqrt', (['(x1 ** 2 + y1 ** 2)'], {}), '(x1 ** 2 + y1 ** 2)\n', (2729, 2748), False, 'import math\n'), ((840, 872), 'math.sqrt', 'math.sqrt', (['(xObj ** 2 + yObj ** 2)'], {}), '(xObj ** 2 + yObj ** 2)\n', (849, 872), False, 'import math\n'), ((1873, 1905), 'math.sqrt', 'math.sqrt', ([... |
import simtk.unit as units
from intermol.decorators import accepts_compatible_units
from intermol.forces.abstract_angle_type import AbstractAngleType
class QuarticAngleType(AbstractAngleType):
__slots__ = ['theta', 'C0', 'C1', 'C2', 'C3', 'C4', 'c']
@accepts_compatible_units(None, None, None,
... | [
"intermol.decorators.accepts_compatible_units",
"intermol.forces.abstract_angle_type.AbstractAngleType.__init__"
] | [((263, 590), 'intermol.decorators.accepts_compatible_units', 'accepts_compatible_units', (['None', 'None', 'None'], {'theta': 'units.degrees', 'C0': 'units.kilojoules_per_mole', 'C1': '(units.kilojoules_per_mole * units.radians ** -1)', 'C2': '(units.kilojoules_per_mole * units.radians ** -2)', 'C3': '(units.kilojoule... |
# -*- coding: utf-8 -*-
#VERSION: 1.1
#AUTHORS: <NAME> (<EMAIL>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... | [
"html.parser.HTMLParser.__init__",
"novaprinter.prettyPrinter"
] | [((5091, 5110), 'novaprinter.prettyPrinter', 'prettyPrinter', (['each'], {}), '(each)\n', (5104, 5110), False, 'from novaprinter import prettyPrinter\n'), ((1857, 1882), 'html.parser.HTMLParser.__init__', 'HTMLParser.__init__', (['self'], {}), '(self)\n', (1876, 1882), False, 'from html.parser import HTMLParser\n')] |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from typing import Pattern
from recognizers_text.utilities import RegExpUtility
from ...resources.italian_date_time import ItalianDateTime
from ..base_date import DateTimeUtilityConfiguration
class ItalianDateTimeUtilityC... | [
"recognizers_text.utilities.RegExpUtility.get_safe_reg_exp"
] | [((1680, 1738), 'recognizers_text.utilities.RegExpUtility.get_safe_reg_exp', 'RegExpUtility.get_safe_reg_exp', (['ItalianDateTime.LaterRegex'], {}), '(ItalianDateTime.LaterRegex)\n', (1710, 1738), False, 'from recognizers_text.utilities import RegExpUtility\n'), ((1778, 1840), 'recognizers_text.utilities.RegExpUtility.... |
# -*- coding: utf-8 -*-
"""DataSource views for creating and viewing the data source."""
import logging
from copy import deepcopy
from datetime import datetime
from typing import List, Optional
from uuid import uuid4
from flask.blueprints import Blueprint
from flask.globals import request
from flask.json import jsonif... | [
"logging.getLogger",
"chaos_genius.controllers.data_source_controller.update_third_party",
"chaos_genius.connectors.get_view_list",
"chaos_genius.controllers.data_source_controller.used_data_source_types",
"chaos_genius.databases.models.data_source_model.DataSource.meta_info",
"chaos_genius.connectors.get... | [((2217, 2255), 'flask.blueprints.Blueprint', 'Blueprint', (['"""api_data_source"""', '__name__'], {}), "('api_data_source', __name__)\n", (2226, 2255), False, 'from flask.blueprints import Blueprint\n'), ((2266, 2293), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2283, 2293), False, '... |
import typing
class ReadStdin:
def __call__(
self,
) -> bytes:
return next(self.__chunks)
def __init__(
self,
) -> typing.NoReturn:
import sys
self.__buf = (
sys.stdin.buffer
)
self.__chunks = (
self.__read_chunks()
)
def int(
self,
) -> int:
return ... | [
"numpy.argsort",
"numpy.zeros",
"numpy.vstack",
"sys.stdin.read",
"numpy.arange"
] | [((3104, 3126), 'numpy.zeros', 'np.zeros', (['n'], {'dtype': 'int'}), '(n, dtype=int)\n', (3112, 3126), True, 'import numpy as np\n'), ((3318, 3330), 'numpy.arange', 'np.arange', (['n'], {}), '(n)\n', (3327, 3330), True, 'import numpy as np\n'), ((3395, 3414), 'numpy.argsort', 'np.argsort', (['a[:, 0]'], {}), '(a[:, 0]... |
import os
import subprocess
import sys
import time
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import as_completed
from typing import Callable
from typing import List
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(curr... | [
"sys.path.insert",
"os.path.isfile",
"os.path.dirname",
"sys.exit",
"time.time"
] | [((300, 328), 'os.path.dirname', 'os.path.dirname', (['current_dir'], {}), '(current_dir)\n', (315, 328), False, 'import os\n'), ((329, 359), 'sys.path.insert', 'sys.path.insert', (['(0)', 'parent_dir'], {}), '(0, parent_dir)\n', (344, 359), False, 'import sys\n'), ((1431, 1442), 'time.time', 'time.time', ([], {}), '()... |
import re
import collections
from typing import Dict, Tuple, List
from pathlib import Path
BagGraph = Dict[str, List[Tuple[str, int]]]
def parse_input() -> BagGraph:
with open(Path(__file__).parent / "input.txt") as f:
rules = [line.strip().replace(",", "") for line in f]
pattern = r"(\w+ \w+) bag... | [
"re.findall",
"collections.deque",
"pathlib.Path",
"re.match"
] | [((964, 993), 'collections.deque', 'collections.deque', (['[(bag, 1)]'], {}), '([(bag, 1)])\n', (981, 993), False, 'import collections\n'), ((545, 582), 're.findall', 're.findall', (['inner_pattern', 'inner_bags'], {}), '(inner_pattern, inner_bags)\n', (555, 582), False, 'import re\n'), ((458, 481), 're.match', 're.mat... |
import os, sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import unittest
import scikit_posthocs._posthocs as sp
import seaborn as sb
import numpy as np
class TestPosthocs(unittest.TestCase):
df = sb.load_dataset("exercise")
df_bn = np.array([[4,3,4,4,5,6,3],
... | [
"scikit_posthocs._posthocs.posthoc_vanwaerden",
"numpy.allclose",
"scikit_posthocs._posthocs.posthoc_durbin",
"scikit_posthocs._posthocs.posthoc_conover",
"seaborn.load_dataset",
"scikit_posthocs._posthocs.posthoc_conover_friedman",
"numpy.array",
"os.path.dirname",
"scikit_posthocs._posthocs.postho... | [((241, 268), 'seaborn.load_dataset', 'sb.load_dataset', (['"""exercise"""'], {}), "('exercise')\n", (256, 268), True, 'import seaborn as sb\n'), ((281, 360), 'numpy.array', 'np.array', (['[[4, 3, 4, 4, 5, 6, 3], [1, 2, 3, 5, 6, 7, 7], [1, 2, 6, 4, 1, 5, 1]]'], {}), '([[4, 3, 4, 4, 5, 6, 3], [1, 2, 3, 5, 6, 7, 7], [1, ... |
import sys
import platform
import skimage
import vispy
import scipy
import numpy
import dask
from qtpy import QtCore, QtGui, API_NAME, PYSIDE_VERSION, PYQT_VERSION
from qtpy.QtCore import Qt
from qtpy.QtWidgets import (
QVBoxLayout,
QTextEdit,
QDialog,
QLabel,
QPushButton,
QHBoxLayout,
)
impor... | [
"qtpy.QtWidgets.QVBoxLayout",
"qtpy.QtWidgets.QLabel",
"platform.platform",
"vispy.sys_info",
"sys.version.replace",
"qtpy.QtGui.QGuiApplication.clipboard",
"qtpy.QtWidgets.QHBoxLayout",
"qtpy.QtWidgets.QTextEdit"
] | [((429, 442), 'qtpy.QtWidgets.QVBoxLayout', 'QVBoxLayout', ([], {}), '()\n', (440, 442), False, 'from qtpy.QtWidgets import QVBoxLayout, QTextEdit, QDialog, QLabel, QPushButton, QHBoxLayout\n'), ((488, 556), 'qtpy.QtWidgets.QLabel', 'QLabel', (['"""<b>napari: a multi-dimensional image viewer for python</b>"""'], {}), "... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.dokku_utils import subprocess_check_output
import subprocess
import re
DOCUMENTATION = """
---
module: dokku_ps_scale
short_description: Manage process scaling for a given dokku application
options:... | [
"re.sub",
"ansible.module_utils.basic.AnsibleModule",
"ansible.module_utils.dokku_utils.subprocess_check_output",
"subprocess.check_call"
] | [((1220, 1252), 'ansible.module_utils.dokku_utils.subprocess_check_output', 'subprocess_check_output', (['command'], {}), '(command)\n', (1243, 1252), False, 'from ansible.module_utils.dokku_utils import subprocess_check_output\n'), ((2744, 2806), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', ([], {'argu... |
from matplotlib import pyplot, ticker
import numpy as np
# import seaborn as sns
from scipy import stats
import yt
from grid_figure import GridFigure
if __name__ == "__main__":
my_fig = GridFigure(3, 1, figsize=(4.5, 7),
left_buffer=0.22, right_buffer=0.02,
bottom_b... | [
"matplotlib.ticker.NullFormatter",
"matplotlib.pyplot.savefig",
"numpy.linspace",
"yt.load",
"grid_figure.GridFigure",
"numpy.logspace"
] | [((192, 323), 'grid_figure.GridFigure', 'GridFigure', (['(3)', '(1)'], {'figsize': '(4.5, 7)', 'left_buffer': '(0.22)', 'right_buffer': '(0.02)', 'bottom_buffer': '(0.09)', 'top_buffer': '(0.02)', 'vertical_buffer': '(0)'}), '(3, 1, figsize=(4.5, 7), left_buffer=0.22, right_buffer=0.02,\n bottom_buffer=0.09, top_buf... |
# * @Author: abhinav.mazumdar
# * @Date: 2020-09-02 23:08:21
# * @Last Modified by:abhinav.mazumdar
# * @Last Modified time: 2020-09-02 23:08:49
# This model classifies movie (IMDB Dataset)reviews as positive
# or negative ( binary classification)
from keras.datasets import imdb
from keras import models
from ker... | [
"keras.datasets.imdb.load_data",
"numba.cuda.select_device",
"numpy.asarray",
"keras.models.Sequential",
"numba.cuda.close",
"keras.layers.Dense"
] | [((712, 743), 'keras.datasets.imdb.load_data', 'imdb.load_data', ([], {'num_words': '(10000)'}), '(num_words=10000)\n', (726, 743), False, 'from keras.datasets import imdb\n'), ((2386, 2405), 'keras.models.Sequential', 'models.Sequential', ([], {}), '()\n', (2403, 2405), False, 'from keras import models\n'), ((4203, 42... |
import dash_core_components as dcc
import dash_html_components as html
layout = html.Div([
html.H3('App 1'),
dcc.Dropdown(
id='app-1-dropdown',
options=[
{'label': 'App 1 - {}'.format(i), 'value': i} for i in [
'NYC', 'MTL', 'LA'
]
]
),
h... | [
"dash_core_components.Link",
"dash_html_components.H3",
"dash_html_components.Div"
] | [((97, 113), 'dash_html_components.H3', 'html.H3', (['"""App 1"""'], {}), "('App 1')\n", (104, 113), True, 'import dash_html_components as html\n'), ((319, 353), 'dash_html_components.Div', 'html.Div', ([], {'id': '"""app-1-display-value"""'}), "(id='app-1-display-value')\n", (327, 353), True, 'import dash_html_compone... |
import torch
def add_tensor_1d(x, y):
s1 = (y.shape[-1] - x.shape[-1]) // 2
e1 = s1 + x.shape[-1]
y = y[..., s1:e1]
if x.shape[1] > y.shape[1]:
d = [int(i) for i in y.shape]
d[1] = int(x.shape[1] - y.shape[1])
y = torch.cat((y, torch.zeros(d, dtype=y.dtype, device=y.device)), -3... | [
"torch.nn.GroupNorm",
"torch.split",
"torch.nn.modules.normalization.init.zeros_",
"torch.nn.LeakyReLU",
"torch.nn.Sequential",
"torch.rsqrt",
"torch.load",
"torch.Tensor",
"torch.from_numpy",
"torch.cat",
"torch.zeros",
"torch.no_grad",
"torch.zeros_like",
"torch.isnan",
"torch.nn.Conv1... | [((4471, 4504), 'torch.nn.Sequential', 'torch.nn.Sequential', (['*list_module'], {}), '(*list_module)\n', (4490, 4504), False, 'import torch\n'), ((401, 415), 'torch.isnan', 'torch.isnan', (['x'], {}), '(x)\n', (412, 415), False, 'import torch\n'), ((453, 472), 'torch.zeros_like', 'torch.zeros_like', (['x'], {}), '(x)\... |
from erdos.data_stream import DataStream
from erdos.logging_op import LoggingOp
from erdos.message import Message
from erdos.timestamp import Timestamp
from erdos.utils import frequency, setup_logging
import pylot_utils
class FusionOperator(LoggingOp):
def __init__(self, name, min_runtime_us, max_runtime_us,
... | [
"erdos.timestamp.Timestamp",
"pylot_utils.do_work",
"erdos.utils.setup_logging",
"erdos.utils.frequency",
"erdos.data_stream.DataStream"
] | [((2300, 2313), 'erdos.utils.frequency', 'frequency', (['(10)'], {}), '(10)\n', (2309, 2313), False, 'from erdos.utils import frequency, setup_logging\n'), ((440, 477), 'erdos.utils.setup_logging', 'setup_logging', (['self.name', '"""pylot.log"""'], {}), "(self.name, 'pylot.log')\n", (453, 477), False, 'from erdos.util... |
__version__ = "0.1"
__all__ = []
import warnings
try:
from pyiron import Project
except:
warnings.warn("pyiron module not found, importing Project from pyiron_base")
from pyiron_base import Project
from pyiron_base import JOB_CLASS_DICT
# Make classes available for new pyiron version
JOB_CLASS_DICT['ProtoMinimGr... | [
"warnings.warn"
] | [((93, 169), 'warnings.warn', 'warnings.warn', (['"""pyiron module not found, importing Project from pyiron_base"""'], {}), "('pyiron module not found, importing Project from pyiron_base')\n", (106, 169), False, 'import warnings\n')] |
from openpyxl import Workbook
from openpyxl import load_workbook
from iteration_utilities import duplicates
from iteration_utilities import unique_everseen
from openpyxl.styles import Color, PatternFill, Font, Border
from ..modules.adresse import readAdresse
from ..modules.nommageCable import generateCables
import re
... | [
"openpyxl.load_workbook",
"openpyxl.styles.Font",
"iteration_utilities.unique_everseen",
"openpyxl.Workbook",
"openpyxl.styles.PatternFill"
] | [((878, 906), 'openpyxl.load_workbook', 'load_workbook', (['self.bal_file'], {}), '(self.bal_file)\n', (891, 906), False, 'from openpyxl import load_workbook\n'), ((6885, 6895), 'openpyxl.Workbook', 'Workbook', ([], {}), '()\n', (6893, 6895), False, 'from openpyxl import Workbook\n'), ((7215, 7287), 'openpyxl.styles.Pa... |
import numpy as np
from .. import Circuit, DcOp, Resistor, Mos
from ..analysis import Contour
def cmos_inv(vgs):
class CmosInv(Circuit):
""" Cmos Inverter """
def define(self):
self.create_nodes(1)
vdd = self.create_forced_node(name='vdd', v=1.0)
g = self.creat... | [
"numpy.linspace"
] | [((811, 835), 'numpy.linspace', 'np.linspace', (['(0)', '(1.0)', '(101)'], {}), '(0, 1.0, 101)\n', (822, 835), True, 'import numpy as np\n')] |
#!/usr/bin/env python3
"""
Example of a section shared between several methods and modules.
Example2 is doing stuff
█ Example1 is starting to do stuff
█ █ Example1 is done doing stuff
█ Example2 is done doing stuff
"""
from context_printer import ContextPrinter as Ctp
from example1 import Example1
class Example2:
... | [
"example1.Example1",
"context_printer.ContextPrinter.enter_section",
"context_printer.ContextPrinter.print",
"context_printer.ContextPrinter.exit_section"
] | [((411, 469), 'context_printer.ContextPrinter.enter_section', 'Ctp.enter_section', (['"""Example2 is doing stuff"""'], {'color': '"""blue"""'}), "('Example2 is doing stuff', color='blue')\n", (428, 469), True, 'from context_printer import ContextPrinter as Ctp\n'), ((497, 507), 'example1.Example1', 'Example1', ([], {})... |
from inspect import getfile, getsourcelines
from sys import stderr
from types import FunctionType
def print_function_context(f: FunctionType) -> None:
name, file, (source, source_line_number) = f.__name__, getfile(f), getsourcelines(f)
print(f"Function '{name}' located in {file} at line {source_line_number}"... | [
"inspect.getsourcelines",
"inspect.getfile"
] | [((212, 222), 'inspect.getfile', 'getfile', (['f'], {}), '(f)\n', (219, 222), False, 'from inspect import getfile, getsourcelines\n'), ((224, 241), 'inspect.getsourcelines', 'getsourcelines', (['f'], {}), '(f)\n', (238, 241), False, 'from inspect import getfile, getsourcelines\n')] |
from django.contrib import admin
from .models import SubjectRegistration, Result, StudentResult
# Register your models here.
admin.site.register(SubjectRegistration)
admin.site.register(Result)
admin.site.register(StudentResult)
| [
"django.contrib.admin.site.register"
] | [((127, 167), 'django.contrib.admin.site.register', 'admin.site.register', (['SubjectRegistration'], {}), '(SubjectRegistration)\n', (146, 167), False, 'from django.contrib import admin\n'), ((168, 195), 'django.contrib.admin.site.register', 'admin.site.register', (['Result'], {}), '(Result)\n', (187, 195), False, 'fro... |
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
import os.path
import sys
import site
import inspect
import types
import collections
class _DependencyResolver(object):
"""
Finds dependencies given a module object
"""
def __init__(self, topology):
self._modules = set()... | [
"inspect.getmodule",
"collections.OrderedDict"
] | [((346, 371), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (369, 371), False, 'import collections\n'), ((5979, 6006), 'inspect.getmodule', 'inspect.getmodule', (['function'], {}), '(function)\n', (5996, 6006), False, 'import inspect\n')] |
import pytest
from mktestdocs import check_docstring, check_md_file
from doubtlab.reason import (
ProbaReason,
RandomReason,
OutlierReason,
DisagreeReason,
LongConfidenceReason,
ShortConfidenceReason,
MarginConfidenceReason,
WrongPredictionReason,
AbsoluteDifferenceReason,
Relat... | [
"pytest.mark.parametrize",
"mktestdocs.check_docstring",
"mktestdocs.check_md_file"
] | [((691, 783), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""func"""', '(all_reasons + [DoubtEnsemble])'], {'ids': '(lambda d: d.__name__)'}), "('func', all_reasons + [DoubtEnsemble], ids=lambda d:\n d.__name__)\n", (714, 783), False, 'import pytest\n'), ((908, 1023), 'pytest.mark.parametrize', 'pytest.... |
# -*- encoding: utf-8 -*-
from sqlalchemy import func
import random
from datetime import datetime
from datetime import timedelta
from app.main.repository.interface.user_tbls import (PersonalDetailsRepository
,ReviewerProfileRepository
... | [
"random.sample",
"random.shuffle",
"app.main.repository.interface.user_tbls.PersonalDetailsRepository",
"sqlalchemy.func.max",
"datetime.datetime.now",
"app.main.repository.interface.user_tbls.ReviewerProfileRepository",
"datetime.timedelta",
"app.main.repository.interface.user_tbls.ProjectReviewStatu... | [((6512, 6539), 'app.main.repository.interface.user_tbls.PersonalDetailsRepository', 'PersonalDetailsRepository', ([], {}), '()\n', (6537, 6539), False, 'from app.main.repository.interface.user_tbls import PersonalDetailsRepository, ReviewerProfileRepository, ProjectReviewStatusRepository\n'), ((6583, 6610), 'app.main.... |
from datetime import datetime, timedelta
from django.shortcuts import render, redirect
from django.utils.dateparse import parse_date
from django.contrib.auth.decorators import login_required
from tracker_app.models import Food, Meal, Day, FoodLog, MealLog, User
def home(request):
""" Home view """
return re... | [
"django.shortcuts.render",
"tracker_app.models.MealLog.objects.all",
"tracker_app.models.Meal.objects.all",
"tracker_app.models.Food.objects.create",
"tracker_app.models.Meal.objects.get",
"tracker_app.models.FoodLog.objects.all",
"datetime.datetime.now",
"datetime.timedelta",
"django.shortcuts.redi... | [((318, 358), 'django.shortcuts.render', 'render', (['request', '"""tracker_app/home.html"""'], {}), "(request, 'tracker_app/home.html')\n", (324, 358), False, 'from django.shortcuts import render, redirect\n'), ((415, 456), 'django.shortcuts.render', 'render', (['request', '"""tracker_app/about.html"""'], {}), "(reque... |
# -*- coding: utf-8 -*-
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
"argparse.ArgumentParser",
"google.cloud.bigquery_datatransfer.DataTransferServiceClient"
] | [((917, 966), 'google.cloud.bigquery_datatransfer.DataTransferServiceClient', 'bigquery_datatransfer.DataTransferServiceClient', ([], {}), '()\n', (964, 966), False, 'from google.cloud import bigquery_datatransfer\n'), ((1763, 1788), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1786, 1788), ... |
import json
import re
from api.core.danmaku import *
class Tencent(DanmakuSearcher):
async def search(self, keyword: str) -> AsyncIterator[DanmakuMeta]:
tasks = [self.search_one_page(keyword, p) for p in range(5)] # 取前10页
async for meta in self.as_iter_completed(tasks):
yield meta
... | [
"re.sub",
"json.loads",
"re.search"
] | [((851, 867), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (861, 867), False, 'import json\n'), ((2086, 2102), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (2096, 2102), False, 'import json\n'), ((3652, 3682), 'json.loads', 'json.loads', (['data'], {'strict': '(False)'}), '(data, strict=False)\n',... |
from distutils.core import setup
setup(name='bgone',
version='0.1',
packages=['utility', 'cogs'],
package_dir={
'utility': 'bgone/utility',
'cogs': 'bgone/cogs'
}
)
| [
"distutils.core.setup"
] | [((34, 166), 'distutils.core.setup', 'setup', ([], {'name': '"""bgone"""', 'version': '"""0.1"""', 'packages': "['utility', 'cogs']", 'package_dir': "{'utility': 'bgone/utility', 'cogs': 'bgone/cogs'}"}), "(name='bgone', version='0.1', packages=['utility', 'cogs'],\n package_dir={'utility': 'bgone/utility', 'cogs': ... |
"""This module contain functions for activate user."""
from django.contrib.auth import login
from django.contrib.auth.models import User
from django.contrib.auth.hashers import check_password, make_password
from django.utils.encoding import force_bytes, force_text
from django.utils.http import urlsafe_base64_encode, u... | [
"django.contrib.auth.models.User.objects.get",
"django.contrib.auth.login",
"django.utils.http.urlsafe_base64_decode"
] | [((644, 668), 'django.contrib.auth.models.User.objects.get', 'User.objects.get', ([], {'pk': 'uid'}), '(pk=uid)\n', (660, 668), False, 'from django.contrib.auth.models import User\n'), ((897, 917), 'django.contrib.auth.login', 'login', (['request', 'user'], {}), '(request, user)\n', (902, 917), False, 'from django.cont... |
# -*- coding: utf-8 -*-
"""
This module
"""
import attr
import typing
from ..core.model import (
Property, Resource, Tag, GetAtt, TypeHint, TypeCheck,
)
from ..core.constant import AttrMeta
#--- Property declaration ---
@attr.s
class RepositoryLifecyclePolicy(Property):
"""
AWS Object Type = "AWS::ECR:... | [
"attr.validators.instance_of"
] | [((2806, 2863), 'attr.validators.instance_of', 'attr.validators.instance_of', (['TypeCheck.intrinsic_str_type'], {}), '(TypeCheck.intrinsic_str_type)\n', (2833, 2863), False, 'import attr\n'), ((3229, 3286), 'attr.validators.instance_of', 'attr.validators.instance_of', (['TypeCheck.intrinsic_str_type'], {}), '(TypeChec... |
import os
import time
import pickle
import random
import numpy as np
from PIL import Image
import torchvision.transforms as transforms
from utils import cv_utils
from data.dataset import DatasetBase
class AusDataset(DatasetBase):
def __init__(self, opt, is_for_train):
super(AusDataset, self).__init__(opt,... | [
"os.path.exists",
"PIL.Image.fromarray",
"random.randint",
"utils.cv_utils.read_cv2_img",
"os.path.join",
"pickle.load",
"os.path.splitext",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.RandomCrop",
"torchvision.transforms.Normalize",
"numpy.random.uniform",
"torchvis... | [((1264, 1311), 'numpy.random.uniform', 'np.random.uniform', (['(-0.02)', '(0.02)', 'real_cond.shape'], {}), '(-0.02, 0.02, real_cond.shape)\n', (1281, 1311), True, 'import numpy as np\n'), ((2599, 2633), 'torchvision.transforms.Compose', 'transforms.Compose', (['transform_list'], {}), '(transform_list)\n', (2617, 2633... |
from .utilities import get_user_settings_file
import argparse
import json
def add_library(paths):
settings_file = get_user_settings_file()
with open(settings_file, "r") as f:
settings = json.load(f)
for path in paths:
settings["libraries"].append(path)
with open(settings_file, "w") ... | [
"json.load",
"json.dump",
"argparse.ArgumentParser"
] | [((1068, 1238), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Reference data of the ToCM group in Groningen."""', 'prog': '"""tocm_reference_data"""', 'usage': '"""python3 tocm_reference_data [options]"""'}), "(description=\n 'Reference data of the ToCM group in Groningen.', prog=\n ... |
import os
import previsionio as pio
from .utils import get_testing_id
TESTING_ID = get_testing_id()
PROJECT_NAME = "sdk_test_dataset_image_" + str(TESTING_ID)
PROJECT_ID = ""
pio.config.zip_files = False
pio.config.default_timeout = 1000
test_datasets = {}
dataset_name = 'cats_and_dogs_train'
dataset_test_name = TES... | [
"previsionio.Project.new",
"previsionio.Project.from_id",
"os.path.isfile",
"os.path.realpath",
"os.remove"
] | [((391, 461), 'previsionio.Project.new', 'pio.Project.new', ([], {'name': 'PROJECT_NAME', 'description': '"""description test sdk"""'}), "(name=PROJECT_NAME, description='description test sdk')\n", (406, 461), True, 'import previsionio as pio\n'), ((588, 619), 'previsionio.Project.from_id', 'pio.Project.from_id', (['PR... |
import logging
from beeprint import pp
log = logging.getLogger()
HTTP_RETRY_ATTEMPTS = 3
HTTP_RETRY_WAIT_SECS = 30
SUPPORTED_DISTRO_LIST = ["ubuntu", "ubi", "centos"]
| [
"logging.getLogger"
] | [((47, 66), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (64, 66), False, 'import logging\n')] |
from datetime import date
from decimal import Decimal
import factory
from parking_permits.models import Product
from .zone import ParkingZoneFactory
class ProductFactory(factory.django.DjangoModelFactory):
zone = factory.SubFactory(ParkingZoneFactory)
start_date = date(2021, 1, 1)
end_date = date(2021,... | [
"factory.SubFactory",
"datetime.date",
"decimal.Decimal"
] | [((222, 260), 'factory.SubFactory', 'factory.SubFactory', (['ParkingZoneFactory'], {}), '(ParkingZoneFactory)\n', (240, 260), False, 'import factory\n'), ((278, 294), 'datetime.date', 'date', (['(2021)', '(1)', '(1)'], {}), '(2021, 1, 1)\n', (282, 294), False, 'from datetime import date\n'), ((310, 328), 'datetime.date... |
# Generated by Django 2.2.24 on 2021-11-22 14:22
from django.db import migrations
from django.template.defaultfilters import slugify
def set_segment_slugs(apps, schema_editor):
Segment = apps.get_model('segments', 'Segment')
for segment in Segment.objects.all():
segment.slug = slugify(segment.name)
... | [
"django.template.defaultfilters.slugify",
"django.db.migrations.RunPython"
] | [((297, 318), 'django.template.defaultfilters.slugify', 'slugify', (['segment.name'], {}), '(segment.name)\n', (304, 318), False, 'from django.template.defaultfilters import slugify\n'), ((482, 548), 'django.db.migrations.RunPython', 'migrations.RunPython', (['set_segment_slugs', 'migrations.RunPython.noop'], {}), '(se... |
import pygame as pg
import math
from math import sqrt
def crop_image(image, image_rect, crop_rect):
'''Receives a surface, it's rect, and the rect of image to be cropped.
Returns a surface.'''
ix, iy, iw, ih = image_rect
cx, cy, cw, ch = crop_rect
#Trim from topleft of image to topleft of crop... | [
"pygame.transform.chop",
"math.sqrt",
"math.atan"
] | [((338, 378), 'pygame.transform.chop', 'pg.transform.chop', (['image', '(0, 0, cx, cy)'], {}), '(image, (0, 0, cx, cy))\n', (355, 378), True, 'import pygame as pg\n'), ((463, 524), 'pygame.transform.chop', 'pg.transform.chop', (['temp', '(cw, ch, iw - cx - cw, ih - cy - ch)'], {}), '(temp, (cw, ch, iw - cx - cw, ih - c... |
from contextlib import AbstractContextManager
from anilius.db.db import DB
from anilius.utils.singleton import Singleton
from sqlalchemy.orm import scoped_session, sessionmaker
class DBSession(metaclass=Singleton):
def __init__(
self,
autocommit=False,
autoflush=False,
... | [
"sqlalchemy.orm.sessionmaker",
"anilius.db.db.DB.get_engine",
"anilius.db.db.DB.get_model"
] | [((427, 442), 'anilius.db.db.DB.get_engine', 'DB.get_engine', ([], {}), '()\n', (440, 442), False, 'from anilius.db.db import DB\n'), ((714, 728), 'anilius.db.db.DB.get_model', 'DB.get_model', ([], {}), '()\n', (726, 728), False, 'from anilius.db.db import DB\n'), ((494, 607), 'sqlalchemy.orm.sessionmaker', 'sessionmak... |
# Author: <NAME>
# Finds probability of no collisions for hash function using function e^-(sum(1 -> t-1) / 365). Outputs things to a CSV file hashprob.csv
import sys
import math
import csv
def prob(t):
# Probability as float
p = math.e ** -(math.fsum(range(1, t)) / 365)
return p
def main():
# For sing... | [
"csv.writer"
] | [((664, 683), 'csv.writer', 'csv.writer', (['csvfile'], {}), '(csvfile)\n', (674, 683), False, 'import csv\n')] |
from model_mommy import mommy
from battles.forms import CreateBattleForm, SelectTrainerTeamForm
from battles.tests.tests_helpers import PokeBattleTestCase
class CreateBattleFormTest(PokeBattleTestCase):
def test_pokemon_team_sum_invalid(self):
attr = {
'initial': {
'trainer_c... | [
"model_mommy.mommy.make",
"battles.forms.SelectTrainerTeamForm",
"battles.forms.CreateBattleForm"
] | [((867, 891), 'battles.forms.CreateBattleForm', 'CreateBattleForm', ([], {}), '(**attr)\n', (883, 891), False, 'from battles.forms import CreateBattleForm, SelectTrainerTeamForm\n'), ((1830, 1859), 'battles.forms.SelectTrainerTeamForm', 'SelectTrainerTeamForm', ([], {}), '(**attr)\n', (1851, 1859), False, 'from battles... |
from typing import Optional, NamedTuple, Any, Callable
from snowplow_tracker import Subject, Tracker, AsyncEmitter, SelfDescribingJson
from itly_sdk import Plugin, PluginLoadOptions, Properties, Event, Logger
class SnowplowOptions(NamedTuple):
"""
Snowplow Options
Based on Snowplow AsyncEmitter options... | [
"snowplow_tracker.Subject",
"snowplow_tracker.Tracker"
] | [((2368, 2384), 'snowplow_tracker.Tracker', 'Tracker', (['emitter'], {}), '(emitter)\n', (2375, 2384), False, 'from snowplow_tracker import Subject, Tracker, AsyncEmitter, SelfDescribingJson\n'), ((2567, 2576), 'snowplow_tracker.Subject', 'Subject', ([], {}), '()\n', (2574, 2576), False, 'from snowplow_tracker import S... |
import datetime
import imaplib
import email
import traceback
from email.header import decode_header
# -------------------------------------------------
#
# Utility to read email from Gmail Using Python
#
# ------------------------------------------------
import time
from email import utils
import pytz
SMTP_SERVER = "... | [
"email.utils.parsedate_to_datetime",
"imaplib.IMAP4_SSL",
"time.sleep",
"email.header.decode_header",
"email.message_from_bytes",
"traceback.print_exc"
] | [((1739, 1775), 'email.utils.parsedate_to_datetime', 'utils.parsedate_to_datetime', (['rawdate'], {}), '(rawdate)\n', (1766, 1775), False, 'from email import utils\n'), ((439, 469), 'imaplib.IMAP4_SSL', 'imaplib.IMAP4_SSL', (['SMTP_SERVER'], {}), '(SMTP_SERVER)\n', (456, 469), False, 'import imaplib\n'), ((1500, 1513),... |
import os
import subprocess
import glob
import autosub
import time
def main():
for file in glob.glob('*.mp3'):
print('generating subtitle for %s' % file)
if os.path.exists(file.replace('.mp3', '.srt')):
print('skip existing file: %s' % file)
continue
autosub.generat... | [
"time.sleep",
"autosub.generate_subtitles",
"glob.glob"
] | [((97, 115), 'glob.glob', 'glob.glob', (['"""*.mp3"""'], {}), "('*.mp3')\n", (106, 115), False, 'import glob\n'), ((305, 337), 'autosub.generate_subtitles', 'autosub.generate_subtitles', (['file'], {}), '(file)\n', (331, 337), False, 'import autosub\n'), ((346, 360), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n'... |
"""
Created on 4 Jan 2018
:author: <NAME>
"""
from oanda.account.account import Account
from oanda.oanda_common.config import OandaContext
def main():
"""
Create an API context, and use it to fetch and display an Account summary.
The configuration for the context and Account to fetch is parsed from the
... | [
"oanda.account.account.Account",
"oanda.oanda_common.config.OandaContext"
] | [((413, 427), 'oanda.oanda_common.config.OandaContext', 'OandaContext', ([], {}), '()\n', (425, 427), False, 'from oanda.oanda_common.config import OandaContext\n'), ((760, 776), 'oanda.account.account.Account', 'Account', (['summary'], {}), '(summary)\n', (767, 776), False, 'from oanda.account.account import Account\n... |
import connexion
from flask import Flask, render_template, request
# Create app instance and specify specification dir for Swagger
app = connexion.App(__name__, specification_dir='./')
# Provide Swagger specification YAML or JSON file
app.add_api('swagger.yml')
@app.route('/test_button.html', methods=['GET'])
def bu... | [
"flask.render_template",
"connexion.App"
] | [((138, 185), 'connexion.App', 'connexion.App', (['__name__'], {'specification_dir': '"""./"""'}), "(__name__, specification_dir='./')\n", (151, 185), False, 'import connexion\n'), ((339, 374), 'flask.render_template', 'render_template', (['"""test_button.html"""'], {}), "('test_button.html')\n", (354, 374), False, 'fr... |
from src.data import Problem
from src.operator.transformer.interior import Interior
from src.operator.transformer.fill_rectangle import FillRectangle
from src.operator.transformer.diff_color import DiffColor
from src.operator.transformer.align import Align
from src.operator.transformer.connect_line.row import ConnectRo... | [
"src.operator.transformer.arithmetic.frequency.Freq.problem",
"src.operator.transformer.switch_color.SwitchColor.problem",
"src.operator.transformer.paste_color.PasteColor.problem",
"src.operator.transformer.shadow.Shadow.problem",
"src.operator.transformer.keep_max_color.KeepMaxColor.problem",
"src.opera... | [((2897, 2917), 'src.operator.transformer.diff_color.DiffColor.problem', 'DiffColor.problem', (['p'], {}), '(p)\n', (2914, 2917), False, 'from src.operator.transformer.diff_color import DiffColor\n'), ((2968, 2989), 'src.operator.transformer.connect_line.row.ConnectRow.problem', 'ConnectRow.problem', (['p'], {}), '(p)\... |
'''
Created on Dec 6, 2012
@author: mmunn
Unit test : EUCA-1057 second euca-deregister does not deregister the image completely.
Test to make sure correct error is thrown on second deregister of non-terminated instance
setUp : Install Credentials, set vars
test :... | [
"unittest.main",
"testcases.cloud_user.images.imageutils.ImageUtils",
"eucaops.Eucaops",
"shutil.rmtree"
] | [((2493, 2518), 'unittest.main', 'unittest.main', (['"""Euca1057"""'], {}), "('Euca1057')\n", (2506, 2518), False, 'import unittest\n'), ((881, 934), 'eucaops.Eucaops', 'Eucaops', ([], {'config_file': 'self.conf', 'password': '"""<PASSWORD>"""'}), "(config_file=self.conf, password='<PASSWORD>')\n", (888, 934), False, '... |
# internal
from src.translation import _
from src.errors import ModuleError
class ProviderError(ModuleError):
"""Provider Error"""
msg = _('cloud provider base error')
class ProviderBadInputError(ProviderError):
"""Provider Bad Input Error"""
msg = _('cloud provider bad input parameter')
class Pro... | [
"src.translation._"
] | [((147, 177), 'src.translation._', '_', (['"""cloud provider base error"""'], {}), "('cloud provider base error')\n", (148, 177), False, 'from src.translation import _\n'), ((269, 308), 'src.translation._', '_', (['"""cloud provider bad input parameter"""'], {}), "('cloud provider bad input parameter')\n", (270, 308), ... |
# Copyright 2018 Regents of the University of Colorado. All Rights Reserved.
# Released under the MIT license.
# This software was developed at the University of Colorado's Laboratory for Atmospheric and Space Physics.
# Verify current version before use at: https://github.com/MAVENSDC/PyTplot
from pytplot import extr... | [
"datetime.datetime.now"
] | [((779, 802), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (800, 802), False, 'import datetime\n')] |
from pyvisdk.esxcli.executer import execute_soap
from pyvisdk.esxcli.base import Base
class IscsiAdapterDiscoveryStatictarget(Base):
'''
Operations that can be performed on iSCSI statictarget discovery
'''
moid = 'ha-cli-handler-iscsi-adapter-discovery-statictarget'
def add(self, adapter, address,... | [
"pyvisdk.esxcli.executer.execute_soap"
] | [((608, 765), 'pyvisdk.esxcli.executer.execute_soap', 'execute_soap', (['self._client', 'self._host', 'self.moid', '"""vim.EsxCLI.iscsi.adapter.discovery.statictarget.Add"""'], {'adapter': 'adapter', 'address': 'address', 'name': 'name'}), "(self._client, self._host, self.moid,\n 'vim.EsxCLI.iscsi.adapter.discovery.... |
# Convert the differnt audio formats into .wav format
import subprocess, os
os.chdir(r'D:\STT\src')
# audio file formats are converted using ffmpeg tool
# set the path where the executable (.exe) file is located
# download ffmpeg build from https://ffmpeg.zeranoe.com/builds/ and place it in your project folder
# ffm... | [
"os.listdir",
"azure.cognitiveservices.speech.SpeechConfig",
"azure.cognitiveservices.speech.SpeechRecognizer",
"time.sleep",
"os.chdir",
"subprocess.call",
"azure.cognitiveservices.speech.audio.AudioConfig",
"glob.glob"
] | [((77, 101), 'os.chdir', 'os.chdir', (['"""D:\\\\STT\\\\src"""'], {}), "('D:\\\\STT\\\\src')\n", (85, 101), False, 'import subprocess, os\n'), ((723, 752), 'glob.glob', 'glob.glob', (["(folder_path + '/*')"], {}), "(folder_path + '/*')\n", (732, 752), False, 'import glob\n'), ((1658, 1728), 'azure.cognitiveservices.spe... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Attribute.db_strvalue'
db.add_column(u'typeclasses_attribute', 'db_strvalue',
... | [
"south.db.db.delete_index",
"south.db.db.delete_column",
"south.db.db.create_index"
] | [((779, 831), 'south.db.db.create_index', 'db.create_index', (['u"""typeclasses_tag"""', "['db_category']"], {}), "(u'typeclasses_tag', ['db_category'])\n", (794, 831), False, 'from south.db import db\n'), ((892, 939), 'south.db.db.create_index', 'db.create_index', (['u"""typeclasses_tag"""', "['db_key']"], {}), "(u'ty... |
import os
user_input = input('What is the name of your directory: ')
user_input = user_input.replace(" ", "").lower()
rootdir = str(user_input)
searchstring = input('What word are you trying to find?: ')
for subdir, dirs, files in os.walk(rootdir):
for file in files:
file_location = os.path.join(subdi... | [
"os.path.isfile",
"os.path.join",
"os.walk"
] | [((237, 253), 'os.walk', 'os.walk', (['rootdir'], {}), '(rootdir)\n', (244, 253), False, 'import os\n'), ((302, 328), 'os.path.join', 'os.path.join', (['subdir', 'file'], {}), '(subdir, file)\n', (314, 328), False, 'import os\n'), ((340, 369), 'os.path.isfile', 'os.path.isfile', (['file_location'], {}), '(file_location... |
"""The module for Single Nucleotide Variation Validation."""
from .validator import Validator
import logging
logger = logging.getLogger('variation')
logger.setLevel(logging.DEBUG)
class SingleNucleotideVariationBase(Validator):
"""The Single Nucleotide Variation Validator Base class."""
def silent_mutation_... | [
"logging.getLogger"
] | [((119, 149), 'logging.getLogger', 'logging.getLogger', (['"""variation"""'], {}), "('variation')\n", (136, 149), False, 'import logging\n')] |
import matplotlib.pyplot as plt
import numpy as np
import torch
import cv2
import os
def find_card(I):
# 识别出车牌区域并返回该区域的图像
[y, x, z] = I.shape
# y取值范围分析
Blue_y = np.zeros((y, 1))
for i in range(y):
for j in range(x):
# 蓝色rgb范围
temp = I[i, j, :]
if (I[i, j... | [
"matplotlib.pyplot.imshow",
"cv2.merge",
"numpy.argmax",
"matplotlib.pyplot.subplot",
"numpy.zeros",
"os.mkdir",
"cv2.cvtColor",
"cv2.resize",
"cv2.imread",
"matplotlib.pyplot.show"
] | [((179, 195), 'numpy.zeros', 'np.zeros', (['(y, 1)'], {}), '((y, 1))\n', (187, 195), True, 'import numpy as np\n'), ((402, 419), 'numpy.argmax', 'np.argmax', (['Blue_y'], {}), '(Blue_y)\n', (411, 419), True, 'import numpy as np\n'), ((605, 621), 'numpy.zeros', 'np.zeros', (['(1, x)'], {}), '((1, x))\n', (613, 621), Tru... |