code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 18 23:20:36 2018
@author: abdul
"""
# Multi Linear Regression
import numpy as np #for mathematical calculation
import matplotlib.pyplot as plt #for ploting nice chat and graph
import pandas as pd
dataset = pd.read_csv('50_Startups.csv')
X =... | [
"sklearn.cross_validation.train_test_split",
"pandas.read_csv",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.preprocessing.LabelEncoder",
"sklearn.linear_model.LinearRegression"
] | [((285, 315), 'pandas.read_csv', 'pd.read_csv', (['"""50_Startups.csv"""'], {}), "('50_Startups.csv')\n", (296, 315), True, 'import pandas as pd\n'), ((487, 501), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (499, 501), False, 'from sklearn.preprocessing import OneHotEncoder, LabelEncoder\n')... |
"""
2-layer controller.
"""
from aw_nas import utils, assert_rollout_type
from aw_nas.utils import DistributedDataParallel
from aw_nas.controller.base import BaseController
from aw_nas.btcs.layer2.search_space import (
Layer2Rollout,
Layer2DiffRollout,
DenseMicroRollout,
DenseMicroDiffRollout,
Stag... | [
"aw_nas.utils.gumbel_softmax",
"aw_nas.utils.get_numpy",
"torch.cat",
"torch.device",
"aw_nas.btcs.layer2.search_space.SinkConnectMacroDiffRollout",
"aw_nas.btcs.layer2.search_space.Layer2DiffRollout",
"aw_nas.utils.torch_utils.max_eig_of_hessian",
"os.path.dirname",
"torch.nn.ParameterList",
"tor... | [((2257, 2281), 'torch.nn.Module.__init__', 'nn.Module.__init__', (['self'], {}), '(self)\n', (2275, 2281), True, 'import torch.nn as nn\n'), ((5941, 5961), 'torch.nn.ParameterList', 'nn.ParameterList', (['[]'], {}), '([])\n', (5957, 5961), True, 'import torch.nn as nn\n'), ((7560, 7582), 'aw_nas.utils.get_numpy', 'uti... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"tvm.convert",
"tvm.create_schedule",
"tvm.relay.Function",
"tvm.testing.assert_allclose",
"mxnet.gluon.utils.download",
"tvm.relay.multiply",
"tvm.relay.frontend.from_mxnet",
"mxnet.gluon.model_zoo.vision.get_model",
"tvm.relay.const",
"numpy.random.uniform",
"tvm.relay.testing.resnet.get_workl... | [((1123, 1165), 'tvm.micro.Session', 'micro.Session', (['DEVICE_TYPE', 'BINUTIL_PREFIX'], {}), '(DEVICE_TYPE, BINUTIL_PREFIX)\n', (1136, 1165), True, 'import tvm.micro as micro\n'), ((1412, 1430), 'tvm.convert', 'tvm.convert', (['shape'], {}), '(shape)\n', (1423, 1430), False, 'import tvm\n'), ((1439, 1488), 'tvm.place... |
import argparse
import musicbrainzngs as mb
from cequery.connection import submit_query
from cequery import person
mb.set_useragent('TROMPA', '0.1')
def transform_mb_artist_to_gql(artist):
pass
def transform_mb_work_to_gql(work):
pass
def import_artist(artist_mbid):
artist = mb.get_artist_by_id(art... | [
"argparse.ArgumentParser",
"musicbrainzngs.set_useragent",
"cequery.person.transform_work",
"musicbrainzngs.get_artist_by_id",
"cequery.connection.submit_query"
] | [((118, 151), 'musicbrainzngs.set_useragent', 'mb.set_useragent', (['"""TROMPA"""', '"""0.1"""'], {}), "('TROMPA', '0.1')\n", (134, 151), True, 'import musicbrainzngs as mb\n'), ((423, 442), 'cequery.connection.submit_query', 'submit_query', (['query'], {}), '(query)\n', (435, 442), False, 'from cequery.connection impo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from timeit import Timer
a = np.array([1, 2, 3, 4])
print(a + 1)
2**a
b = np.ones(4) + 1
a - b
a * b
j = np.arange(5)
2**(j + 1) - j
c = np.ones((3, 3))
# NOT matrix multiplication!
print(c * c)
print(c.dot(c))
a = np.arange(10)
b = a[0::2]
c = a[1::2]... | [
"timeit.Timer",
"numpy.ones",
"numpy.array",
"numpy.arange",
"numpy.fromiter"
] | [((95, 117), 'numpy.array', 'np.array', (['[1, 2, 3, 4]'], {}), '([1, 2, 3, 4])\n', (103, 117), True, 'import numpy as np\n'), ((171, 183), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (180, 183), True, 'import numpy as np\n'), ((204, 219), 'numpy.ones', 'np.ones', (['(3, 3)'], {}), '((3, 3))\n', (211, 219), Tr... |
from server.bo.Statistik import Statistik
from server.bo.StatistikHaendler import StatistikHaendler
from server.bo.StatistikZeitraum import StatistikZeitraum
from server.bo.StatistikHuZ import StatistikHuZ
from server.db.ListeneintragMapper import ListeneintragMapper
import collections
class ReportGenerator(object):
... | [
"server.bo.StatistikHaendler.StatistikHaendler",
"server.bo.StatistikHuZ.StatistikHuZ",
"server.bo.Statistik.Statistik",
"server.bo.StatistikZeitraum.StatistikZeitraum",
"server.db.ListeneintragMapper.ListeneintragMapper",
"collections.Counter"
] | [((1188, 1216), 'collections.Counter', 'collections.Counter', (['artikel'], {}), '(artikel)\n', (1207, 1216), False, 'import collections\n'), ((2951, 2979), 'collections.Counter', 'collections.Counter', (['artikel'], {}), '(artikel)\n', (2970, 2979), False, 'import collections\n'), ((4919, 4944), 'collections.Counter',... |
"""Wrapper for the task submitted to ScheduledThreadPoolExecutor class"""
import time
from typing import Callable
class ScheduledTask:
def __init__(self, runnable: Callable, initial_delay: int, period: int, *args, time_func=time.time, **kwargs):
super().__init__()
self.runnable = runnable
... | [
"time.ctime",
"time.time_ns"
] | [((2048, 2062), 'time.time_ns', 'time.time_ns', ([], {}), '()\n', (2060, 2062), False, 'import time\n'), ((2310, 2324), 'time.time_ns', 'time.time_ns', ([], {}), '()\n', (2322, 2324), False, 'import time\n'), ((1954, 1987), 'time.ctime', 'time.ctime', (['(self.task_time / 1000)'], {}), '(self.task_time / 1000)\n', (196... |
from django.db import models
from django.contrib.auth.models import User
from django.utils.timezone import now
class blog(models.Model):
by = models.ForeignKey(User,on_delete=models.CASCADE)
date = models.DateField(default= now)
title = models.CharField(max_length=500)
body = models.TextField()
lik... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.DateField"
] | [((147, 196), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'on_delete': 'models.CASCADE'}), '(User, on_delete=models.CASCADE)\n', (164, 196), False, 'from django.db import models\n'), ((207, 236), 'django.db.models.DateField', 'models.DateField', ([], {'default': 'now'}), '(default=now)\n', (223, 236... |
import pickle
from pathlib import Path
import numpy as np
from second.core import box_np_ops
from second.data.dataset import Dataset, get_dataset_class
from second.data.kitti_dataset import KittiDataset
import second.data.nuscenes_dataset as nuds
from second.utils.progress_bar import progress_bar_iter as prog_bar
fr... | [
"numpy.full",
"pickle.dump",
"numpy.concatenate",
"numpy.flatnonzero",
"numpy.zeros",
"second.core.box_np_ops.points_in_rbbox",
"pathlib.Path",
"numpy.arange",
"second.data.dataset.get_dataset_class",
"numpy.all"
] | [((1058, 1073), 'pathlib.Path', 'Path', (['data_path'], {}), '(data_path)\n', (1062, 1073), False, 'from pathlib import Path\n'), ((4946, 4961), 'pathlib.Path', 'Path', (['data_path'], {}), '(data_path)\n', (4950, 4961), False, 'from pathlib import Path\n'), ((939, 976), 'second.data.dataset.get_dataset_class', 'get_da... |
# -*- encoding: utf-8 -*-
"""Script for analyzing data from the simulated primary and follow-up
experiments."""
# Allow importing modules from parent directory.
import sys
sys.path.append('..')
from fdr import lsu, tst, qvalue
from fwer import bonferroni, sidak, hochberg, holm_bonferroni
from permutation import tfr_p... | [
"sys.path.append",
"numpy.ndindex",
"numpy.save",
"numpy.load",
"numpy.zeros",
"util.grid_model_counts",
"numpy.shape",
"numpy.reshape"
] | [((173, 194), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (188, 194), False, 'import sys\n'), ((1262, 1281), 'numpy.shape', 'np.shape', (['pvals_pri'], {}), '(pvals_pri)\n', (1270, 1281), True, 'import numpy as np\n'), ((1408, 1448), 'numpy.zeros', 'np.zeros', (['[n_iterations, n_effect_sizes]... |
from datetime import datetime
def log_to_file(filename, message):
log_message = f'{datetime.now()}::: {message}'
with open(filename, 'a+') as fl:
fl.write(log_message + '\n')
print(log_message) | [
"datetime.datetime.now"
] | [((89, 103), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (101, 103), False, 'from datetime import datetime\n')] |
from collections import defaultdict, Counter, OrderedDict, namedtuple, deque
from typing import List, Dict, Any, Tuple, Iterable, Set, Optional
import numpy as np
import tensorflow as tf
from dpu_utils.tfutils import unsorted_segment_logsumexp, pick_indices_from_probs
from dpu_utils.mlutils.vocabulary import Vocabular... | [
"tensorflow.einsum",
"tensorflow.reduce_sum",
"numpy.empty",
"tensorflow.reshape",
"collections.defaultdict",
"numpy.arange",
"numpy.exp",
"collections.deque",
"tensorflow.nn.softmax",
"tensorflow.size",
"tensorflow.gather",
"tensorflow.concat",
"tensorflow.variable_scope",
"tensorflow.pla... | [((1096, 1608), 'collections.namedtuple', 'namedtuple', (['"""ExpansionInformation"""', "['node_to_type', 'node_to_label', 'node_to_prod_id', 'node_to_children',\n 'node_to_parent', 'node_to_synthesised_attr_node',\n 'node_to_inherited_attr_node', 'variable_to_last_use_id',\n 'node_to_representation', 'node_to... |
from unittest import TestCase
from click import BadParameter
from ipaddress import IPv4Address
from ledshimdemo.ipaddress_param import IPAddressParamType
class TestIPAddressParam(TestCase):
def setUp(self):
self.param_type = IPAddressParamType()
def test_name(self):
self.assertEqual(self.pa... | [
"ledshimdemo.ipaddress_param.IPAddressParamType"
] | [((241, 261), 'ledshimdemo.ipaddress_param.IPAddressParamType', 'IPAddressParamType', ([], {}), '()\n', (259, 261), False, 'from ledshimdemo.ipaddress_param import IPAddressParamType\n')] |
import os
import torch
import gc
import src.commons.utils as utils
from tqdm import tqdm, trange
def decode_labels(label_map, encoded_labels):
index_to_label = {index: label for label, index in label_map.items()}
for i in range(len(encoded_labels)):
for j in range(len(encoded_labels[i])):
... | [
"tqdm.tqdm",
"os.makedirs",
"src.commons.utils.EpochStats",
"gc.collect",
"torch.cuda.empty_cache",
"torch.nn.DataParallel",
"os.path.join"
] | [((648, 706), 'os.makedirs', 'os.makedirs', (['args.experiment.checkpoint_dir'], {'exist_ok': '(True)'}), '(args.experiment.checkpoint_dir, exist_ok=True)\n', (659, 706), False, 'import os\n'), ((1182, 1200), 'src.commons.utils.EpochStats', 'utils.EpochStats', ([], {}), '()\n', (1198, 1200), True, 'import src.commons.u... |
# Generated by Django 3.2.8 on 2021-10-31 07:55
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Dataset',
fields=[
('id', models.BigAutoFie... | [
"django.db.models.BigAutoField",
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.DecimalField",
"django.db.models.DateField"
] | [((303, 399), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (322, 399), False, 'from django.db import migrations, m... |
import re
import requests
from bs4 import BeautifulSoup
class library:
def __init__(self, url):
self.session = requests.Session()
self.url = url
return
def login(self, userid, password):
postData = {
'extpatid': username,
'extpatpw': password
}
res = self.session.post(self.url + '/patroninfo', p... | [
"bs4.BeautifulSoup",
"re.finditer",
"requests.Session",
"re.search"
] | [((115, 133), 'requests.Session', 'requests.Session', ([], {}), '()\n', (131, 133), False, 'import requests\n'), ((775, 813), 'bs4.BeautifulSoup', 'BeautifulSoup', (['res.text', '"""html.parser"""'], {}), "(res.text, 'html.parser')\n", (788, 813), False, 'from bs4 import BeautifulSoup\n'), ((1376, 1414), 'bs4.Beautiful... |
import inflection
import datetime
from airflow.utils.db import provide_session
from airflow.configuration import conf
from airflow.exceptions import DagNotFound, DagRunAlreadyExists
from airflow import models
from airflow.models import DagBag, DagModel, DagRun, Variable
from airflow.utils import timezone
from airflow.... | [
"airflow.models.serialized_dag.SerializedDagModel.has_dag",
"airflow.models.DagModel.get_current",
"airflow.exceptions.DagRunAlreadyExists",
"airflow.models.DagModel.get_dagmodel",
"airflow.configuration.conf.getboolean",
"airflow.exceptions.DagNotFound",
"airflow.utils.timezone.utcnow",
"airflow.mode... | [((459, 523), 'airflow.configuration.conf.getboolean', 'conf.getboolean', (['"""core"""', '"""store_serialized_dags"""'], {'fallback': '(False)'}), "('core', 'store_serialized_dags', fallback=False)\n", (474, 523), False, 'from airflow.configuration import conf\n'), ((3068, 3108), 'datetime.datetime.strptime', 'datetim... |
import os
import subprocess
from pprint import pformat
from sys import platform as _platform
import projections
import cubes
import mountain
import kde
import christmas
import snowflake
def get_imagemagick_path(binary="convert"):
if _platform == "linux" or _platform == "linux2":
return os.path.join(os.pa... | [
"os.path.join",
"os.makedirs",
"os.path.exists"
] | [((302, 349), 'os.path.join', 'os.path.join', (['os.path.sep', '"""usr"""', '"""bin"""', 'binary'], {}), "(os.path.sep, 'usr', 'bin', binary)\n", (314, 349), False, 'import os\n'), ((2419, 2448), 'os.path.exists', 'os.path.exists', (['frames_folder'], {}), '(frames_folder)\n', (2433, 2448), False, 'import os\n'), ((245... |
import pandas as pd
# TODO: Load up the dataset
# Ensuring you set the appropriate header column names
#
# .. your code here ..
df = pd.read_csv('Datasets/servo.data', sep=',', names=['motor', 'screw', 'pgain', 'vgain', 'class'])
print(df)
# TODO: Create a slice that contains all entries
# having a vgain equal to 5.... | [
"pandas.read_csv"
] | [((134, 234), 'pandas.read_csv', 'pd.read_csv', (['"""Datasets/servo.data"""'], {'sep': '""","""', 'names': "['motor', 'screw', 'pgain', 'vgain', 'class']"}), "('Datasets/servo.data', sep=',', names=['motor', 'screw',\n 'pgain', 'vgain', 'class'])\n", (145, 234), True, 'import pandas as pd\n')] |
from glob import glob
import zipfile
import shutil
import os
import json
import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
"""
find all zip files, unzip one by one
for each unzipped content:
get patient ID according to zip filename
save T1 weighted nifit as format "mri5726_NACC626353" zi... | [
"matplotlib.pyplot.subplot",
"os.mkdir",
"json.load",
"zipfile.ZipFile",
"nibabel.load",
"numpy.std",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.close",
"os.walk",
"os.path.exists",
"numpy.mean",
"numpy.array",
"glob.glob",
"shutil.rmtree",
"os.path.join",
"matplotlib.pyplot.savefi... | [((1100, 1119), 'shutil.rmtree', 'shutil.rmtree', (['path'], {}), '(path)\n', (1113, 1119), False, 'import shutil\n'), ((1226, 1239), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (1233, 1239), False, 'import os\n'), ((1443, 1456), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (1450, 1456), False, 'import os\n'... |
import requests
import os
class ChatfuelAPI():
def sendText(senderId,msg):
r = requests.post('https://api.chatfuel.com/bots/'+os.getenv('BOT_ID')+'/users/'+str(senderId)+'/send?chatfuel_token='+os.getenv('CHATFUEL_TOKEN')+'&chatfuel_block_id='+os.getenv('CHATFUEL_BLOCK_TEXT'), json={"repmsg": msg})
... | [
"os.getenv"
] | [((256, 288), 'os.getenv', 'os.getenv', (['"""CHATFUEL_BLOCK_TEXT"""'], {}), "('CHATFUEL_BLOCK_TEXT')\n", (265, 288), False, 'import os\n'), ((565, 598), 'os.getenv', 'os.getenv', (['"""CHATFUEL_BLOCK_IMAGE"""'], {}), "('CHATFUEL_BLOCK_IMAGE')\n", (574, 598), False, 'import os\n'), ((877, 914), 'os.getenv', 'os.getenv'... |
import sys
import h5py
import tkinter as Tk
from matplotlib.backends.backend_tkagg import (
FigureCanvasTkAgg, NavigationToolbar2Tk
)
import matplotlib.pyplot as plt
# from keras.models import load_model
from trajectories import plot_3dtrajectory
from pixels import plot_pixels
# from deeplearning import Visualis... | [
"matplotlib.backends.backend_tkagg.NavigationToolbar2Tk",
"tkinter.StringVar",
"h5py.File",
"trajectories.plot_3dtrajectory.plot",
"tkinter.mainloop",
"tkinter.Button",
"tkinter.Entry",
"pixels.plot_pixels.plot",
"matplotlib.pyplot.figure",
"tkinter.Scale",
"tkinter.Frame",
"tkinter.Label",
... | [((2429, 2453), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (2438, 2453), False, 'import h5py\n'), ((2912, 2919), 'tkinter.Tk', 'Tk.Tk', ([], {}), '()\n', (2917, 2919), True, 'import tkinter as Tk\n'), ((2965, 2979), 'tkinter.Frame', 'Tk.Frame', (['root'], {}), '(root)\n', (2973, 2979)... |
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
class StacAdminSite(admin.AdminSite):
site_header = _('STAC API admin')
site_title = _('geoadmin STAC API')
| [
"django.utils.translation.gettext_lazy"
] | [((146, 165), 'django.utils.translation.gettext_lazy', '_', (['"""STAC API admin"""'], {}), "('STAC API admin')\n", (147, 165), True, 'from django.utils.translation import gettext_lazy as _\n'), ((183, 205), 'django.utils.translation.gettext_lazy', '_', (['"""geoadmin STAC API"""'], {}), "('geoadmin STAC API')\n", (184... |
# -*- coding: utf-8 -*-
from os import walk
import torch
import torchvision
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
import os, sys
from PIL import Image
import cv2
from torchsummary import summary
from torch.utils.data import Dataset, DataLoader, random_split
import torch.nn as nn
i... | [
"utils.siamese.Net",
"torch.no_grad",
"os.path.join",
"torch.utils.data.DataLoader",
"torch.utils.data.random_split",
"torch.nn.BCEWithLogitsLoss",
"matplotlib.pyplot.legend",
"utils.util.save_checkpoint",
"torch.cuda.is_available",
"matplotlib.pyplot.ylabel",
"os.listdir",
"src.data.make_data... | [((585, 616), 'sys.path.insert', 'sys.path.insert', (['(1)', 'project_dir'], {}), '(1, project_dir)\n', (600, 616), False, 'import os, sys\n'), ((549, 583), 'os.path.join', 'os.path.join', (['__file__', '"""../../.."""'], {}), "(__file__, '../../..')\n", (561, 583), False, 'import os, sys\n'), ((3979, 4043), 'src.data.... |
from boutiques import __file__ as bfile
from boutiques.publisher import ZenodoError
from boutiques.bosh import bosh
import json
import subprocess
import shutil
import tempfile
import os
import os.path as op
import sys
import mock
from boutiques_mocks import *
if sys.version_info < (2, 7):
from unittest2 import Test... | [
"boutiques.bosh.bosh",
"tempfile.NamedTemporaryFile",
"subprocess.Popen",
"json.load",
"os.path.dirname",
"shutil.copyfile",
"os.path.join"
] | [((2150, 2195), 'os.path.join', 'op.join', (['example1_dir', '"""example1_docker.json"""'], {}), "(example1_dir, 'example1_docker.json')\n", (2157, 2195), True, 'import os.path as op\n'), ((2222, 2265), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'suffix': '""".json"""'}), "(suffix='.json')\n", ... |
"""A class to create a meme with provided images and quotes.
Memes are created based on the provided image (path) and
quotes - which comprises of quote body and author.
PIL library is used to apply text on the image at a random
location, generated by the _randomise_location method.
"""
from PIL import Image, ImageDraw... | [
"os.makedirs",
"random.randint",
"os.path.isdir",
"textwrap.wrap",
"PIL.Image.open",
"PIL.ImageFont.truetype",
"PIL.ImageDraw.Draw"
] | [((1921, 1942), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['image'], {}), '(image)\n', (1935, 1942), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((1959, 1985), 'textwrap.wrap', 'textwrap.wrap', (['body', 'width'], {}), '(body, width)\n', (1972, 1985), False, 'import textwrap\n'), ((2727, 2747), 'PIL.Image.o... |
from utilities.common_methods import getDebugInfo
from data_storing.assets import tables
from data_storing.assets.database_connection import db_engine
from sqlalchemy.orm import sessionmaker
from utilities import log
dbSession = sessionmaker(bind=db_engine)
session = dbSession()
class DatabaseManager:
def __in... | [
"data_storing.assets.tables.Dividends",
"data_storing.assets.tables.IncomeStatement",
"data_storing.assets.tables.Equity",
"data_storing.assets.tables.Overview",
"utilities.common_methods.getDebugInfo",
"data_storing.assets.tables.Earnings",
"data_storing.assets.tables.BalanceSheet",
"data_storing.ass... | [((232, 260), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {'bind': 'db_engine'}), '(bind=db_engine)\n', (244, 260), False, 'from sqlalchemy.orm import sessionmaker\n'), ((19852, 19950), 'data_storing.assets.tables.ItemEquity', 'tables.ItemEquity', ([], {'equity_id': 'equity.id', 'field': '"""link_problems"""', ... |
"""Tests for effort_estimation transformers."""
from datetime import timedelta
from crum import set_current_request
from django.test.client import RequestFactory
from edx_toggles.toggles.testutils import override_waffle_flag
from edxval.api import create_video, remove_video_for_course
from openedx.core.djangoapps.co... | [
"openedx.core.djangoapps.content.block_structure.factory.BlockStructureFactory.create_from_modulestore",
"django.test.client.RequestFactory",
"datetime.timedelta",
"edx_toggles.toggles.testutils.override_waffle_flag",
"xmodule.modulestore.tests.sample_courses.BlockInfo",
"xmodule.modulestore.tests.factori... | [((6251, 6310), 'edx_toggles.toggles.testutils.override_waffle_flag', 'override_waffle_flag', (['EFFORT_ESTIMATION_DISABLED_FLAG', '(True)'], {}), '(EFFORT_ESTIMATION_DISABLED_FLAG, True)\n', (6271, 6310), False, 'from edx_toggles.toggles.testutils import override_waffle_flag\n'), ((2334, 2419), 'openedx.core.djangoapp... |
from aloe import step, world
from problems.meta.coding.practice.reverse_to_make_equal import are_they_similar
def process(string:str) -> list:
return [
int(num)
for num in string.split(',')
]
@step("two arrays (?P<A>.+) and (?P<B>.+)")
def step_impl(self, A, B):
world.array_a = process(A... | [
"problems.meta.coding.practice.reverse_to_make_equal.are_they_similar",
"aloe.step"
] | [((221, 263), 'aloe.step', 'step', (['"""two arrays (?P<A>.+) and (?P<B>.+)"""'], {}), "('two arrays (?P<A>.+) and (?P<B>.+)')\n", (225, 263), False, 'from aloe import step, world\n'), ((356, 386), 'aloe.step', 'step', (['"""I run are_they_similar"""'], {}), "('I run are_they_similar')\n", (360, 386), False, 'from aloe... |
import xml.etree.ElementTree as ET
from collections import OrderedDict
import numpy as np
try:
import networkx as nx
NX = True
except ImportError:
prNX = False
class EDM:
def __init__(self, filename):
"""
Initiate an instance of an EDM object.
Parameters
----------
... | [
"collections.OrderedDict",
"xml.etree.ElementTree.parse",
"networkx.Graph"
] | [((446, 464), 'xml.etree.ElementTree.parse', 'ET.parse', (['filename'], {}), '(filename)\n', (454, 464), True, 'import xml.etree.ElementTree as ET\n'), ((4540, 4550), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (4548, 4550), True, 'import networkx as nx\n'), ((13937, 13950), 'collections.OrderedDict', 'OrderedDict'... |
#!python3
# -*- coding: utf-8 -*-
import os
import sys
import time
import subprocess
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # not required after 'pip install uiautomation'
import uiautomation as automation
def main():
width = 500
height = 500
cmdWindow = automation.... | [
"subprocess.Popen",
"os.path.abspath",
"uiautomation.Logger.WriteLine",
"uiautomation.GetConsoleWindow",
"uiautomation.Bitmap",
"time.clock"
] | [((309, 338), 'uiautomation.GetConsoleWindow', 'automation.GetConsoleWindow', ([], {}), '()\n', (336, 338), True, 'import uiautomation as automation\n'), ((343, 400), 'uiautomation.Logger.WriteLine', 'automation.Logger.WriteLine', (['"""create a transparent image"""'], {}), "('create a transparent image')\n", (370, 400... |
#!!!!!!This will overwrite your excel file!!!!!!!!!!!!
# excel file must have an empty first column
import pandas as pd
import os
from openpyxl import load_workbook
file=input('File Path: ')
pth=os.path.dirname(file)
df=pd.read_excel(file)
file_cols = list(df)#Alternate to # file_cols = df.columns... | [
"pandas.DataFrame",
"os.path.dirname",
"pandas.read_excel",
"pandas.ExcelWriter",
"pandas.concat"
] | [((211, 232), 'os.path.dirname', 'os.path.dirname', (['file'], {}), '(file)\n', (226, 232), False, 'import os\n'), ((239, 258), 'pandas.read_excel', 'pd.read_excel', (['file'], {}), '(file)\n', (252, 258), True, 'import pandas as pd\n'), ((444, 483), 'pandas.ExcelWriter', 'pd.ExcelWriter', (['file'], {'engine': '"""ope... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from django.shortcuts import render, redirect, HttpResponse
from django.contrib.auth import authenticate
from django.contrib.auth import login as auth_login
from django.contrib.auth import logout as ... | [
"django.contrib.auth.decorators.login_required",
"django.shortcuts.HttpResponse",
"django.shortcuts.redirect",
"django.db.models.Q",
"django.contrib.auth.logout",
"django.contrib.auth.authenticate",
"django.utils.translation.ugettext_lazy",
"django.contrib.auth.login"
] | [((1430, 1465), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/login/"""'}), "(login_url='/login/')\n", (1444, 1465), False, 'from django.contrib.auth.decorators import login_required\n'), ((1546, 1581), 'django.contrib.auth.decorators.login_required', 'login_required', ([], ... |
import numpy as _np
import scipy.sparse as _sp
from ._basis_utils import _shuffle_sites
####################################################
# set of helper functions to implement the partial #
# trace of lattice density matrices. They do not #
# have any checks and states are assumed to be #
# in the non-sym... | [
"numpy.zeros",
"numpy.einsum"
] | [((6095, 6140), 'numpy.zeros', '_np.zeros', (['psi.col.shape'], {'dtype': 'psi.col.dtype'}), '(psi.col.shape, dtype=psi.col.dtype)\n', (6104, 6140), True, 'import numpy as _np\n'), ((1385, 1420), 'numpy.einsum', '_np.einsum', (['"""...jlkl->...jk"""', 'rho_v'], {}), "('...jlkl->...jk', rho_v)\n", (1395, 1420), True, 'i... |
from cloudmesh.common.console import Console
from cloudmesh.common.util import path_expand
from cloudmesh.common.debug import VERBOSE
import sys
import connexion
from importlib import import_module
import os
def dynamic_import(abs_module_path, class_name):
module_object = import_module(abs_module_path)
target... | [
"sys.path.append",
"connexion.App",
"cloudmesh.common.util.path_expand",
"importlib.import_module",
"cloudmesh.common.debug.VERBOSE",
"cloudmesh.common.console.Console.error",
"os.path.dirname",
"sys.exit",
"cloudmesh.common.console.Console.ok"
] | [((279, 309), 'importlib.import_module', 'import_module', (['abs_module_path'], {}), '(abs_module_path)\n', (292, 309), False, 'from importlib import import_module\n'), ((772, 789), 'cloudmesh.common.util.path_expand', 'path_expand', (['spec'], {}), '(spec)\n', (783, 789), False, 'from cloudmesh.common.util import path... |
# Copyright 2019 Cloudera, 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 in writing, s... | [
"sys.path.append",
"tensorflow.feature_column.numeric_column",
"random.shuffle",
"sklearn.preprocessing.LabelEncoder",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.estimator.Estimator",
"tensorflow.read_file",
"IPython.display.Image",
"os.listdir"
] | [((1030, 1067), 'sys.path.append', 'sys.path.append', (['"""2_machine_learning"""'], {}), "('2_machine_learning')\n", (1045, 1067), False, 'import sys\n'), ((2119, 2142), 'random.shuffle', 'random.shuffle', (['indices'], {}), '(indices)\n', (2133, 2142), False, 'import os, random, math, subprocess\n'), ((2618, 2632), '... |
try:
from django.contrib import admin
from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin
from positions.models import *
except ImportError:
pass
else:
from django.contrib import admin
from ..mixins import *
class PositionAdmin(PublicaModelAdminMixin, ... | [
"django.contrib.admin.site.register"
] | [((537, 581), 'django.contrib.admin.site.register', 'admin.site.register', (['Position', 'PositionAdmin'], {}), '(Position, PositionAdmin)\n', (556, 581), False, 'from django.contrib import admin\n')] |
# Thx https://github.com/Yankovsky/yandex-algos-training/blob/master/hw7/c.py
from heapq import heappop, heappush
STUDENT_START = -1
STUDENT_END = 1
def calculate_variants(n, d, x):
line_with_distance = []
max_student = 0
for student in x:
max_student = max(max_student, student)
line_wi... | [
"heapq.heappush",
"heapq.heappop"
] | [((730, 743), 'heapq.heappop', 'heappop', (['heap'], {}), '(heap)\n', (737, 743), False, 'from heapq import heappop, heappush\n'), ((983, 1018), 'heapq.heappush', 'heappush', (['heap', 'student_exam_number'], {}), '(heap, student_exam_number)\n', (991, 1018), False, 'from heapq import heappop, heappush\n')] |
import torch
import numpy as np
__all__ = ["CosineDistance"]
#NOTE: see https://github.com/pytorch/pytorch/issues/8069
#TODO: update acos_safe once PR mentioned in above link is merged and available
def _acos_safe(x: torch.Tensor, eps: float=1e-4):
slope = np.arccos(1.0 - eps) / eps
# TODO: stop doing this a... | [
"torch.sum",
"torch.sign",
"torch.abs",
"torch.empty_like",
"numpy.arccos",
"torch.acos"
] | [((422, 441), 'torch.empty_like', 'torch.empty_like', (['x'], {}), '(x)\n', (438, 441), False, 'import torch\n'), ((506, 524), 'torch.sign', 'torch.sign', (['x[bad]'], {}), '(x[bad])\n', (516, 524), False, 'import torch\n'), ((541, 560), 'torch.acos', 'torch.acos', (['x[good]'], {}), '(x[good])\n', (551, 560), False, '... |
import re
import unicodedata
def to_char(s):
return unichr(int(s,16))
def unaccent(character):
new_character = ""
category = unicodedata.category(character)
if category.startswith("L"): # If letter.
decoded = unicodedata.decomposition(character)
if decoded: # If complex letter.
for subchar in ... | [
"unicodedata.decomposition",
"unicodedata.category",
"re.compile"
] | [((133, 164), 'unicodedata.category', 'unicodedata.category', (['character'], {}), '(character)\n', (153, 164), False, 'import unicodedata\n'), ((1109, 1177), 're.compile', 're.compile', (['"""\\\\bhttp://[-=\\\\w/.#?&\\\\d]+|\\\\bwww\\\\.[-=\\\\w\\\\/.#?&\\\\d]+"""'], {}), "('\\\\bhttp://[-=\\\\w/.#?&\\\\d]+|\\\\bwww\... |
# Generated by Django 2.2.6 on 2019-10-14 11:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Company',
fields=[
... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((336, 429), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (352, 429), False, 'from django.db import migrations, models\... |
from setuptools import setup
setup(
name='secure_config_manager',
version='0.0.1',
description='Testing installation of Package',
url='#',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['secure_config_manager'],
zip_safe=False
)
| [
"setuptools.setup"
] | [((29, 259), 'setuptools.setup', 'setup', ([], {'name': '"""secure_config_manager"""', 'version': '"""0.0.1"""', 'description': '"""Testing installation of Package"""', 'url': '"""#"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'packages': "['secure_config_manager']", 'zip_safe... |
import os
import glob
import sys
import itertools
import numpy as np
import tensorflow as tf
import librosa
from grog.config import Config
from grog.models.infer import Inference
import IPython.display as ipd
from grog.fft import stft_default
from museval.metrics import bss_eval
from grog.util import pad_or_truncate... | [
"grog.models.infer.Inference",
"grog.util.pad_or_truncate"
] | [((600, 637), 'grog.util.pad_or_truncate', 'pad_or_truncate', (['reference', 'estimated'], {}), '(reference, estimated)\n', (615, 637), False, 'from grog.util import pad_or_truncate\n'), ((1597, 1614), 'grog.models.infer.Inference', 'Inference', (['config'], {}), '(config)\n', (1606, 1614), False, 'from grog.models.inf... |
#!/usr/bin/env python
# encoding:utf-8
import os
__author__ = 'zhangmm'
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
SECRET_KEY = os.environ.get("SECRET_KEY") or 'hard to guess key'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
ZBLOG_MAIL_SUBJECT_PREFIX = '[ZBlog]'
ZBLOG_MAIL_S... | [
"logging.handlers.SMTPHandler",
"os.path.dirname",
"logging.StreamHandler",
"os.environ.get",
"logging.handlers.SysLogHandler",
"os.path.join"
] | [((101, 126), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (116, 126), False, 'import os\n'), ((435, 466), 'os.environ.get', 'os.environ.get', (['"""MAIL_USERNAME"""'], {}), "('MAIL_USERNAME')\n", (449, 466), False, 'import os\n'), ((487, 518), 'os.environ.get', 'os.environ.get', (['"""MAIL... |
import unittest
from helpers.hash_map import HashMap
class TestHashMap(unittest.TestCase):
def test_put_on_small_map(self):
self.assertRaises(ValueError, HashMap, -1)
self.assertRaises(ValueError, HashMap, 0)
self.assertRaises(ValueError, HashMap, 1)
def test_put_same_key(self):
... | [
"unittest.main",
"helpers.hash_map.HashMap"
] | [((3923, 3938), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3936, 3938), False, 'import unittest\n'), ((330, 339), 'helpers.hash_map.HashMap', 'HashMap', ([], {}), '()\n', (337, 339), False, 'from helpers.hash_map import HashMap\n'), ((555, 564), 'helpers.hash_map.HashMap', 'HashMap', ([], {}), '()\n', (562, 5... |
import sys
import json
import urllib
# TODO: Better error handling
def trigger_ifttt(settings):
# stuff goes here
api_prefix = settings.get('api_prefix')
api_suffix = settings.get('api_suffix')
# Need to validate key is present, else fail.
if not settings.get('api_key_override'):
key = se... | [
"sys.stdin.read",
"urllib.urlopen",
"json.dumps",
"urllib.urlencode",
"sys.exit"
] | [((755, 827), 'urllib.urlencode', 'urllib.urlencode', (["{'value1': value1, 'value2': value2, 'value3': value3}"], {}), "({'value1': value1, 'value2': value2, 'value3': value3})\n", (771, 827), False, 'import urllib\n'), ((850, 875), 'urllib.urlopen', 'urllib.urlopen', (['url', 'data'], {}), '(url, data)\n', (864, 875)... |
from rest_framework import serializers
from systemstats.models import MinuteStats
class MinuteStatsSerializer(serializers.HyperlinkedModelSerializer):
#api_url = serializers.SerializerMethodField('get_api_url')
camera_name = serializers.SerializerMethodField()
class Meta:
model = MinuteStats
... | [
"rest_framework.serializers.SerializerMethodField"
] | [((235, 270), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (268, 270), False, 'from rest_framework import serializers\n')] |
#Imports
from tkinter import *
import random
import threading
#Constants
ROWS=30
COLS=60
LABEL="Label(window, text ='0',fg='black', bg='black')"
INITIAL=[(random.randint(0,ROWS),random.randint(0,COLS)) for iter in range(int((ROWS*COLS)/4))]
ALIVE=".config(bg='white',fg='white',text='1')"
DEAD=".config(bg='black',fg='b... | [
"threading.Thread",
"random.randint"
] | [((1677, 1710), 'threading.Thread', 'threading.Thread', ([], {'target': 'callback'}), '(target=callback)\n', (1693, 1710), False, 'import threading\n'), ((156, 179), 'random.randint', 'random.randint', (['(0)', 'ROWS'], {}), '(0, ROWS)\n', (170, 179), False, 'import random\n'), ((179, 202), 'random.randint', 'random.ra... |
from deepstack_sdk import ServerConfig, Detection
import cv2
config = ServerConfig("http://localhost:80")
detection = Detection(config)
cv2_image = cv2.imread("image.jpg");
response = detection.detectObject(cv2_image,output="image_output.jpg")
for obj in response:
print("Name: {}, Confidence: {}, x_min: {}, y_mi... | [
"deepstack_sdk.ServerConfig",
"cv2.imread",
"deepstack_sdk.Detection"
] | [((71, 106), 'deepstack_sdk.ServerConfig', 'ServerConfig', (['"""http://localhost:80"""'], {}), "('http://localhost:80')\n", (83, 106), False, 'from deepstack_sdk import ServerConfig, Detection\n'), ((119, 136), 'deepstack_sdk.Detection', 'Detection', (['config'], {}), '(config)\n', (128, 136), False, 'from deepstack_s... |
"""authentik stage Base view"""
from typing import TYPE_CHECKING, Optional
from django.contrib.auth.models import AnonymousUser
from django.http import HttpRequest
from django.http.request import QueryDict
from django.http.response import HttpResponse
from django.urls import reverse
from django.views.generic.base impo... | [
"authentik.flows.challenge.AccessDeniedChallenge",
"sentry_sdk.hub.Hub.current.start_span",
"django.urls.reverse",
"authentik.flows.challenge.HttpChallengeResponse",
"structlog.stdlib.get_logger"
] | [((3210, 3242), 'authentik.flows.challenge.HttpChallengeResponse', 'HttpChallengeResponse', (['challenge'], {}), '(challenge)\n', (3231, 3242), False, 'from authentik.flows.challenge import AccessDeniedChallenge, Challenge, ChallengeResponse, ChallengeTypes, ContextualFlowInfo, HttpChallengeResponse, WithUserInfoChalle... |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Copyright (c) 2019, Eurecat / UPF
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of... | [
"numpy.minimum",
"masp.shoebox_room_sim.render_rirs_mic",
"numpy.empty",
"masp.shoebox_room_sim.apply_source_signals_mic",
"time.time",
"librosa.core.load",
"masp.shoebox_room_sim.find_abs_coeffs_from_rt",
"numpy.array",
"masp.shoebox_room_sim.compute_echograms_mic",
"masp.shoebox_room_sim.room_st... | [((2087, 2113), 'numpy.array', 'np.array', (['[10.2, 7.1, 3.2]'], {}), '([10.2, 7.1, 3.2])\n', (2095, 2113), True, 'import numpy as np\n'), ((2187, 2222), 'numpy.array', 'np.array', (['[1.0, 0.8, 0.7, 0.6, 0.5]'], {}), '([1.0, 0.8, 0.7, 0.6, 0.5])\n', (2195, 2222), True, 'import numpy as np\n'), ((2285, 2301), 'numpy.e... |
import logging
class Logger:
def __init__(self, path, clevel=logging.DEBUG, Flevel=logging.DEBUG):
self.logger = logging.getLogger(path) #定义日志文件路径名字
self.logger.setLevel(logging.DEBUG) #定义日志文件为debug级别
fmt = logging.Formatter('[%(asctime)s] [%(levelname)s] %(message)s', '%Y-%m-%d %H:%M:%S') #... | [
"logging.Formatter",
"logging.StreamHandler",
"logging.FileHandler",
"logging.getLogger"
] | [((125, 148), 'logging.getLogger', 'logging.getLogger', (['path'], {}), '(path)\n', (142, 148), False, 'import logging\n'), ((235, 322), 'logging.Formatter', 'logging.Formatter', (['"""[%(asctime)s] [%(levelname)s] %(message)s"""', '"""%Y-%m-%d %H:%M:%S"""'], {}), "('[%(asctime)s] [%(levelname)s] %(message)s',\n '%Y... |
"""
ABC: 抽象基类
"""
import pytest
from abc import ABC, abstractmethod
from collections.abc import Sized
"""
collections.abc 的元类也是 ABC,当然我们可以自己定义一个
class Sized(metaclass=ABCMeta):
__slots__ = ()
@abstractmethod
def __len__(self):
return 0
@classmethod
def __subclasshook__(cls, C):
i... | [
"pytest.raises"
] | [((539, 563), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeError)\n', (552, 563), False, 'import pytest\n')] |
import tensorflow as tf
from detector.constants import SHUFFLE_BUFFER_SIZE, NUM_PARALLEL_CALLS, RESIZE_METHOD
from .random_image_crop import random_image_crop
from .other_augmentations import random_color_manipulations,\
random_flip_left_right, random_pixel_value_scale, random_jitter_boxes
class Pipeline:
"""... | [
"tensorflow.image.resize_images",
"tensorflow.maximum",
"tensorflow.random_shuffle",
"tensorflow.python_io.tf_record_iterator",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.minimum",
"tensorflow.stack",
"tensorflow.round",
"tensorflow.shape",
"tensorflow.parse_single_example",
"tens... | [((6755, 6770), 'tensorflow.shape', 'tf.shape', (['image'], {}), '(image)\n', (6763, 6770), True, 'import tensorflow as tf\n'), ((6784, 6811), 'tensorflow.to_float', 'tf.to_float', (['image_shape[0]'], {}), '(image_shape[0])\n', (6795, 6811), True, 'import tensorflow as tf\n'), ((6824, 6851), 'tensorflow.to_float', 'tf... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import pathlib
import os
from ansible.errors import AnsibleOptionsError
from ansible.module_utils.six import iteritems, string_types
from ansible_collections.smabot.base.plugins.module_utils.plugins.config_no... | [
"ansible_collections.smabot.base.plugins.module_utils.plugins.config_normalizing.base.DefaultSetterConstant",
"ansible_collections.smabot.base.plugins.module_utils.utils.dicting.setdefault_none"
] | [((1290, 1319), 'ansible_collections.smabot.base.plugins.module_utils.plugins.config_normalizing.base.DefaultSetterConstant', 'DefaultSetterConstant', (['"""nssm"""'], {}), "('nssm')\n", (1311, 1319), False, 'from ansible_collections.smabot.base.plugins.module_utils.plugins.config_normalizing.base import ConfigNormaliz... |
from django import template
register = template.Library()
def get_attendance(character):
counter = 0
for raid_day in character.attendance.all():
if raid_day.present:
counter += 1
return counter
register.filter('get_attendance', get_attendance)
| [
"django.template.Library"
] | [((39, 57), 'django.template.Library', 'template.Library', ([], {}), '()\n', (55, 57), False, 'from django import template\n')] |
#!/usr/bin/env python3
import os
import json
import logging
import argparse
import requests
logger = logging.getLogger("GHAS-SARIF-Puller")
parser = argparse.ArgumentParser("GHAS-SARIF-Puller")
parser.add_argument("--debug", action="store_true", help="Enable Debugging")
group_github = parser.add_argument_group("Git... | [
"json.dump",
"argparse.ArgumentParser",
"logging.basicConfig",
"os.environ.get",
"requests.get",
"logging.getLogger"
] | [((103, 141), 'logging.getLogger', 'logging.getLogger', (['"""GHAS-SARIF-Puller"""'], {}), "('GHAS-SARIF-Puller')\n", (120, 141), False, 'import logging\n'), ((152, 196), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""GHAS-SARIF-Puller"""'], {}), "('GHAS-SARIF-Puller')\n", (175, 196), False, 'import argpar... |
# Copyright 2021, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | [
"tensorflow.test.main",
"periodic_distribution_shift.datasets.client_sampling.build_time_varying_dataset_fn",
"absl.flags.DEFINE_integer",
"tensorflow_federated.simulation.baselines.ClientSpec"
] | [((785, 870), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""stackoverflow_word_vocab_size"""', '(10000)', '"""Vocabulary size."""'], {}), "('stackoverflow_word_vocab_size', 10000, 'Vocabulary size.'\n )\n", (805, 870), False, 'from absl import flags\n'), ((871, 957), 'absl.flags.DEFINE_integer', 'flags.... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import datetime
import json
import logging
import os
import random
import time
from pathlib import Path
import cv2
import numpy as np
import torch
from PIL import Image
from torch.utils.data import DataLoader, DistributedSampler
fro... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.optim.lr_scheduler.StepLR",
"torch.utils.data.RandomSampler",
"torch.optim.AdamW",
"json.dumps",
"pathlib.Path",
"torch.device",
"util.misc.is_main_process",
"os.path.join",
"util.misc.init_distributed_mode",
"datasets.coco.build",
"torc... | [((577, 604), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (594, 604), False, 'import logging\n'), ((6230, 6297), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Set transformer detector"""'], {'add_help': '(False)'}), "('Set transformer detector', add_help=False)\n", (6253,... |
from __future__ import annotations
import torch
from torch import nn
from torch._C import dtype
class SinusoidalPositionEmbedding(nn.Module):
"""定义Sin-Cos位置Embedding
"""
def __init__(
self, output_dim: int, merge_mode: str ='add', custom_position_ids: int=False, **kwargs
):
super(Sinus... | [
"torch.stack",
"torch.split",
"torch.cat",
"torch.cos",
"torch.einsum",
"torch.tile",
"torch.pow",
"torch.arange",
"torch.nn.Linear",
"torch.reshape",
"torch.sin"
] | [((1182, 1242), 'torch.arange', 'torch.arange', (['(0)', '(self.output_dim // 2)'], {'dtype': 'self.float_type'}), '(0, self.output_dim // 2, dtype=self.float_type)\n', (1194, 1242), False, 'import torch\n'), ((1261, 1311), 'torch.pow', 'torch.pow', (['(10000.0)', '(-2 * indices / self.output_dim)'], {}), '(10000.0, -2... |
"""
centreline_vector_tiles
Generates vector tiles from the MOVE conflation target, which is built by the
`centreline_conflation_target` DAG. These are stored in `/data/tiles`, and are served from
`/tiles` on our web EC2 instances; they are used by `FcPaneMap` in the web frontend to render
interactive centreline feat... | [
"airflow_utils.create_bash_task_nested",
"airflow_utils.create_dag",
"datetime.datetime"
] | [((538, 558), 'datetime.datetime', 'datetime', (['(2019)', '(5)', '(5)'], {}), '(2019, 5, 5)\n', (546, 558), False, 'from datetime import datetime\n'), ((598, 658), 'airflow_utils.create_dag', 'create_dag', (['__file__', '__doc__', 'START_DATE', 'SCHEDULE_INTERVAL'], {}), '(__file__, __doc__, START_DATE, SCHEDULE_INTER... |
import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn.model_selection import GridSearchCV
import lightgbm as lgb
lbl = preprocessing.LabelEncoder()
data = {
'hol':
pd.read_csv('../data/date_info.csv')
}
data['hol']['calendar_date'] = pd.to_datetime(data['hol']['calendar_... | [
"pandas.read_csv",
"pandas.to_datetime",
"sklearn.preprocessing.LabelEncoder"
] | [((152, 180), 'sklearn.preprocessing.LabelEncoder', 'preprocessing.LabelEncoder', ([], {}), '()\n', (178, 180), False, 'from sklearn import preprocessing\n'), ((283, 327), 'pandas.to_datetime', 'pd.to_datetime', (["data['hol']['calendar_date']"], {}), "(data['hol']['calendar_date'])\n", (297, 327), True, 'import pandas... |
# Auto generated from sssom.yaml by pythongen.py version: 0.9.0
# Generation date: 2021-12-01T14:30:38
# Schema: sssom
#
# id: http://w3id.org/sssom/schema/
# description: Datamodel for Simple Standard for Sharing Ontology Mappings (SSSOM)
# license: https://creativecommons.org/publicdomain/zero/1.0/
import dataclasse... | [
"linkml_runtime.linkml_model.meta.EnumDefinition",
"linkml_runtime.utils.metamodelcore.empty_list",
"linkml_runtime.utils.metamodelcore.URI",
"linkml_runtime.linkml_model.meta.PermissibleValue",
"linkml_runtime.utils.curienamespace.CurieNamespace",
"linkml_runtime.utils.metamodelcore.XSDDate"
] | [((1476, 1541), 'linkml_runtime.utils.curienamespace.CurieNamespace', 'CurieNamespace', (['"""Orphanet"""', '"""http://www.orpha.net/ORDO/Orphanet_"""'], {}), "('Orphanet', 'http://www.orpha.net/ORDO/Orphanet_')\n", (1490, 1541), False, 'from linkml_runtime.utils.curienamespace import CurieNamespace\n'), ((1547, 1596),... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-12-19 18:38
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profil', '0009_auto_20190112_2032'),
]
operations = [
migrati... | [
"datetime.date"
] | [((444, 471), 'datetime.date', 'datetime.date', (['(1999)', '(12)', '(31)'], {}), '(1999, 12, 31)\n', (457, 471), False, 'import datetime\n')] |
from collections import OrderedDict
from PyQt5 import QtWidgets
from PyQt5.QtGui import QStandardItemModel, QStandardItem
from PyQt5.QtCore import QItemSelectionModel
class Edit_Tree_Model(QStandardItemModel):
'''
Model container for an Edit_Tree_View, to interract with
a tree view widget.
Attribute... | [
"PyQt5.QtGui.QStandardItem"
] | [((3911, 3931), 'PyQt5.QtGui.QStandardItem', 'QStandardItem', (['label'], {}), '(label)\n', (3924, 3931), False, 'from PyQt5.QtGui import QStandardItemModel, QStandardItem\n')] |
# Generated by Django 3.1 on 2020-08-31 11:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0002_provincebudgetbulk'),
]
operations = [
migrations.DeleteModel(
name='ProvinceBudgetBulk',
),
]
| [
"django.db.migrations.DeleteModel"
] | [((222, 271), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""ProvinceBudgetBulk"""'}), "(name='ProvinceBudgetBulk')\n", (244, 271), False, 'from django.db import migrations\n')] |
from pydantic import ConstrainedFloat
from pydantic_factories.value_generators.constrained_number import (
generate_constrained_number,
get_constrained_number_range,
)
from pydantic_factories.value_generators.primitives import create_random_float
def handle_constrained_float(field: ConstrainedFloat) -> float... | [
"pydantic_factories.value_generators.constrained_number.get_constrained_number_range",
"pydantic_factories.value_generators.constrained_number.generate_constrained_number"
] | [((480, 604), 'pydantic_factories.value_generators.constrained_number.get_constrained_number_range', 'get_constrained_number_range', ([], {'gt': 'field.gt', 'ge': 'field.ge', 'lt': 'field.lt', 'le': 'field.le', 't_type': 'float', 'multiple_of': 'multiple_of'}), '(gt=field.gt, ge=field.ge, lt=field.lt, le=\n field.le... |
__doc__ = """
Symbolic calculation for code generation and automatic jacobian computation.
"""
import sympy
import pyequion
import numpy
import re
from sympy.utilities.lambdify import lambdastr
REGEX_FUNC_DEFINITION = r"def\s+\w+\([\w,\s]+\)\:"
# was u instead of r
def prepare_for_sympy_substituting_numpy():
... | [
"sympy.utilities.lambdify.lambdastr",
"sympy.diff",
"re.findall",
"sympy.log",
"re.sub"
] | [((2332, 2350), 'sympy.utilities.lambdify.lambdastr', 'lambdastr', (['x', 'expr'], {}), '(x, expr)\n', (2341, 2350), False, 'from sympy.utilities.lambdify import lambdastr\n'), ((4234, 4270), 're.findall', 're.findall', (['REGEX_FUNC_DEFINITION', 's'], {}), '(REGEX_FUNC_DEFINITION, s)\n', (4244, 4270), False, 'import r... |
from Kaspa.modules.abstract_modules.abstractModule import AbstractModule
from Kaspa.modules.moduleManager import ModuleManager as mManager
class AbstractBriefingModule(AbstractModule):
"""Abstract class for briefing modules"""
# TODO adapt to new language model
def briefing_action(self, query):
... | [
"Kaspa.modules.moduleManager.ModuleManager.get_instance"
] | [((732, 755), 'Kaspa.modules.moduleManager.ModuleManager.get_instance', 'mManager.get_instance', ([], {}), '()\n', (753, 755), True, 'from Kaspa.modules.moduleManager import ModuleManager as mManager\n'), ((781, 804), 'Kaspa.modules.moduleManager.ModuleManager.get_instance', 'mManager.get_instance', ([], {}), '()\n', (... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File : DecisionTree.py
@Author : <NAME>
@Emial : <EMAIL>
@Date : 2022/02/21 16:59
@Description : 决策树
"""
import time
import numpy as np
def loadData(fileName):
"""
加载文件
@Args:
fileName: 加载的文件路径
@Returns:
... | [
"numpy.log2",
"numpy.array",
"time.time"
] | [((2776, 2799), 'numpy.array', 'np.array', (['trainDataList'], {}), '(trainDataList)\n', (2784, 2799), True, 'import numpy as np\n'), ((2820, 2844), 'numpy.array', 'np.array', (['trainLabelList'], {}), '(trainLabelList)\n', (2828, 2844), True, 'import numpy as np\n'), ((6624, 6635), 'time.time', 'time.time', ([], {}), ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 1 20:33:32 2019
@authors:
<NAME> (<EMAIL>)
<NAME> (<EMAIL>)
"""
from collections import Counter
from scipy import signal
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('TkAgg')
class EmotionalSlice:
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.plot",
"scipy.signal.resample",
"matplotlib.pyplot.close",
"numpy.asarray",
"matplotlib.pyplot.yticks",
"numpy.zeros",
"matplotlib.pyplot.legend",
"collections.Counter",
"numpy.hstack",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.linspac... | [((272, 295), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (286, 295), False, 'import matplotlib\n'), ((3573, 3592), 'numpy.zeros', 'np.zeros', (['sliceSize'], {}), '(sliceSize)\n', (3581, 3592), True, 'import numpy as np\n'), ((12613, 12633), 'numpy.asarray', 'np.asarray', (['self.ots'], {... |
"""
reference: https://vcokltfre.dev/tutorial/
"""
import os
from dotenv import load_dotenv
import discord
from discord.ext import commands
# load token and guild information
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
GUILD = os.getenv('DISCORD_GUILD')
# enable bot to track presence of members
intents = di... | [
"dotenv.load_dotenv",
"discord.Intents.default",
"os.getenv",
"discord.ext.commands.Bot"
] | [((180, 193), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (191, 193), False, 'from dotenv import load_dotenv\n'), ((202, 228), 'os.getenv', 'os.getenv', (['"""DISCORD_TOKEN"""'], {}), "('DISCORD_TOKEN')\n", (211, 228), False, 'import os\n'), ((237, 263), 'os.getenv', 'os.getenv', (['"""DISCORD_GUILD"""'], {}... |
import pytest
import numpy
from pyckmeans.knee import KneeLocator
@pytest.mark.parametrize('direction', ['increasing', 'decreasing'])
@pytest.mark.parametrize('curve', ['convex', 'concave'])
def test_simple(direction, curve):
x = numpy.array([1.0, 2.0, 3.0 ,4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ])
y = numpy.array([... | [
"pytest.mark.parametrize",
"pytest.raises",
"pyckmeans.knee.KneeLocator",
"numpy.array"
] | [((69, 135), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""direction"""', "['increasing', 'decreasing']"], {}), "('direction', ['increasing', 'decreasing'])\n", (92, 135), False, 'import pytest\n'), ((137, 192), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""curve"""', "['convex', 'concave']"... |
import ezodf
import pandas as pd
def read_ods(filename, sheet_no=0, header=0):
tab = ezodf.opendoc(filename=filename).sheets[sheet_no]
return pd.DataFrame({col[header].value:[x.value for x in col[header+1:]]
for col in tab.columns()})
| [
"ezodf.opendoc"
] | [((91, 123), 'ezodf.opendoc', 'ezodf.opendoc', ([], {'filename': 'filename'}), '(filename=filename)\n', (104, 123), False, 'import ezodf\n')] |
from discord.ext import commands
from cogs.pre.utils.errors import NotAContributorError
# Check if whoever used the command is in the bot's contributors.
def is_cog_contributor():
async def predicate(ctx):
# If statement, checking if the author of the command is in a list (int) of IDs stored... | [
"discord.ext.commands.check"
] | [((739, 764), 'discord.ext.commands.check', 'commands.check', (['predicate'], {}), '(predicate)\n', (753, 764), False, 'from discord.ext import commands\n')] |
"""Change font properties of the elements of axis."""
from pymeleon.font_modifiers import *
import matplotlib.pyplot as plt
if __name__ == "__main__":
# create a plot
fig, ax = plt.subplots()
ax.plot([0, 1], [0, 1])
ax.set_title("my title")
ax.set_ylabel("my label")
# modify the plot
modi... | [
"matplotlib.pyplot.subplots"
] | [((187, 201), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (199, 201), True, 'import matplotlib.pyplot as plt\n')] |
from time import sleep
from PyQt5.QtCore import QThread, pyqtSignal, pyqtSlot
from PyQt5.QtWidgets import QLabel
class CollisionPlayerBullet(QThread):
collision_occured = pyqtSignal(QLabel, QLabel, str)
def __init__(self):
super().__init__()
self.is_not_done = True
self.bullets = [... | [
"PyQt5.QtCore.pyqtSignal",
"time.sleep",
"PyQt5.QtCore.pyqtSlot"
] | [((179, 210), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['QLabel', 'QLabel', 'str'], {}), '(QLabel, QLabel, str)\n', (189, 210), False, 'from PyQt5.QtCore import QThread, pyqtSignal, pyqtSlot\n'), ((856, 866), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot', ([], {}), '()\n', (864, 866), False, 'from PyQt5.QtCore import QThread, p... |
from django.core.mail import send_mail
'''
para: é uma lista de destinatários.
'''
def send_prf_mail(assunto, mensagem, para):
send_mail(assunto, mensagem, '<EMAIL>', para, fail_silently=False)
| [
"django.core.mail.send_mail"
] | [((132, 198), 'django.core.mail.send_mail', 'send_mail', (['assunto', 'mensagem', '"""<EMAIL>"""', 'para'], {'fail_silently': '(False)'}), "(assunto, mensagem, '<EMAIL>', para, fail_silently=False)\n", (141, 198), False, 'from django.core.mail import send_mail\n')] |
# evaluate_hypotheses.py
# This script evaluates our preregistered hypotheses using
# the doctopics file produced by MALLET.
# This version of evaluate_hypotheses is redesigned to permit
# being called repeatedly as a function from measure_variation.
import sys, csv
import numpy as np
from scipy.spatial.distance imp... | [
"csv.DictReader",
"collections.Counter",
"scipy.spatial.distance.cosine",
"numpy.array"
] | [((2758, 2767), 'collections.Counter', 'Counter', ([], {}), '()\n', (2765, 2767), False, 'from collections import Counter\n'), ((2785, 2794), 'collections.Counter', 'Counter', ([], {}), '()\n', (2792, 2794), False, 'from collections import Counter\n'), ((2810, 2819), 'collections.Counter', 'Counter', ([], {}), '()\n', ... |
import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow.keras.layers import Layer, Activation, BatchNormalization, Add, Conv2D
from tensorflow.keras.regularizers import l2
from src.config import ConfigModel
# https://github.com/tensorflow/tensorflow/issues/32477#issuecomment-556032114
BatchNormal... | [
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.subtract",
"tensorflow.keras.layers.Activation",
"tensorflow.keras.backend.epsilon",
"tensorflow.keras.layers.Add",
"tensorflow.keras.regularizers.l2"
] | [((3635, 3662), 'tensorflow.keras.layers.Activation', 'Activation', (['self.activation'], {}), '(self.activation)\n', (3645, 3662), False, 'from tensorflow.keras.layers import Layer, Activation, BatchNormalization, Add, Conv2D\n'), ((547, 574), 'tensorflow.subtract', 'tf.subtract', (['y_pred', 'y_true'], {}), '(y_pred,... |
# 数据处理部分之前的代码,加入部分数据处理的库
import gzip
import json
import os
import random
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
import paddle.fluid as fluid
import pandas as pd
from PIL import Image
from paddle.fluid.dygraph.nn import Conv2D, Pool2D, Linear
def load_data(mode='train'):
... | [
"matplotlib.pyplot.title",
"os.remove",
"pandas.read_csv",
"random.shuffle",
"matplotlib.pyplot.figure",
"paddle.fluid.io.DataLoader.from_generator",
"paddle.fluid.dygraph.nn.Linear",
"paddle.fluid.layers.mean",
"pandas.DataFrame",
"matplotlib.pyplot.imshow",
"os.path.exists",
"paddle.fluid.dy... | [((4923, 4935), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (4933, 4935), True, 'import matplotlib.pyplot as plt\n'), ((4937, 4972), 'matplotlib.pyplot.title', 'plt.title', (['"""trainning"""'], {'fontsize': '(24)'}), "('trainning', fontsize=24)\n", (4946, 4972), True, 'import matplotlib.pyplot as plt\n... |
# =============================================================================== #
# #
# This file has been generated automatically!! Do not change this manually! #
# ... | [
"pydantic.Field"
] | [((777, 808), 'pydantic.Field', 'Field', (['"""getUser"""'], {'alias': '"""@type"""'}), "('getUser', alias='@type')\n", (782, 808), False, 'from pydantic import Field\n')] |
import ast, astor, codegen, dis
# def f(x):
# return 1+2+3+4+x
# def g(x):
# return x+1+2+3+4
def part_a(source):
'''
Breaking compilation into pieces - Part A
'''
print('\n\n# ---------------------------- PART A ----------------------------')
# -- STEP 1: parse code into AST
node =... | [
"ast.dump",
"ast.parse",
"dis.dis"
] | [((321, 351), 'ast.parse', 'ast.parse', (['source'], {'mode': '"""eval"""'}), "(source, mode='eval')\n", (330, 351), False, 'import ast, astor, codegen, dis\n'), ((1180, 1210), 'ast.parse', 'ast.parse', (['source'], {'mode': '"""eval"""'}), "(source, mode='eval')\n", (1189, 1210), False, 'import ast, astor, codegen, di... |
import abc
import logging.config
import os
import numpy as np
from rec_to_nwb.processing.time.continuous_time_extractor import \
ContinuousTimeExtractor
from rec_to_nwb.processing.time.timestamp_converter import TimestampConverter
path = os.path.dirname(os.path.abspath(__file__))
logging.config.fileConfig(
f... | [
"rec_to_nwb.processing.time.continuous_time_extractor.ContinuousTimeExtractor",
"numpy.shape",
"os.path.abspath",
"rec_to_nwb.processing.time.timestamp_converter.TimestampConverter"
] | [((260, 285), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (275, 285), False, 'import os\n'), ((747, 772), 'rec_to_nwb.processing.time.continuous_time_extractor.ContinuousTimeExtractor', 'ContinuousTimeExtractor', ([], {}), '()\n', (770, 772), False, 'from rec_to_nwb.processing.time.continu... |
#! /usr/bin/env python3
import re
a = "yes" if(re.match(r'.*world.*', 'hello world!')) else "no"
print('a = {}'.format(a))
| [
"re.match"
] | [((49, 86), 're.match', 're.match', (['""".*world.*"""', '"""hello world!"""'], {}), "('.*world.*', 'hello world!')\n", (57, 86), False, 'import re\n')] |
from numpy.random import seed
import tensorflow
def set_seed():
seed(1)
tensorflow.random.set_seed(2) | [
"tensorflow.random.set_seed",
"numpy.random.seed"
] | [((69, 76), 'numpy.random.seed', 'seed', (['(1)'], {}), '(1)\n', (73, 76), False, 'from numpy.random import seed\n'), ((81, 110), 'tensorflow.random.set_seed', 'tensorflow.random.set_seed', (['(2)'], {}), '(2)\n', (107, 110), False, 'import tensorflow\n')] |
'''Screens package containing all the app screens.'''
from resource_registers import register_kv_and_data
register_kv_and_data()
| [
"resource_registers.register_kv_and_data"
] | [((108, 130), 'resource_registers.register_kv_and_data', 'register_kv_and_data', ([], {}), '()\n', (128, 130), False, 'from resource_registers import register_kv_and_data\n')] |
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
path('',views.home),
path('location/<str:location>/',views.location, name='location'),
path('search/',views.search, name='search_image'),
path('copy/<str:id>/', v... | [
"django.conf.urls.static.static",
"django.urls.path"
] | [((146, 166), 'django.urls.path', 'path', (['""""""', 'views.home'], {}), "('', views.home)\n", (150, 166), False, 'from django.urls import path\n'), ((171, 236), 'django.urls.path', 'path', (['"""location/<str:location>/"""', 'views.location'], {'name': '"""location"""'}), "('location/<str:location>/', views.location,... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.platform.test.main",
"tensorflow.python.data.util.sparse.unwrap_sparse_types",
"tensorflow.python.data.util.sparse.serialize_sparse_tensors",
"tensorflow.python.data.util.nest.flatten",
"tensorflow.python.data.util.nest.assert_same_structure",
"tensorflow.python.framework.constant_op.co... | [((4953, 4964), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (4962, 4964), False, 'from tensorflow.python.platform import test\n'), ((3278, 3354), 'tensorflow.python.framework.sparse_tensor.SparseTensor', 'sparse_tensor.SparseTensor', ([], {'indices': '[[0, 0]]', 'values': '[1]', 'dense_shape'... |
import os
from fabric.api import env
from cloudy.db import *
from cloudy.sys import *
from cloudy.web import *
from cloudy.util import *
from cloudy.srv.recipe_generic_server import srv_setup_generic_server
def srv_setup_db(cfg_files, generic=True):
"""
Setup a database - Ex: (cmd:[cfg-file])
"""
c... | [
"cloudy.srv.recipe_generic_server.srv_setup_generic_server"
] | [((384, 419), 'cloudy.srv.recipe_generic_server.srv_setup_generic_server', 'srv_setup_generic_server', (['cfg_files'], {}), '(cfg_files)\n', (408, 419), False, 'from cloudy.srv.recipe_generic_server import srv_setup_generic_server\n')] |
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'settings_dialog_ui.ui'
##
## Created by: Qt User Interface Compiler version 5.15.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
#######... | [
"PySide2.QtCore.QCoreApplication.translate",
"PySide2.QtCore.QMetaObject.connectSlotsByName"
] | [((10080, 10128), 'PySide2.QtCore.QMetaObject.connectSlotsByName', 'QMetaObject.connectSlotsByName', (['SettingsDialogUi'], {}), '(SettingsDialogUi)\n', (10110, 10128), False, 'from PySide2.QtCore import QCoreApplication, QDate, QDateTime, QMetaObject, QObject, QPoint, QRect, QSize, QTime, QUrl, Qt\n'), ((10231, 10296)... |
import os
import utils
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from experiments_manager import ExperimentsManager
from sklearn.preprocessing import MinMaxScaler
from device_session_classifier import DeviceSessionClassifier
from device_sequence_classifier import Devic... | [
"numpy.full",
"seaborn.set_style",
"os.path.abspath",
"pandas.DataFrame",
"os.makedirs",
"pandas.read_csv",
"os.path.exists",
"os.path.splitext",
"multiple_device_classifier.MultipleDeviceClassifier",
"os.path.join"
] | [((480, 502), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (493, 502), True, 'import seaborn as sns\n'), ((6227, 6252), 'os.path.abspath', 'os.path.abspath', (['"""models"""'], {}), "('models')\n", (6242, 6252), False, 'import os\n'), ((6267, 6302), 'os.path.abspath', 'os.path.abspath', (... |
import os
from pkg_resources import resource_isdir, resource_listdir, resource_string
import yaml
from nose.tools import nottest
from dusty.compiler.spec_assembler import get_specs_from_path
@nottest
def get_all_test_configs():
return resource_listdir(__name__, 'test_configs')
@nottest
def resources_for_test_co... | [
"pkg_resources.resource_listdir",
"pkg_resources.resource_isdir",
"dusty.compiler.spec_assembler.get_specs_from_path"
] | [((242, 284), 'pkg_resources.resource_listdir', 'resource_listdir', (['__name__', '"""test_configs"""'], {}), "(__name__, 'test_configs')\n", (258, 284), False, 'from pkg_resources import resource_isdir, resource_listdir, resource_string\n'), ((899, 929), 'dusty.compiler.spec_assembler.get_specs_from_path', 'get_specs_... |
from __future__ import absolute_import
from celery import shared_task
from .models import Anime
from genres.models import Genre
from categories.models import Categorie
from reviews.models import Review
from episodes.models import Episode
from characters.models import Character
import requests
import json
max_id = 1358... | [
"genres.models.Genre",
"categories.models.Categorie",
"characters.models.Character",
"reviews.models.Review",
"categories.models.Categorie.objects.filter",
"genres.models.Genre.objects.filter",
"episodes.models.Episode.objects.filter",
"characters.models.Character.objects.filter",
"requests.get",
... | [((4053, 4070), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (4065, 4070), False, 'import requests\n'), ((4870, 4887), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (4882, 4887), False, 'import requests\n'), ((5827, 5844), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (5839, 5844), ... |
import os
import re
from nltk.tokenize.util import regexp_span_tokenize
def read_relations(line, events_doc, corefs_doc, afters_doc, parents_doc):
_, lid, event_ids = line.strip().split("\t")
if line.startswith("@After"):
afters_doc[lid] = event_ids.split(",")
elif line.startswith("@Coreference"):... | [
"nltk.tokenize.util.regexp_span_tokenize",
"os.path.join",
"re.sub",
"ipdb.set_trace"
] | [((2477, 2530), 'os.path.join', 'os.path.join', (['"""data"""', '"""LDC2016E130_V5"""', '"""data"""', '"""all"""'], {}), "('data', 'LDC2016E130_V5', 'data', 'all')\n", (2489, 2530), False, 'import os\n'), ((6776, 6808), 'os.path.join', 'os.path.join', (['"""data"""', 'evaluation'], {}), "('data', evaluation)\n", (6788,... |
import pytest
from simple_playgrounds.agent.agents import HeadAgent
from simple_playgrounds.agent.controllers import RandomContinuous
from simple_playgrounds.element.elements.contact import Candy
from simple_playgrounds.common.spawner import Spawner
from simple_playgrounds.engine import Engine
from simple_playgrounds.... | [
"simple_playgrounds.agent.controllers.RandomContinuous",
"simple_playgrounds.engine.Engine",
"simple_playgrounds.playground.layouts.SingleRoom"
] | [((643, 670), 'simple_playgrounds.playground.layouts.SingleRoom', 'SingleRoom', ([], {'size': '(200, 200)'}), '(size=(200, 200))\n', (653, 670), False, 'from simple_playgrounds.playground.layouts import SingleRoom\n'), ((1059, 1093), 'simple_playgrounds.engine.Engine', 'Engine', (['playground'], {'time_limit': '(100)'}... |
from flask import Blueprint, flash, url_for, render_template, redirect
from flask_login import login_required, current_user
from app import db
from app.models import Pitch
from app.pitches.forms import PitchForm
pitches = Blueprint('pitches', __name__)
@pitches.route('/pitch/new', methods =['GET', 'POST'])
@login_r... | [
"app.models.Pitch",
"flask.Blueprint",
"flask.flash",
"app.pitches.forms.PitchForm",
"flask.url_for",
"app.db.session.commit",
"flask.render_template",
"app.db.session.add"
] | [((224, 254), 'flask.Blueprint', 'Blueprint', (['"""pitches"""', '__name__'], {}), "('pitches', __name__)\n", (233, 254), False, 'from flask import Blueprint, flash, url_for, render_template, redirect\n'), ((356, 367), 'app.pitches.forms.PitchForm', 'PitchForm', ([], {}), '()\n', (365, 367), False, 'from app.pitches.fo... |
from . import Cosmology, MassFunction, HaloPhysics
import numpy as np
from scipy.special import spherical_jn
from scipy.integrate import simps
class MassIntegrals:
"""
Class to compute and store the various mass integrals of the form
.. math::
I_p^{q_1,q_2}(k_1,...k_p) = \\int n(m)b^{(q_1)}(m)b^{... | [
"numpy.power",
"numpy.linspace"
] | [((3743, 3802), 'numpy.linspace', 'np.linspace', (['self.min_logM_h', 'self.max_logM_h', 'self.npoints'], {}), '(self.min_logM_h, self.max_logM_h, self.npoints)\n', (3754, 3802), True, 'import numpy as np\n'), ((14928, 15006), 'numpy.power', 'np.power', (['(3.0 * self.m_h_grid / (4.0 * np.pi * self.cosmology.rhoM))', '... |
import logging
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Update dynamic spider content e.g. permissions, content'
def handle(self, *args, **options):
from spkcspider.apps.spider.signals import update_dynamic
self.log = logging.getLogger(__name__)... | [
"logging.StreamHandler",
"logging.getLogger",
"spkcspider.apps.spider.signals.update_dynamic.send_robust"
] | [((293, 320), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (310, 320), False, 'import logging\n'), ((489, 521), 'spkcspider.apps.spider.signals.update_dynamic.send_robust', 'update_dynamic.send_robust', (['self'], {}), '(self)\n', (515, 521), False, 'from spkcspider.apps.spider.signals ... |
""" Core definition of a Q-Chem Task Document """
from typing import Any, Dict, List, Union, Optional, Callable
from pydantic import BaseModel, Field
from pymatgen.core.structure import Molecule
from emmet.core.math import Matrix3D, Vector3D
from emmet.core.structure import MoleculeMetadata
from emmet.core.vasp.task_... | [
"pydantic.Field",
"emmet.core.qchem.calc_types.level_of_theory",
"emmet.core.qchem.calc_types.calc_type",
"emmet.core.qchem.calc_types.task_type"
] | [((831, 879), 'pydantic.Field', 'Field', (['None'], {'description': '"""Input Molecule object"""'}), "(None, description='Input Molecule object')\n", (836, 879), False, 'from pydantic import BaseModel, Field\n'), ((915, 967), 'pydantic.Field', 'Field', (['None'], {'description': '"""Optimized Molecule object"""'}), "(N... |