code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python3
# Note: il faut au moins python 3.5 (pour subprocess.run())
import argparse
import subprocess
from string import Template
from argparse import RawDescriptionHelpFormatter
xstr = """<?xml version="1.0"?>
<case codename="ArcaneTest" xml:lang="en" codeversion="1.0">
<arcane>
<title>Tube a ch... | [
"subprocess.run",
"argparse.ArgumentParser",
"string.Template"
] | [((3830, 3954), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""MicroHydro bench"""', 'formatter_class': 'RawDescriptionHelpFormatter', 'epilog': 'epilog_doc'}), "(description='MicroHydro bench', formatter_class=\n RawDescriptionHelpFormatter, epilog=epilog_doc)\n", (3853, 3954), False... |
# MIPLearn: Extensible Framework for Learning-Enhanced Mixed-Integer Optimization
# Copyright (C) 2020-2021, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
import os.path
from scipy.stats import randint
from miplearn.benchmark import Benchma... | [
"miplearn.benchmark.BenchmarkRunner",
"scipy.stats.randint",
"miplearn.solvers.learning.LearningSolver"
] | [((783, 799), 'miplearn.solvers.learning.LearningSolver', 'LearningSolver', ([], {}), '()\n', (797, 799), False, 'from miplearn.solvers.learning import LearningSolver\n'), ((1051, 1080), 'miplearn.benchmark.BenchmarkRunner', 'BenchmarkRunner', (['test_solvers'], {}), '(test_solvers)\n', (1066, 1080), False, 'from miple... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2018, <NAME> <<EMAIL>>
# (c) 2019, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_vers... | [
"ansible.module_utils.vultr.vultr_argument_spec",
"ansible.module_utils.basic.AnsibleModule"
] | [((3113, 3134), 'ansible.module_utils.vultr.vultr_argument_spec', 'vultr_argument_spec', ([], {}), '()\n', (3132, 3134), False, 'from ansible.module_utils.vultr import Vultr, vultr_argument_spec\n'), ((3149, 3217), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', ([], {'argument_spec': 'argument_spec', 'sup... |
import os
import torch
from tqdm import tqdm
from .base import BaseAgent
from util.mylogger import get_writer
class Trainer(BaseAgent):
def __init__(self, config, args):
super().__init__(config, args)
if args.load != '':
self.ckpt_dir_flag, self.train_set, self.dev_set, self.train_loade... | [
"tqdm.tqdm",
"util.mylogger.get_writer",
"torch.no_grad",
"os.path.join"
] | [((1193, 1237), 'util.mylogger.get_writer', 'get_writer', (['config', 'args', 'self.ckpt_dir_flag'], {}), '(config, args, self.ckpt_dir_flag)\n', (1203, 1237), False, 'from util.mylogger import get_writer\n'), ((1659, 1682), 'tqdm.tqdm', 'tqdm', (['self.train_loader'], {}), '(self.train_loader)\n', (1663, 1682), False,... |
#! /opt/cloud_sdk/bin/python
import re
from typing import Dict, Optional
import yaml
import citc.utils
def load_yaml(filename) -> dict:
with open(filename, "r") as f:
return yaml.safe_load(f)
def get_limits() -> Dict[str, Dict[str, str]]:
"""
Until OCI has an API to fetch service limits, we ha... | [
"yaml.safe_load",
"re.compile"
] | [((3318, 3386), 're.compile', 're.compile', (['"""(?<=# STARTNODES\n)(.*?)(?=\n?# ENDNODES)"""', 're.DOTALL'], {}), '("""(?<=# STARTNODES\n)(.*?)(?=\n?# ENDNODES)""", re.DOTALL)\n', (3328, 3386), False, 'import re\n'), ((190, 207), 'yaml.safe_load', 'yaml.safe_load', (['f'], {}), '(f)\n', (204, 207), False, 'import yam... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-17 21:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... | [
"django.db.models.TextField",
"django.db.models.OneToOneField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.PositiveIntegerField",
"django.db.models.AutoField",
"django.db.models.ImageField",
"django.db.models.EmailField"
] | [((2948, 3033), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""store.Movie"""'}), "(on_delete=django.db.models.deletion.CASCADE, to='store.Movie'\n )\n", (2965, 3033), False, 'from django.db import migrations, models\n'), ((398, 491), 'django.db.... |
#!/usr/bin/python3
# pylint: disable=too-few-public-methods
# pylint: disable=too-many-arguments
# pylint: disable=too-many-instance-attributes
# pylint: disable=simplifiable-if-statement
"""Basic asynchonous client library for FlureeDB"""
import sys
import asyncio
import json
import time
import aiohttp
from aioflureed... | [
"json.loads",
"asyncio.sleep",
"json.dumps",
"time.time",
"aiohttp.ClientSession",
"aioflureedb.signing.DbSigner"
] | [((12320, 12364), 'json.dumps', 'json.dumps', (['kwdict'], {'indent': '(4)', 'sort_keys': '(True)'}), '(kwdict, indent=4, sort_keys=True)\n', (12330, 12364), False, 'import json\n'), ((18508, 18531), 'aiohttp.ClientSession', 'aiohttp.ClientSession', ([], {}), '()\n', (18529, 18531), False, 'import aiohttp\n'), ((26528,... |
import json
import os
import sys
from collections import Counter
from pathlib import Path
TRAIN_DIR = Path('data/train')
def count_popular_languages():
language_counts = Counter()
for line in sys.stdin:
data = json.loads(line)
for _, path_after in data['paths']:
extension = path_... | [
"os.makedirs",
"json.loads",
"os.path.exists",
"pathlib.Path",
"collections.Counter"
] | [((103, 121), 'pathlib.Path', 'Path', (['"""data/train"""'], {}), "('data/train')\n", (107, 121), False, 'from pathlib import Path\n'), ((177, 186), 'collections.Counter', 'Counter', ([], {}), '()\n', (184, 186), False, 'from collections import Counter\n'), ((230, 246), 'json.loads', 'json.loads', (['line'], {}), '(lin... |
from typing import Mapping
from structlog import get_logger
from app.questionnaire.questionnaire_schema import DEFAULT_LANGUAGE_CODE
from app.submitter.convert_payload_0_0_1 import convert_answers_to_payload_0_0_1
from app.submitter.convert_payload_0_0_3 import convert_answers_to_payload_0_0_3
logger = get_logger()
... | [
"app.submitter.convert_payload_0_0_1.convert_answers_to_payload_0_0_1",
"app.submitter.convert_payload_0_0_3.convert_answers_to_payload_0_0_3",
"structlog.get_logger"
] | [((307, 319), 'structlog.get_logger', 'get_logger', ([], {}), '()\n', (317, 319), False, 'from structlog import get_logger\n'), ((2881, 2966), 'app.submitter.convert_payload_0_0_3.convert_answers_to_payload_0_0_3', 'convert_answers_to_payload_0_0_3', (['answer_store', 'list_store', 'schema', 'routing_path'], {}), '(ans... |
import os
from typing import List
from trescope import Trescope
from trescope.config import ImageConfig
from trescope.controller import EnumControl
from trescope.toolbox import simpleDisplayOutputs
import pandas as pd
def clearTrescope():
for i in range(4): Trescope().selectOutput(i).clear()
def add_control():... | [
"pandas.DataFrame",
"trescope.Trescope",
"trescope.config.ImageConfig",
"trescope.toolbox.simpleDisplayOutputs",
"os.path.join",
"os.listdir",
"trescope.controller.EnumControl"
] | [((389, 405), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (399, 405), False, 'import os\n'), ((477, 533), 'pandas.DataFrame', 'pd.DataFrame', (["{'file': [], 'shape': [], 'thickness': []}"], {}), "({'file': [], 'shape': [], 'thickness': []})\n", (489, 533), True, 'import pandas as pd\n'), ((439, 465), 'tres... |
import pytest
import numpy as np
from numpy.testing import assert_allclose
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Flatten
from keras.layers.embeddings import Embedding
from keras.constraints import unitnorm
from keras import backend as K
X1 = np.array([[1], [2]], dtype='i... | [
"keras.layers.core.Dense",
"numpy.ones_like",
"keras.layers.core.Activation",
"pytest.main",
"keras.backend.get_value",
"keras.constraints.unitnorm",
"numpy.array",
"keras.layers.core.Flatten",
"keras.models.Sequential"
] | [((291, 326), 'numpy.array', 'np.array', (['[[1], [2]]'], {'dtype': '"""int32"""'}), "([[1], [2]], dtype='int32')\n", (299, 326), True, 'import numpy as np\n'), ((332, 395), 'numpy.array', 'np.array', (['[[0.1, 0.2], [0.3, 0.4], [0.5, 0.6]]'], {'dtype': '"""float32"""'}), "([[0.1, 0.2], [0.3, 0.4], [0.5, 0.6]], dtype='... |
import time
import pytest
from libs.sensorMod.src.sensor_SenseHat import Sensor
# =========================================================
# G L O B A L S & P Y T E S T F I X T U R E S
# =========================================================
@pytest.fixture()
def valid_attribs():
return {
'... | [
"pytest.fixture",
"libs.sensorMod.src.sensor_SenseHat.Sensor"
] | [((260, 276), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (274, 276), False, 'import pytest\n'), ((806, 821), 'libs.sensorMod.src.sensor_SenseHat.Sensor', 'Sensor', (['attribs'], {}), '(attribs)\n', (812, 821), False, 'from libs.sensorMod.src.sensor_SenseHat import Sensor\n')] |
"""
https://leetcode.com/problems/jewels-and-stones/
https://leetcode.com/submissions/detail/138688434/
"""
class Solution:
def numJewelsInStones(self, J, S):
"""
:type J: str
:type S: str
:rtype: int
"""
result = 0
for stone in J:
result += S.c... | [
"unittest.main"
] | [((628, 643), 'unittest.main', 'unittest.main', ([], {}), '()\n', (641, 643), False, 'import unittest\n')] |
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | [
"numpy.abs",
"os.path.basename",
"numpy.std",
"numpy.frombuffer",
"numpy.allclose",
"numpy.max",
"numpy.mean",
"numpy.min",
"numpy.prod"
] | [((809, 835), 'os.path.basename', 'os.path.basename', (['__file__'], {}), '(__file__)\n', (825, 835), False, 'import os\n'), ((2036, 2057), 'numpy.prod', 'numpy.prod', (['arr_shape'], {}), '(arr_shape)\n', (2046, 2057), False, 'import numpy\n'), ((3524, 3553), 'numpy.abs', 'numpy.abs', (['(output - gt_output)'], {}), '... |
import sys
import pygame as pg
from ui.input import control
def check_keyboard_events(window, state):
def close():
pg.quit()
sys.exit()
events = pg.event.get()
for event in events:
if event.type == pg.QUIT:
close()
elif event.type == pg.KEYDOWN and event.ke... | [
"pygame.quit",
"ui.input.control.switch_audio",
"pygame.event.get",
"ui.input.control.open_setting",
"ui.input.control.play_favourite",
"ui.input.control.scroll_menu_down",
"ui.input.control.central_button",
"ui.input.control.back",
"sys.exit",
"ui.input.control.switch_led",
"ui.input.control.sc... | [((174, 188), 'pygame.event.get', 'pg.event.get', ([], {}), '()\n', (186, 188), True, 'import pygame as pg\n'), ((131, 140), 'pygame.quit', 'pg.quit', ([], {}), '()\n', (138, 140), True, 'import pygame as pg\n'), ((149, 159), 'sys.exit', 'sys.exit', ([], {}), '()\n', (157, 159), False, 'import sys\n'), ((439, 476), 'ui... |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2019-11-11 18:44
import tensorflow as tf
from elit.optimizers.adamw.optimization import WarmUp, AdamWeightDecay
# from elit.optimization.adamw.optimizers_v2 import AdamW
# from elit.optimization.adamw.utils import get_weight_decays
# def create_optimizer(model, init_l... | [
"elit.optimizers.adamw.optimization.AdamWeightDecay",
"elit.optimizers.adamw.optimization.WarmUp",
"tensorflow.keras.optimizers.schedules.PolynomialDecay"
] | [((1670, 1802), 'tensorflow.keras.optimizers.schedules.PolynomialDecay', 'tf.keras.optimizers.schedules.PolynomialDecay', ([], {'initial_learning_rate': 'init_lr', 'decay_steps': 'num_train_steps', 'end_learning_rate': '(0.0)'}), '(initial_learning_rate=init_lr,\n decay_steps=num_train_steps, end_learning_rate=0.0)\... |
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import (
Column,
HTML,
Field,
Fieldset,
Layout,
Row,
Submit,
BaseInput,
)
from crispy_forms.bootstrap import InlineField, UneditableField
from crispy_forms import layout
PRODUCT_QUANTITY_CHOICES... | [
"crispy_forms.layout.BaseInput",
"crispy_forms.helper.FormHelper",
"django.forms.TextInput",
"django.forms.HiddenInput",
"crispy_forms.layout.Submit"
] | [((837, 849), 'crispy_forms.helper.FormHelper', 'FormHelper', ([], {}), '()\n', (847, 849), False, 'from crispy_forms.helper import FormHelper\n'), ((541, 620), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'class': 'qty', 'style': 'width:60px; padding: 8.7px;'}"}), "(attrs={'class': 'qty', 'style': 'wi... |
"""This module contains boilerplate csv helpers."""
import csv
def read_csv(filename):
"""Read a CSV file.
**Example**:
>>> read_csv('/path/to/data.csv')
[{ 'name': 'foo' }]
:param filename:
Path to CSV file.
:return:
A Python representation of the CSV document.
"""
... | [
"csv.DictReader"
] | [((475, 517), 'csv.DictReader', 'csv.DictReader', (['fh'], {'fieldnames': 'field_names'}), '(fh, fieldnames=field_names)\n', (489, 517), False, 'import csv\n'), ((1025, 1067), 'csv.DictReader', 'csv.DictReader', (['fh'], {'fieldnames': 'field_names'}), '(fh, fieldnames=field_names)\n', (1039, 1067), False, 'import csv\... |
from datetime import date
import numpy as np
from matplotlib.lines import Line2D
from _ids import *
import _icons as ico
from utilities import pydate2wxdate, wxdate2pydate, GetAttributes
from properties import SummaryProperty
class VariableManager:
def __init__(self, unit_system):
# simulat... | [
"utilities.wxdate2pydate",
"utilities.pydate2wxdate",
"numpy.array",
"properties.SummaryProperty",
"utilities.GetAttributes"
] | [((6204, 6294), 'utilities.GetAttributes', 'GetAttributes', (['self'], {'exclude': "('_correlation_labels', '_correlation_matrix')", 'sort': '(True)'}), "(self, exclude=('_correlation_labels', '_correlation_matrix'),\n sort=True)\n", (6217, 6294), False, 'from utilities import pydate2wxdate, wxdate2pydate, GetAttrib... |
#!/usr/bin/env python3
#
# This file is part of Linux-on-LiteX-VexRiscv
#
# Copyright (c) 2019-2021, Linux-on-LiteX-VexRiscv Developers
# SPDX-License-Identifier: BSD-2-Clause
import os
import sys
import pexpect
import time
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("--sdram-m... | [
"pexpect.spawn",
"argparse.ArgumentParser",
"os.getcwd",
"time.time",
"os.chdir",
"sys.exit"
] | [((273, 289), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (287, 289), False, 'from argparse import ArgumentParser\n'), ((2297, 2308), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (2305, 2308), False, 'import sys\n'), ((965, 978), 'os.chdir', 'os.chdir', (['cwd'], {}), '(cwd)\n', (973, 978), False,... |
import pygame_sdl2
pygame_sdl2.import_as_pygame()
import random
import pygame
from pygame.locals import *
import android
class AppleTypes:
NORMAL, GOLDEN, LIFE, SPECIAL = range(4)
class Apple:
def __init__(self, snakes):
retry = True
while retry:
retry = False
self.x... | [
"pygame.event.wait",
"pygame.event.get",
"pygame.display.Info",
"pygame.mixer.music.pause",
"random.randint",
"pygame.display.set_mode",
"pygame.mixer.music.play",
"pygame.draw.polygon",
"pygame.display.set_caption",
"android.vibrate",
"pygame.mixer.Sound",
"pygame.quit",
"pygame.Surface",
... | [((19, 49), 'pygame_sdl2.import_as_pygame', 'pygame_sdl2.import_as_pygame', ([], {}), '()\n', (47, 49), False, 'import pygame_sdl2\n'), ((32136, 32149), 'pygame.init', 'pygame.init', ([], {}), '()\n', (32147, 32149), False, 'import pygame\n'), ((32150, 32197), 'pygame.display.set_caption', 'pygame.display.set_caption',... |
# Functions
from extract import extract
from model import model
import os
# Logging
import logging
logging.basicConfig(level=logging.INFO)
# Set directory
dir = '/Users/alexandrasmith/ds/metis/proj3_mcnulty/PROJ_FILES/major_or_minor_song_classification'
# filepath_to_music --> Edit as needed
filepath = 'sample_musi... | [
"os.mkdir",
"extract.extract",
"logging.basicConfig",
"os.path.exists",
"logging.info",
"os.path.join"
] | [((101, 140), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (120, 140), False, 'import logging\n'), ((1180, 1218), 'logging.info', 'logging.info', (['"""Extracting features..."""'], {}), "('Extracting features...')\n", (1192, 1218), False, 'import logging\n'), ... |
"""
Description: Dataset from VoxCeleb1
Author: <NAME>
Date: 2020.11.26
VoxCeleb1:
- From iden_split.txt to the training and validation set.
- From iden_split.txt to evaulate the identification task.
- From veri_test2.txt, list_test_all2.txt, and list_test_hard2.txt to
evaluate the corresponding verification tas... | [
"sugar.database.VerificationTrials",
"sugar.database.Utterance",
"os.path.join",
"os.path.exists"
] | [((3033, 3065), 'sugar.database.Utterance', 'Utterance', (['trainlst', 'num_samples'], {}), '(trainlst, num_samples)\n', (3042, 3065), False, 'from sugar.database import Utterance\n'), ((3076, 3106), 'sugar.database.Utterance', 'Utterance', (['vallst', 'num_samples'], {}), '(vallst, num_samples)\n', (3085, 3106), False... |
"""Holds functions that ask a user for input"""
import warnings
from typing import List
import typer
from functions import logs
from functions import styles
from functions.config.models import FunctionConfig
from functions.constants import ConfigName
def ask(question: str, default: str = None, options: List[str] = ... | [
"typer.echo",
"functions.logs.remove_empty_lines_from_string",
"typer.prompt",
"typer.confirm",
"warnings.warn",
"functions.styles.yellow"
] | [((493, 532), 'typer.prompt', 'typer.prompt', (['question'], {'default': 'default'}), '(question, default=default)\n', (505, 532), False, 'import typer\n'), ((690, 730), 'typer.confirm', 'typer.confirm', (['question'], {'default': 'default'}), '(question, default=default)\n', (703, 730), False, 'import typer\n'), ((876... |
# coding=utf-8
from __future__ import unicode_literals
import datetime
import ssl
from tempfile import TemporaryFile
import gcloud.exceptions
import pytest
from django.core.exceptions import SuspiciousFileOperation
from django.utils import six
from django.utils.crypto import get_random_string
from django_gcloud_stor... | [
"django_gcloud_storage.prepare_name",
"django_gcloud_storage.remove_prefix",
"django_gcloud_storage.safe_join",
"tempfile.TemporaryFile",
"pytest.raises",
"django_gcloud_storage.GCloudFile",
"django.utils.crypto.get_random_string",
"ssl._create_unverified_context",
"urllib2.urlopen"
] | [((719, 743), 'urllib2.urlopen', 'urlopen', (['*args'], {}), '(*args, **kwargs)\n', (726, 743), False, 'from urllib2 import urlopen\n'), ((625, 657), 'ssl._create_unverified_context', 'ssl._create_unverified_context', ([], {}), '()\n', (655, 657), False, 'import ssl\n'), ((2996, 3027), 'django_gcloud_storage.remove_pre... |
from datetime import date, datetime
from typing import List, Union
from pyinaturalist.constants import TableRow
from pyinaturalist.converters import safe_split, try_int_or_float
from pyinaturalist.models import (
BaseModel,
LazyProperty,
Taxon,
User,
datetime_now_field,
define_model,
field,... | [
"pyinaturalist.models.LazyProperty",
"pyinaturalist.models.field",
"pyinaturalist.models.datetime_now_field"
] | [((883, 924), 'pyinaturalist.models.field', 'field', ([], {'converter': 'safe_split', 'factory': 'list'}), '(converter=safe_split, factory=list)\n', (888, 924), False, 'from pyinaturalist.models import BaseModel, LazyProperty, Taxon, User, datetime_now_field, define_model, field\n'), ((952, 1025), 'pyinaturalist.models... |
import redis
class ClueLogger:
def __init__(self, block, model):
self.block = block
self.r = redis.StrictRedis('redis')
def out(self, model, value):
self.r.xadd(self.block, {'model': model, 'value': value})
| [
"redis.StrictRedis"
] | [((115, 141), 'redis.StrictRedis', 'redis.StrictRedis', (['"""redis"""'], {}), "('redis')\n", (132, 141), False, 'import redis\n')] |
# Homework for UB DMS 423 - Fall 14
# by <NAME>
#
# Real-time Satellite Visualization
# Input Data type: TLS(Two-line element set)
# Can be found at http://www.celestrak.com/NORAD/elements/
#
# How to control:
# Click a satellite to display its orbit.
# Press H to show/hide all orbits on-screen.
# Press UP/DOWN to cha... | [
"ephem.readtle",
"datetime.timedelta",
"datetime.datetime.utcnow"
] | [((1373, 1400), 'ephem.readtle', 'ephem.readtle', (['"""GS"""', 'l1', 'l2'], {}), "('GS', l1, l2)\n", (1386, 1400), False, 'import ephem, datetime, math, urllib.request, urllib.parse, urllib.error\n'), ((1671, 1697), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (1695, 1697), False, 'import ... |
from collections import OrderedDict
from django.utils.translation import gettext_lazy as _
from model_utils import Choices
from rest_framework import serializers
from rest_framework.fields import empty, Field, SkipField
from rest_framework.utils import model_meta
from rest_framework_recursive.fields import RecursiveF... | [
"unicef_restlib.utils.get_attribute_smart",
"rest_framework.utils.model_meta.get_field_info",
"rest_framework.fields.SkipField",
"django.utils.translation.gettext_lazy"
] | [((530, 589), 'django.utils.translation.gettext_lazy', '_', (['"""Invalid option "{pk_value}" - option is not available."""'], {}), '(\'Invalid option "{pk_value}" - option is not available.\')\n', (531, 589), True, 'from django.utils.translation import gettext_lazy as _\n'), ((2829, 2861), 'rest_framework.utils.model_... |
# -*- coding: utf-8 -*-
from django.conf.urls import url, include
from django.views.generic import TemplateView
cyborg_patterns = [
url(
r'^robots\.txt$',
TemplateView.as_view(
template_name='cyborg/robots.txt',
content_type='text/plain'
),
name='robots'
... | [
"django.views.generic.TemplateView.as_view",
"django.conf.urls.include"
] | [((176, 263), 'django.views.generic.TemplateView.as_view', 'TemplateView.as_view', ([], {'template_name': '"""cyborg/robots.txt"""', 'content_type': '"""text/plain"""'}), "(template_name='cyborg/robots.txt', content_type=\n 'text/plain')\n", (196, 263), False, 'from django.views.generic import TemplateView\n'), ((36... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Code by: @53686b (Github/Twitter)
# Version: 1.0.1 (23/03/2021)
"""
ThePythonSpreader is a script that creates files capable of multiplying themselves.
The first file copies itself to a new file, which results of the addition of a random number
to the original file name... | [
"getpass.getuser"
] | [((1507, 1516), 'getpass.getuser', 'getuser', ([], {}), '()\n', (1514, 1516), False, 'from getpass import getuser\n')] |
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn.metrics import r2_score
from shared_utilities import find_linearReg_optimal_test_size
from shared_utilities import plot_linear_reg
from shared_utilities import check... | [
"shared_utilities.plot_scatter",
"sklearn.preprocessing.StandardScaler",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.r2_score",
"sklearn.linear_model.LinearRegression",
"sklearn.decomposition.PCA",
"shared_utilities.find_linearReg_optimal_test_size"
] | [((495, 525), 'pandas.read_csv', 'pd.read_csv', (['"""Real estate.csv"""'], {}), "('Real estate.csv')\n", (506, 525), True, 'import pandas as pd\n'), ((580, 624), 'shared_utilities.plot_scatter', 'plot_scatter', (['X.iloc[:, 2]', 'y', '"""scatter.png"""'], {}), "(X.iloc[:, 2], y, 'scatter.png')\n", (592, 624), False, '... |
import pandas as pd
import torch
import torch.nn as nn
from transformers.modeling_outputs import SequenceClassifierOutputWithPast
from ..src.model.hart import HaRTPreTrainedModel
class ArHulmForSequenceClassification(HaRTPreTrainedModel):
# _keys_to_ignore_on_load_missing = [r"h\.\d+\.attn\.masked_bias", r"lm_he... | [
"torch.stack",
"torch.nn.Linear",
"torch.Tensor",
"transformers.modeling_outputs.SequenceClassifierOutputWithPast",
"torch.sum"
] | [((559, 612), 'torch.nn.Linear', 'nn.Linear', (['config.n_embd', 'self.num_labels'], {'bias': '(False)'}), '(config.n_embd, self.num_labels, bias=False)\n', (568, 612), True, 'import torch.nn as nn\n'), ((5028, 5241), 'transformers.modeling_outputs.SequenceClassifierOutputWithPast', 'SequenceClassifierOutputWithPast', ... |
import logging
from terra import util_terra
from terra.execute_type import (
_execute_type,
)
from .zap import (
handle_zap_into_strategy,
handle_zap_out_of_strategy,
)
def handle(exporter, elem, txinfo, index):
execute_msg = util_terra._execute_msg(elem, index)
if "send" in execute_msg:
m... | [
"logging.info",
"terra.util_terra._execute_msg",
"terra.execute_type._execute_type"
] | [((243, 279), 'terra.util_terra._execute_msg', 'util_terra._execute_msg', (['elem', 'index'], {}), '(elem, index)\n', (266, 279), False, 'from terra import util_terra\n'), ((617, 651), 'terra.execute_type._execute_type', '_execute_type', (['elem', 'txinfo', 'index'], {}), '(elem, txinfo, index)\n', (630, 651), False, '... |
"""
Developed by: <NAME> (2018)
This script rename all files in the specified directory to lowercase and then replace all white space with hyphen (-).
"""
import os
import sys
import glob
import argparse
# Print welcome message
print("\nDeveloped by: <NAME> (2018)\n"
"This script rename all files in the specifi... | [
"argparse.ArgumentParser",
"os.path.basename",
"os.path.isdir",
"os.path.splitext",
"os.renames",
"os.path.join"
] | [((453, 478), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (476, 478), False, 'import argparse\n'), ((699, 735), 'os.path.join', 'os.path.join', (['working_directory', '"""*"""'], {}), "(working_directory, '*')\n", (711, 735), False, 'import os\n'), ((832, 848), 'os.path.isdir', 'os.path.isdi... |
from typing import Dict, Tuple, Callable, Any
from pe._constants import Operator
from pe._errors import Error
from pe._escape import escape
DOT = Operator.DOT
LIT = Operator.LIT
CLS = Operator.CLS
RGX = Operator.RGX
SYM = Operator.SYM
OPT = Operator.OPT
STR = Operator.STR
PLS = Operator.PLS
AND = Operator.AND
NOT =... | [
"pe._escape.escape",
"pe._errors.Error"
] | [((1374, 1397), 'pe._escape.escape', 'escape', (['s'], {'ignore': '""""\'"""'}), '(s, ignore=\'"\\\'\')\n', (1380, 1397), False, 'from pe._escape import escape\n'), ((1237, 1271), 'pe._escape.escape', 'escape', (['defn.args[0]'], {'ignore': '"""\'[]"""'}), '(defn.args[0], ignore="\'[]")\n', (1243, 1271), False, 'from p... |
import numpy as np
import cmath
from functools import reduce
from math import pi, ceil
from numpy import sin, cos
from scipy.interpolate import interp1d
"""
References:
[Majkrzak2003] <NAME>, <NAME>: Physica B 336 (2003) 27-38
Phase sensitive reflectometry and the unambiguous determination
o... | [
"cmath.sqrt",
"math.ceil",
"refl1d.profile.Microslabs",
"refl1d.profile.build_profile",
"refl1d.probe.NeutronProbe",
"numpy.cumsum",
"numpy.diff",
"numpy.array",
"numpy.sin",
"numpy.cos",
"functools.reduce",
"scipy.interpolate.interp1d",
"pylab.plot",
"numpy.linalg.multi_dot"
] | [((399, 448), 'scipy.interpolate.interp1d', 'interp1d', (['x', 'fx'], {'bounds_error': '(False)', 'fill_value': '(0)'}), '(x, fx, bounds_error=False, fill_value=0)\n', (407, 448), False, 'from scipy.interpolate import interp1d\n'), ((918, 956), 'cmath.sqrt', 'cmath.sqrt', (['(1 - 16 * pi * sld / q ** 2)'], {}), '(1 - 1... |
import os
import mitsuba
import numpy as np
import argparse
import utils
mitsuba.set_variant('scalar_spectral')
from mitsuba.core import xml, Thread, ScalarTransform4f, Transform4f, Bitmap, Struct
from mitsuba.python.xml import WriteXML
from enoki.scalar import *
import open3d as o3d
from plyfile import PlyData, PlyE... | [
"plyfile.PlyElement.describe",
"mitsuba.core.xml.load_dict",
"mitsuba.core.Transform4f.translate",
"argparse.ArgumentParser",
"utils.file_exist",
"numpy.asarray",
"mitsuba.set_variant",
"mitsuba.core.ScalarTransform4f.look_at",
"os.path.dirname",
"os.path.realpath",
"utils.print_e",
"numpy.arr... | [((74, 112), 'mitsuba.set_variant', 'mitsuba.set_variant', (['"""scalar_spectral"""'], {}), "('scalar_spectral')\n", (93, 112), False, 'import mitsuba\n'), ((426, 448), 'plyfile.PlyData.read', 'PlyData.read', (['filename'], {}), '(filename)\n', (438, 448), False, 'from plyfile import PlyData, PlyElement\n'), ((458, 492... |
import os
import json
from typing import Union
class DataBasic:
path = ""
def first_startup(self):
if not os.path.exists(self.path):
os.mkdir(self.path)
print(f"created {self.path} directory")
class Data(DataBasic):
path = "./data"
def __init__(self):
self.... | [
"json.dump",
"os.mkdir",
"json.load",
"os.path.exists"
] | [((125, 150), 'os.path.exists', 'os.path.exists', (['self.path'], {}), '(self.path)\n', (139, 150), False, 'import os\n'), ((164, 183), 'os.mkdir', 'os.mkdir', (['self.path'], {}), '(self.path)\n', (172, 183), False, 'import os\n'), ((492, 512), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (506, 512)... |
import hashlib
from collections import defaultdict
from datetime import datetime
from urllib.parse import urlencode
from babel.dates import format_date
from babel.dates import format_datetime
from babel.dates import format_time
from babel.numbers import format_currency
from pyramid.decorator import reify
from pyramid.... | [
"pyramid.interfaces.ILocation.providedBy",
"kotti.get_settings",
"collections.defaultdict",
"pyramid.settings.asbool",
"kotti.util.TemplateStructure",
"kotti.security.view_permitted",
"kotti.resources.get_root",
"kotti.resources.Content.name.like",
"kotti.interfaces.INavigationRoot.providedBy",
"k... | [((13325, 13349), 'collections.defaultdict', 'defaultdict', (['(lambda : [])'], {}), '(lambda : [])\n', (13336, 13349), False, 'from collections import defaultdict\n'), ((2825, 2853), 'kotti.events.objectevent_listeners', 'objectevent_listeners', (['event'], {}), '(event)\n', (2846, 2853), False, 'from kotti.events imp... |
import random
#Punjabi
#-----
mainNamePunjabi=["Gagan", "Har", "Bal", "Man", "Nav", "Sukh", "Kush", "Gur", "Karam", "Karan", "Dil", "Dharam", "Param", "Dal", "Jas", "Par", "Dul"]
maleSuffixPunjabi=["jeet", "jyot", "vinder", "preet", "meet"]
femleSuffixPunjabi=["preet", "jeet", "bir"]
unionSuffixPunjabi=ma... | [
"random.choice"
] | [((1676, 1707), 'random.choice', 'random.choice', (['unionNameMarathi'], {}), '(unionNameMarathi)\n', (1689, 1707), False, 'import random\n'), ((1763, 1792), 'random.choice', 'random.choice', (['maleNameMarath'], {}), '(maleNameMarath)\n', (1776, 1792), False, 'import random\n'), ((1850, 1881), 'random.choice', 'random... |
def start_end_decorator(func):
def wrapper():
print('start')
func()
print('end')
return wrapper
@start_end_decorator # print_name = start_end_decorator(print_name)
def print_name():
print('serkan')
print_name()
import functools
def sum_of_digits(func):
@functools.wraps(f... | [
"functools.update_wrapper",
"functools.wraps"
] | [((303, 324), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (318, 324), False, 'import functools\n'), ((1184, 1205), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (1199, 1205), False, 'import functools\n'), ((768, 789), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func... |
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved
Author: <NAME> (<EMAIL>)
Date: 02/26/2021
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
# from transformers import AutoModel, AutoTokenizer
class SCCLBert(nn.Module):
def __init__(self, b... | [
"torch.nn.Parameter",
"torch.nn.ReLU",
"torch.nn.Linear",
"torch.sum",
"torch.tensor"
] | [((912, 980), 'torch.tensor', 'torch.tensor', (['cluster_centers'], {'dtype': 'torch.float', 'requires_grad': '(True)'}), '(cluster_centers, dtype=torch.float, requires_grad=True)\n', (924, 980), False, 'import torch\n'), ((1025, 1059), 'torch.nn.Parameter', 'Parameter', (['initial_cluster_centers'], {}), '(initial_clu... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'DriveProfile'
db.create_table('profiles_driveprofile', (
... | [
"south.db.db.delete_table",
"south.db.db.send_create_signal"
] | [((1426, 1477), 'south.db.db.send_create_signal', 'db.send_create_signal', (['"""profiles"""', "['DriveProfile']"], {}), "('profiles', ['DriveProfile'])\n", (1447, 1477), False, 'from south.db import db\n'), ((1558, 1598), 'south.db.db.delete_table', 'db.delete_table', (['"""profiles_driveprofile"""'], {}), "('profiles... |
from random import randint
from retrying import retry
import apysc as ap
from apysc._display.line_dot_setting import LineDotSetting
class TestLineDotSetting:
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test___init__(self) -> None:
setting: LineDotSetting = LineD... | [
"apysc._display.line_dot_setting.LineDotSetting",
"random.randint",
"apysc.Int"
] | [((315, 341), 'apysc._display.line_dot_setting.LineDotSetting', 'LineDotSetting', ([], {'dot_size': '(5)'}), '(dot_size=5)\n', (329, 341), False, 'from apysc._display.line_dot_setting import LineDotSetting\n'), ((704, 730), 'apysc._display.line_dot_setting.LineDotSetting', 'LineDotSetting', ([], {'dot_size': '(5)'}), '... |
"""
Copyright (c) 2017 IBM Corp.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sub... | [
"requests.patch",
"json.load",
"json.dumps",
"requests.delete",
"json.JSONEncoder.default",
"requests.get",
"requests.post",
"os.getenv"
] | [((1170, 1185), 'os.getenv', 'getenv', (['"""TOKEN"""'], {}), "('TOKEN')\n", (1176, 1185), False, 'from os import getenv\n'), ((1611, 1655), 'requests.post', 'requests.post', (['u'], {'data': 'data', 'headers': 'headers'}), '(u, data=data, headers=headers)\n', (1624, 1655), False, 'import requests\n'), ((1974, 2019), '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (C) 2014 Arulalan.T <<EMAIL>>
# (C) 2015 <NAME>
# This file is part of 'open-tamil/txt2unicode' package examples
#
import sys
sys.path.append("../..")
from tamil.txt2unicode import tscii2unicode, unicode2tscii
tscii = """¾¢ÕÅûÙÅ÷ «ÕǢ ¾¢ÕìÌÈû """
uni_1 = tscii2unico... | [
"sys.path.append",
"tamil.txt2unicode.tscii2unicode",
"tamil.txt2unicode.unicode2tscii"
] | [((177, 201), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (192, 201), False, 'import sys\n'), ((309, 329), 'tamil.txt2unicode.tscii2unicode', 'tscii2unicode', (['tscii'], {}), '(tscii)\n', (322, 329), False, 'from tamil.txt2unicode import tscii2unicode, unicode2tscii\n'), ((347, 367), 't... |
"""
coding: utf-8
@authour: <NAME>, modified <NAME>
Inspired by:
https://github.com/hmelberg/stats-to-pandas/blob/master/stats_to_pandas/__init__.py
https://github.com/eurostat/prophet
"""
from __future__ import print_function
import pandas as pd
import requests
import ast
from pyjstat import pyjstat
from co... | [
"pandas.date_range",
"pandas.read_json",
"ipywidgets.widgets.Button",
"ipywidgets.widgets.Label",
"pandas.to_datetime",
"ipywidgets.widgets.Tab",
"ast.literal_eval",
"ipywidgets.widgets.widget_selection.SelectMultiple",
"requests.post",
"ipywidgets.widgets.VBox"
] | [((2200, 2224), 'pandas.read_json', 'pd.read_json', (['search_str'], {}), '(search_str)\n', (2212, 2224), True, 'import pandas as pd\n'), ((3961, 3984), 'pandas.read_json', 'pd.read_json', (['self.furl'], {}), '(self.furl)\n', (3973, 3984), True, 'import pandas as pd\n'), ((4675, 4698), 'pandas.read_json', 'pd.read_jso... |
import numpy as np
from source_ddc.simulation_tools import simulate
from source_ddc.algorithms import NFXP, NPL, CCP
from source_ddc.probability_tools import StateManager, random_ccp
from test.utils.functional_tools import average_out
n_repetitions = 10
def test_nfxp(simple_transition_matrix):
def utility_fn(th... | [
"numpy.meshgrid",
"numpy.abs",
"numpy.log",
"source_ddc.probability_tools.StateManager",
"test.utils.functional_tools.average_out",
"source_ddc.algorithms.NPL",
"source_ddc.probability_tools.random_ccp",
"numpy.array",
"source_ddc.simulation_tools.simulate",
"source_ddc.algorithms.CCP",
"source_... | [((616, 644), 'source_ddc.probability_tools.StateManager', 'StateManager', ([], {'miles': 'n_states'}), '(miles=n_states)\n', (628, 644), False, 'from source_ddc.probability_tools import StateManager, random_ccp\n'), ((651, 677), 'test.utils.functional_tools.average_out', 'average_out', (['n_repetitions'], {}), '(n_rep... |
#SAP DevelopmentChallange solution, written by <NAME> (<EMAIL>)
#Version: 01_28082020
#License: MIT
import sys
import argparse
from emissions import VehicleEmissions
#Important note: ArgumentParser converts any "-" to "_"
ap = argparse.ArgumentParser()
ap.add_argument("--distance", "-dist", help = "Total distance tr... | [
"emissions.VehicleEmissions",
"argparse.ArgumentParser",
"sys.exit"
] | [((230, 255), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (253, 255), False, 'import argparse\n'), ((1487, 1517), 'emissions.VehicleEmissions', 'VehicleEmissions', (['vehicle_type'], {}), '(vehicle_type)\n', (1503, 1517), False, 'from emissions import VehicleEmissions\n'), ((727, 774), 'sys.... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from . import transponder_pb2 as transponder_dot_transponder__pb2
class TransponderServiceStub(object):
"""
Allow users to get ADS-B information
and set ADS-B update rates.
"""
def __init__(self, channel):
"""Constructor... | [
"grpc.unary_stream_rpc_method_handler",
"grpc.method_handlers_generic_handler",
"grpc.unary_unary_rpc_method_handler"
] | [((2468, 2575), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""mavsdk.rpc.transponder.TransponderService"""', 'rpc_method_handlers'], {}), "(\n 'mavsdk.rpc.transponder.TransponderService', rpc_method_handlers)\n", (2504, 2575), False, 'import grpc\n'), ((1826, 2093), 'grpc.unar... |
# Copyright (c) 2015 Red Hat, 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 ... | [
"oslo_middleware.http_proxy_to_wsgi.HTTPProxyToWSGIMiddleware",
"oslo_middleware.http_proxy_to_wsgi.HTTPProxyToWSGI",
"webob.Request.blank",
"wsgiref.util.application_uri",
"webob.dec.wsgify"
] | [((869, 887), 'webob.dec.wsgify', 'webob.dec.wsgify', ([], {}), '()\n', (885, 887), False, 'import webob\n'), ((995, 1039), 'oslo_middleware.http_proxy_to_wsgi.HTTPProxyToWSGI', 'http_proxy_to_wsgi.HTTPProxyToWSGI', (['fake_app'], {}), '(fake_app)\n', (1029, 1039), False, 'from oslo_middleware import http_proxy_to_wsgi... |
import numpy as np
import torch
import torch.nn as nn
import functions.submodules as F
def norm_grad(input, max_norm):
if input.requires_grad:
def norm_hook(grad):
N = grad.size(0) # batch number
norm = grad.view(N, -1).norm(p=2, dim=1) + 1e-6
scale = (norm / max_norm... | [
"functions.submodules.PermutationMatrixCalculator.apply",
"torch.nn.ReLU",
"torch.nn.Dropout2d",
"torch.nn.Tanh",
"functions.submodules.Identity.apply",
"torch.nn.BatchNorm1d",
"torch.nn.Conv2d",
"torch.nn.Linear",
"torch.nn.BatchNorm2d",
"torch.nn.Upsample",
"torch.nn.Softmax",
"functions.sub... | [((1378, 1423), 'functions.submodules.CheckBP.apply', 'F.CheckBP.apply', (['input', 'self.label', 'self.show'], {}), '(input, self.label, self.show)\n', (1393, 1423), True, 'import functions.submodules as F\n'), ((1499, 1522), 'functions.submodules.Identity.apply', 'F.Identity.apply', (['input'], {}), '(input)\n', (151... |
from typing import Union, List
import numpy as np
from gym import spaces, ActionWrapper
from gym.spaces import flatten_space, flatdim, unflatten, flatten
from sorting_gym import DiscreteParametric
def merge_discrete_spaces(input_spaces: List[Union[spaces.Discrete, spaces.Tuple, spaces.MultiBinary]]) -> spaces.Multi... | [
"gym.spaces.flatten",
"numpy.argmax",
"numpy.zeros",
"sorting_gym.DiscreteParametric",
"gym.spaces.flatdim",
"numpy.array",
"gym.spaces.unflatten"
] | [((3029, 3117), 'sorting_gym.DiscreteParametric', 'DiscreteParametric', (['env.action_space.parameter_space.n', 'self.disjoint_action_spaces'], {}), '(env.action_space.parameter_space.n, self.\n disjoint_action_spaces)\n', (3047, 3117), False, 'from sorting_gym import DiscreteParametric\n'), ((4889, 4909), 'numpy.ar... |
# import multiply_detections
from hog_window_search import find_cars
from heat import apply_heat
import pickle
import cv2
import glob
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.image as mpimg
dist_pickle = pickle.load(open("output/svc_model.p", "rb"))
# get attributes of our svc object
svc ... | [
"cv2.VideoWriter",
"cv2.VideoWriter_fourcc",
"cv2.cvtColor",
"heat.apply_heat",
"cv2.VideoCapture",
"cv2.rectangle",
"hog_window_search.find_cars"
] | [((4090, 4121), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'XVID'"], {}), "(*'XVID')\n", (4112, 4121), False, 'import cv2\n'), ((4128, 4206), 'cv2.VideoWriter', 'cv2.VideoWriter', (['"""output/output2.avi"""', 'fourcc', '(25.0)', '(1280, 720)'], {'isColor': '(True)'}), "('output/output2.avi', fourcc, 25.0,... |
import click
from arrow.commands.remote.add_organism import cli as add_organism
from arrow.commands.remote.add_track import cli as add_track
from arrow.commands.remote.delete_organism import cli as delete_organism
from arrow.commands.remote.delete_track import cli as delete_track
from arrow.commands.remote.update_organ... | [
"click.group"
] | [((424, 437), 'click.group', 'click.group', ([], {}), '()\n', (435, 437), False, 'import click\n')] |
"""Tests for the fixes of ACCESS-ESM1-5."""
import unittest.mock
import iris
import numpy as np
import pytest
from esmvalcore.cmor._fixes.cmip6.access_esm1_5 import Cl, Cli, Clw, Hus, Zg
from esmvalcore.cmor._fixes.common import ClFixHybridHeightCoord
from esmvalcore.cmor.fix import Fix
from esmvalcore.cmor.table imp... | [
"esmvalcore.cmor._fixes.cmip6.access_esm1_5.Zg",
"numpy.zeros_like",
"numpy.ones_like",
"esmvalcore.cmor._fixes.cmip6.access_esm1_5.Clw",
"iris.cube.CubeList",
"esmvalcore.cmor._fixes.cmip6.access_esm1_5.Cli",
"esmvalcore.cmor.fix.Fix.get_fixes",
"esmvalcore.cmor._fixes.cmip6.access_esm1_5.Hus",
"ir... | [((2777, 2803), 'iris.cube.CubeList', 'iris.cube.CubeList', (['[cube]'], {}), '([cube])\n', (2795, 2803), False, 'import iris\n'), ((2870, 2923), 'esmvalcore.cmor.fix.Fix.get_fixes', 'Fix.get_fixes', (['"""CMIP6"""', '"""ACCESS-ESM1-5"""', '"""Amon"""', '"""cl"""'], {}), "('CMIP6', 'ACCESS-ESM1-5', 'Amon', 'cl')\n", (2... |
# Copyright 2019 The FastEstimator 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 appl... | [
"collections.defaultdict",
"fastestimator.util.traceability_util.traceable",
"os.path.exists",
"pandas.DataFrame"
] | [((958, 969), 'fastestimator.util.traceability_util.traceable', 'traceable', ([], {}), '()\n', (967, 969), False, 'from fastestimator.util.traceability_util import traceable\n'), ((1886, 1903), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1897, 1903), False, 'from collections import defaultdic... |
from unittest import TestCase
import trafaret as t
from trafaret_validator import TrafaretValidator
class ValidatorForTest(TrafaretValidator):
t_value = t.Int()
value = 5
class ValidatorForTest2(ValidatorForTest):
test = t.String()
class TestMetaclass(TestCase):
def test_metaclass(self):
... | [
"trafaret.String",
"trafaret.Int"
] | [((161, 168), 'trafaret.Int', 't.Int', ([], {}), '()\n', (166, 168), True, 'import trafaret as t\n'), ((239, 249), 'trafaret.String', 't.String', ([], {}), '()\n', (247, 249), True, 'import trafaret as t\n')] |
import sqlite3
import time
from bs4 import BeautifulSoup
from numpy.core import numeric
import requests
import logging
import enlighten
from barbucket.database import DatabaseConnector
from barbucket.tools import GracefulExiter
class ContractsDatabase():
def __init__(self):
pass
def create_contrac... | [
"barbucket.database.DatabaseConnector",
"logging.debug",
"barbucket.tools.GracefulExiter",
"time.sleep",
"logging.info",
"requests.get",
"bs4.BeautifulSoup"
] | [((431, 548), 'logging.debug', 'logging.debug', (['f"""Creating new contract {contract_type_from_listing}_{exchange}_{broker_symbol}_{currency}."""'], {}), "(\n f'Creating new contract {contract_type_from_listing}_{exchange}_{broker_symbol}_{currency}.'\n )\n", (444, 548), False, 'import logging\n'), ((562, 581),... |
import pandas as pd
import numpy as np
from pathlib import Path
from data_params import Data
from data_utils import (
preprocess_train_df,
fit_stats,
transform_stats,
save_transformed_stats,
)
def summarize_stats(csv_name, dir_to_data, stat_name_select):
path_to_input_df = Path(dir_to_data, csv... | [
"data_utils.save_transformed_stats",
"pandas.read_csv",
"data_utils.transform_stats",
"pathlib.Path",
"data_utils.fit_stats",
"data_utils.preprocess_train_df",
"data_params.Data"
] | [((1374, 1380), 'data_params.Data', 'Data', ([], {}), '()\n', (1378, 1380), False, 'from data_params import Data\n'), ((1822, 1878), 'pandas.read_csv', 'pd.read_csv', (['path_to_training_data'], {'usecols': 'cols_process'}), '(path_to_training_data, usecols=cols_process)\n', (1833, 1878), True, 'import pandas as pd\n')... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
from builtins import * # NOQA
standard_library.install_aliases() # NOQA
import unittest
from chainer import testing
import numpy as ... | [
"chainerrl.agents.dqn.DQN",
"chainerrl.explorers.Boltzmann",
"chainer.testing.product",
"chainerrl.agents.dqn.compute_value_loss",
"numpy.random.uniform",
"future.standard_library.install_aliases",
"numpy.asarray",
"chainerrl.agents.dqn.compute_weighted_value_loss",
"numpy.ones"
] | [((216, 250), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (248, 250), False, 'from future import standard_library\n'), ((756, 872), 'chainerrl.agents.dqn.DQN', 'DQN', (['q_func', 'opt', 'rbuf'], {'gpu': 'gpu', 'gamma': '(0.9)', 'explorer': 'explorer', 'replay_start_s... |
import csv
import os
# execfile("C:\\Users\\YONI\\Documents\\Projects\\degree\\attack detection methods\\anomaly_generator\\dataset_generator.py")
ROW_NUM = 100
path = "C:\\Users\\YONI\\Documents\\anomally_detector\\data_sets\\example\\"
users_num = 100
features_num = 20
directory = "data_sets\\"
if not os.path.ex... | [
"os.path.exists",
"os.makedirs",
"csv.DictWriter"
] | [((310, 335), 'os.path.exists', 'os.path.exists', (['directory'], {}), '(directory)\n', (324, 335), False, 'import os\n'), ((338, 360), 'os.makedirs', 'os.makedirs', (['directory'], {}), '(directory)\n', (349, 360), False, 'import os\n'), ((600, 685), 'csv.DictWriter', 'csv.DictWriter', (['csvfile'], {'delimiter': '"""... |
# Copyright (c) 2020 Broadcom.
# The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0... | [
"selenium.common.exceptions.WebDriverException",
"pyperclip.determine_clipboard",
"inc.theia.ui.UI.get_files_explorer_locator",
"json.dumps",
"inc.theia.ui.UI.get_debug_top_stack_frame_locator",
"inc.theia.constants.OK.upper",
"inc.theia.ui.UI.get_theia_statusbar_locator",
"inc.theia.ui.UI.get_debug_s... | [((3175, 3190), 'inc.decorators.wait_till_exist.WaitTillExist', 'WaitTillExist', ([], {}), '()\n', (3188, 3190), False, 'from inc.decorators.wait_till_exist import WaitTillExist\n'), ((3465, 3531), 'inc.decorators.wait_till_exist.WaitTillExist', 'WaitTillExist', ([], {'timeout': 'constants.DEFAULT_HUGE_TIMEOUT', 'inter... |
import torch
import random
import pytorch_lightning as pl
from x_transformers import *
from x_transformers.autoregressive_wrapper import *
from timm.models.swin_transformer import SwinTransformer
import utils
class SwinTransformerOCR(pl.LightningModule):
def __init__(self, cfg, tokenizer):
super().__ini... | [
"torch.full_like",
"torch.multinomial",
"torch.cat",
"torch.cumsum",
"torch.optim.lr_scheduler.LambdaLR",
"torch.no_grad"
] | [((5152, 5167), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (5165, 5167), False, 'import torch\n'), ((5846, 5861), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (5859, 5861), False, 'import torch\n'), ((1920, 1987), 'torch.optim.lr_scheduler.LambdaLR', 'torch.optim.lr_scheduler.LambdaLR', (['optimizer'], ... |
import streamlit as st
from streamlit_drawable_canvas import st_canvas
from PIL import Image
import numpy as np
import torch
import torch.nn.functional as F
import torchvision.transforms as transforms
import json
# Specify canvas parameters in application
stroke_width = st.sidebar.slider(
label='Stroke width:',... | [
"streamlit.sidebar.slider",
"streamlit_drawable_canvas.st_canvas",
"json.load",
"torch.topk",
"numpy.uint8",
"streamlit.sidebar.checkbox",
"streamlit.write",
"torch.nn.functional.softmax",
"torchvision.transforms.ToTensor",
"streamlit.sidebar.selectbox",
"numpy.array",
"torch.device",
"torch... | [((275, 351), 'streamlit.sidebar.slider', 'st.sidebar.slider', ([], {'label': '"""Stroke width:"""', 'min_value': '(1)', 'max_value': '(25)', 'value': '(3)'}), "(label='Stroke width:', min_value=1, max_value=25, value=3)\n", (292, 351), True, 'import streamlit as st\n'), ((387, 495), 'streamlit.sidebar.selectbox', 'st.... |
import numpy as np
def float_ndarray_to_dict(arr):
return np_arr_to_dict(arr)
def dict_to_float_ndarray(string):
return dict_to_np_arr(string)
def identity(e):
return e
def float_to_string(num):
return str(num)
def string_to_float(string):
return float(string)
def np_arr_to_dict(arr):
retu... | [
"numpy.array"
] | [((519, 545), 'numpy.array', 'np.array', (['arr'], {'dtype': 'dtype'}), '(arr, dtype=dtype)\n', (527, 545), True, 'import numpy as np\n')] |
from typing import Any, Dict, Optional
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.decorator import api_key_only_webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_error, json_success
from zer... | [
"zerver.lib.response.json_success",
"zerver.lib.webhooks.common.check_send_webhook_message",
"zerver.decorator.api_key_only_webhook_view",
"zerver.lib.request.REQ"
] | [((501, 539), 'zerver.decorator.api_key_only_webhook_view', 'api_key_only_webhook_view', (['"""GoSquared"""'], {}), "('GoSquared')\n", (526, 539), False, 'from zerver.decorator import api_key_only_webhook_view\n'), ((699, 724), 'zerver.lib.request.REQ', 'REQ', ([], {'argument_type': '"""body"""'}), "(argument_type='bod... |
import z3c.baseregistry.baseregistry
import asm.cms.page
import grok
import zope.component
import zope.interface
import zope.publisher.browser
import zope.publisher.interfaces.browser
import zope.intid.interfaces
class CMS(grok.Application, asm.cms.page.Page):
zope.interface.implements(asm.cms.interfaces.ICMS)
... | [
"grok.context",
"grok.provides",
"grok.subscribe"
] | [((474, 543), 'grok.subscribe', 'grok.subscribe', (['zope.intid.interfaces.IIntIds', 'grok.IObjectAddedEvent'], {}), '(zope.intid.interfaces.IIntIds, grok.IObjectAddedEvent)\n', (488, 543), False, 'import grok\n'), ((1044, 1061), 'grok.context', 'grok.context', (['CMS'], {}), '(CMS)\n', (1056, 1061), False, 'import gro... |
#!/usr/bin/env python
"""
Merges the intermediate localization files into a single
localization file.
Hazen 08/17
"""
import glob
import os
from xml.etree import ElementTree
import storm_analysis.sa_library.readinsight3 as readinsight3
import storm_analysis.sa_library.writeinsight3 as writeinsight3
def mergeAnalys... | [
"storm_analysis.sa_library.readinsight3.checkStatus",
"os.remove",
"argparse.ArgumentParser",
"os.path.basename",
"storm_analysis.sa_library.writeinsight3.I3Writer",
"os.path.exists",
"storm_analysis.sa_library.readinsight3.loadI3File",
"glob.glob",
"storm_analysis.sa_library.readinsight3.loadI3Meta... | [((575, 607), 'glob.glob', 'glob.glob', (["(dir_name + 'job*.xml')"], {}), "(dir_name + 'job*.xml')\n", (584, 607), False, 'import glob\n'), ((2913, 3003), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Merge analysis results from parallel analysis."""'}), "(description=\n 'Merge anal... |
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def handler(event, context):
logger.info("Hello World!")
| [
"logging.getLogger"
] | [((25, 44), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (42, 44), False, 'import logging\n')] |
from quickdraw import QuickDrawDataGroup
from tqdm import tqdm
import os
def main():
"""
Download the images and create the necessary directories to store them.
Notes
-----
- See https://pytorch.org/vision/stable/datasets.html#torchvision.datasets.ImageFolder to see
how images must be arrang... | [
"os.mkdir",
"tqdm.tqdm",
"os.path.exists",
"quickdraw.QuickDrawDataGroup"
] | [((552, 563), 'tqdm.tqdm', 'tqdm', (['names'], {}), '(names)\n', (556, 563), False, 'from tqdm import tqdm\n'), ((359, 383), 'os.path.exists', 'os.path.exists', (['"""images"""'], {}), "('images')\n", (373, 383), False, 'import os\n'), ((393, 411), 'os.mkdir', 'os.mkdir', (['"""images"""'], {}), "('images')\n", (401, 4... |
import math, random, copy
import numpy as np
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '1'
import torch
import torch.nn as nn
import torch.optim as optim
import torch.autograd as autograd
import torch.nn.functional as F
from DGN import DGN
from buffer import ReplayBuffer
from surviving import Surviving
from co... | [
"surviving.Surviving",
"numpy.ones",
"DGN.DGN",
"numpy.random.randint",
"torch.cuda.is_available",
"numpy.array",
"torch.Tensor",
"numpy.random.rand",
"buffer.ReplayBuffer"
] | [((346, 371), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (369, 371), False, 'import torch\n'), ((379, 401), 'surviving.Surviving', 'Surviving', ([], {'n_agent': '(100)'}), '(n_agent=100)\n', (388, 401), False, 'from surviving import Surviving\n'), ((489, 511), 'buffer.ReplayBuffer', 'Replay... |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from __future__ import unicode_literals # at top of module
import argparse
import logging
import sys
logging.basicConfig(
format='%(levelname)s(%(filename)s:%(lineno)d): %(message)s')
def levenshtein(u, v):
prev = None
curr = [0] + list(range(1, len(v)... | [
"logging.error",
"logging.basicConfig"
] | [((155, 241), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s(%(filename)s:%(lineno)d): %(message)s"""'}), "(format=\n '%(levelname)s(%(filename)s:%(lineno)d): %(message)s')\n", (174, 241), False, 'import logging\n'), ((3152, 3213), 'logging.error', 'logging.error', (['"""Expected ref... |
"""
========================================================================
Test sources
========================================================================
Test sources with CL or RTL interfaces.
Author : <NAME>
Date : Mar 11, 2019
"""
from collections import deque
from pymtl3 import *
from pymtl3.stdlib.ifc... | [
"pymtl3.stdlib.ifcs.RecvCL2SendRTL",
"pymtl3.stdlib.ifcs.SendIfcRTL",
"collections.deque"
] | [((672, 683), 'collections.deque', 'deque', (['msgs'], {}), '(msgs)\n', (677, 683), False, 'from collections import deque\n'), ((1435, 1451), 'pymtl3.stdlib.ifcs.SendIfcRTL', 'SendIfcRTL', (['Type'], {}), '(Type)\n', (1445, 1451), False, 'from pymtl3.stdlib.ifcs import RecvCL2SendRTL, SendIfcRTL\n'), ((1560, 1580), 'py... |
import gym
from typing import List, Tuple, Dict
import numpy as np
from gym import spaces
from core.simulation import Simulation
from service import global_constants
class JsbsimGymEnvironmentWrapper(gym.Env):
"""Custom Environment that follows gym interface"""
metadata = {'render.modes': ['human']}
def __... | [
"numpy.zeros",
"numpy.array",
"gym.spaces.Box",
"core.simulation.Simulation"
] | [((482, 531), 'core.simulation.Simulation', 'Simulation', ([], {'configuration_path': 'configuration_path'}), '(configuration_path=configuration_path)\n', (492, 531), False, 'from core.simulation import Simulation\n'), ((589, 660), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(-0)', 'high': '(1)', 'shape': '(self._dim... |
import functools
import io
from typing import Any, Callable, Dict, List, Optional, Tuple
import torch
from torchdata.datapipes.iter import (
IterDataPipe,
Mapper,
CSVParser,
)
from torchvision.prototype.datasets.decoder import raw
from torchvision.prototype.datasets.utils import (
Dataset,
DatasetC... | [
"functools.partial",
"torchvision.prototype.datasets.utils.HttpResource",
"torchvision.prototype.datasets.utils._internal.hint_shuffling",
"torchdata.datapipes.iter.CSVParser",
"torchvision.prototype.datasets.utils.DatasetInfo",
"torchvision.prototype.datasets.utils._internal.hint_sharding",
"torchvisio... | [((653, 795), 'torchvision.prototype.datasets.utils.DatasetInfo', 'DatasetInfo', (['"""semeion"""'], {'type': 'DatasetType.RAW', 'categories': '(10)', 'homepage': '"""https://archive.ics.uci.edu/ml/datasets/Semeion+Handwritten+Digit"""'}), "('semeion', type=DatasetType.RAW, categories=10, homepage=\n 'https://archiv... |
import pegtree as pg
from pegtree import ParseTree
from pegtree.visitor import ParseTreeVisitor
import tree as ntree
import pprint
peg = pg.grammar('multiese.pegtree')
parser = pg.generate(peg)
def fix(tree):
a = [tree.epos_]
for t in tree:
fix(t)
a.append(t.epos_)
for key in tree.keys():... | [
"tree.Choice",
"tree.annotation",
"pegtree.visitor.ParseTreeVisitor.__init__",
"tree.parse",
"pegtree.grammar",
"tree.系列",
"pegtree.generate",
"tree.コード"
] | [((138, 168), 'pegtree.grammar', 'pg.grammar', (['"""multiese.pegtree"""'], {}), "('multiese.pegtree')\n", (148, 168), True, 'import pegtree as pg\n'), ((178, 194), 'pegtree.generate', 'pg.generate', (['peg'], {}), '(peg)\n', (189, 194), True, 'import pegtree as pg\n'), ((478, 509), 'pegtree.visitor.ParseTreeVisitor.__... |
# _ _ _
# / \ _ __ __| (_)_ __ ___ _ __ _ _
# / _ \ | '_ \ / _` | | '_ \ / _ \| '_ \| | | |
# / ___ \| | | | (_| | | | | | (_) | |_) | |_| |
# /_/ \_\_| |_|\__,_|_|_| |_|\___/| .__/ \__, |
# |_| |___/
# by <NAME>
import time
import seri... | [
"serial.Serial",
"os.path.getsize",
"sys.stdout.flush",
"time.sleep"
] | [((2793, 2832), 'serial.Serial', 'serial.Serial', (['port', '(9600)'], {'timeout': 'None'}), '(port, 9600, timeout=None)\n', (2806, 2832), False, 'import serial\n'), ((3011, 3036), 'os.path.getsize', 'os.path.getsize', (['tft_file'], {}), '(tft_file)\n', (3026, 3036), False, 'import os\n'), ((1968, 1983), 'time.sleep',... |
#
# Copyright 2015 Google, 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 writi... | [
"unittest.main",
"os.path.realpath",
"strabo.location.Location",
"os.path.join"
] | [((815, 841), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (831, 841), False, 'import os\n'), ((2225, 2240), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2238, 2240), False, 'import unittest\n'), ((1473, 1536), 'os.path.join', 'os.path.join', (['TEST_DIR', '"""testdata"""', '"""up... |
#!/usr/bin/env python3
# coding=UTF-8
import os
import sys
import shutil
import ConfigParser
from logger import *
def generate_workspace(config, info):
cwd = os.path.abspath(os.getcwd())
ws_dir = cwd + '/' + info['contest_id'] + info['problem_id']
sample_dir = ws_dir + '/sample'
if os.path.isd... | [
"os.mkdir",
"os.path.basename",
"os.path.isdir",
"os.getcwd",
"ConfigParser.ConfigParser"
] | [((309, 330), 'os.path.isdir', 'os.path.isdir', (['ws_dir'], {}), '(ws_dir)\n', (322, 330), False, 'import os\n'), ((416, 432), 'os.mkdir', 'os.mkdir', (['ws_dir'], {}), '(ws_dir)\n', (424, 432), False, 'import os\n'), ((636, 656), 'os.mkdir', 'os.mkdir', (['sample_dir'], {}), '(sample_dir)\n', (644, 656), False, 'impo... |
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired, EqualTo, Email
# Form for address
class AddressForm(FlaskForm):
address = StringField('Address',validators=[DataRequired()])
submit = SubmitField('Submit')
# Form for email noti... | [
"wtforms.SubmitField",
"wtforms.validators.DataRequired",
"wtforms.validators.Email"
] | [((272, 293), 'wtforms.SubmitField', 'SubmitField', (['"""Submit"""'], {}), "('Submit')\n", (283, 293), False, 'from wtforms import StringField, SubmitField\n'), ((579, 601), 'wtforms.SubmitField', 'SubmitField', (['"""Sign Up"""'], {}), "('Sign Up')\n", (590, 601), False, 'from wtforms import StringField, SubmitField\... |
# -*- encoding: utf-8 -*-
#
# Copyright 2020 Yiwenlong(<EMAIL>)
#
# 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 applic... | [
"orgconfig.deploy.deploy_builder",
"os.path.join",
"logging.getLogger",
"utils.fileutil.mkdir_if_need"
] | [((1580, 1613), 'logging.getLogger', 'logging.getLogger', (['"""organization"""'], {}), "('organization')\n", (1597, 1613), False, 'import logging\n'), ((1634, 1669), 'os.path.join', 'os.path.join', (['target_dir', 'self.Name'], {}), '(target_dir, self.Name)\n', (1646, 1669), False, 'import os\n'), ((1678, 1701), 'util... |
from datetime import datetime, timedelta
import re
from typing import Union, Callable, Any
import math
import functools
from uuid import uuid4
from .typing import IParserResult
ANY_OF = {"template", "front", "mnemonic", "entry", "deck", "tag"}
IS_DATE = {"created", "modified", "nextReview"}
IS_STRING = {"template", "... | [
"uuid.uuid4",
"re.fullmatch",
"datetime.datetime.now",
"re.escape",
"datetime.timedelta",
"re.search",
"re.sub"
] | [((6586, 6619), 're.search', 're.search', (['"""([-+]?\\\\d+)(\\\\S*)"""', 's'], {}), "('([-+]?\\\\d+)(\\\\S*)', s)\n", (6595, 6619), False, 'import re\n'), ((1315, 1345), 're.fullmatch', 're.fullmatch', (['"""\\\\([^)]+\\\\)"""', 'q'], {}), "('\\\\([^)]+\\\\)', q)\n", (1327, 1345), False, 'import re\n'), ((2757, 2816)... |
from typing import Any, Optional, Union
import numpy as np
import pandas as pd
from crowdkit.aggregation.base_aggregator import BaseAggregator
from crowdkit.aggregation import MajorityVote
def _check_answers(answers: pd.DataFrame) -> None:
if not isinstance(answers, pd.DataFrame):
raise TypeError('Workin... | [
"crowdkit.aggregation.MajorityVote",
"numpy.sum",
"pandas.unique"
] | [((1127, 1141), 'crowdkit.aggregation.MajorityVote', 'MajorityVote', ([], {}), '()\n', (1139, 1141), False, 'from crowdkit.aggregation import MajorityVote\n'), ((2446, 2470), 'pandas.unique', 'pd.unique', (['answers.label'], {}), '(answers.label)\n', (2455, 2470), True, 'import pandas as pd\n'), ((4086, 4110), 'pandas.... |
from __future__ import unicode_literals, absolute_import
from django.contrib import admin
from . import models
@admin.register(models.Annotation)
class AnnotationAdmin(admin.ModelAdmin):
search_fields = ('text',)
fields = (
'user',
'text_object',
'annotator_schema_version',
'... | [
"django.contrib.admin.register"
] | [((116, 149), 'django.contrib.admin.register', 'admin.register', (['models.Annotation'], {}), '(models.Annotation)\n', (130, 149), False, 'from django.contrib import admin\n')] |
# Copyright 2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | [
"pickle.dump",
"numpy.array",
"daal4py.oneapi.sycl_context",
"sklearnex.patch_sklearn",
"sklearn.cluster.DBSCAN"
] | [((620, 635), 'sklearnex.patch_sklearn', 'patch_sklearn', ([], {}), '()\n', (633, 635), False, 'from sklearnex import patch_sklearn\n'), ((736, 842), 'numpy.array', 'np.array', (['[[1.0, 2.0], [2.0, 2.0], [2.0, 3.0], [8.0, 7.0], [8.0, 8.0], [25.0, 80.0]]'], {'dtype': 'np.float32'}), '([[1.0, 2.0], [2.0, 2.0], [2.0, 3.0... |
#!/usr/bin/python3
from django.core.validators import MinValueValidator, MaxValueValidator
from django.db import models
class SolenoidValve(models.Model):
"""
Model for the solenoid valves in database
"""
number = models.IntegerField(validators=[MinValueValidator(1),
... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.core.validators.MinValueValidator",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.IntegerField"... | [((365, 386), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (384, 386), False, 'from django.db import models\n'), ((403, 424), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (422, 424), False, 'from django.db import models\n'), ((442, 463), 'django.db.models.Intege... |
import smtplib #Python Library
print("Subject?")
sub=input() #Used to take subject
print("Body?")
message = input() #Used for taking message for email
print("Recipient")
receivers_mail = input() #Used to take receiver's mail
print("Sender's Mail?")
sender_mail= inpu... | [
"smtplib.SMTP"
] | [((470, 500), 'smtplib.SMTP', 'smtplib.SMTP', (['"""gmail.com"""', '(587)'], {}), "('gmail.com', 587)\n", (482, 500), False, 'import smtplib\n')] |
import requests
from endpoints.projects import Projects
from endpoints.lists import Lists
from endpoints.todos import Todos
from endpoints.labels import Labels
class Tracked:
def __init__(self, email_address: str, api_token: str, basecamp_account_id: int):
self.email_address = email_address
self.... | [
"endpoints.projects.Projects",
"requests.Session",
"endpoints.lists.Lists",
"endpoints.todos.Todos",
"endpoints.labels.Labels"
] | [((420, 438), 'requests.Session', 'requests.Session', ([], {}), '()\n', (436, 438), False, 'import requests\n'), ((493, 507), 'endpoints.projects.Projects', 'Projects', (['self'], {}), '(self)\n', (501, 507), False, 'from endpoints.projects import Projects\n'), ((559, 570), 'endpoints.lists.Lists', 'Lists', (['self'], ... |
from django.contrib import admin
from .models import Blog
# Blog information
class BlogAdmin(admin.ModelAdmin):
list_display = (
'name',
'author',
'description',
'image',
)
ordering = ('name',)
admin.site.register(Blog, BlogAdmin)
| [
"django.contrib.admin.site.register"
] | [((244, 280), 'django.contrib.admin.site.register', 'admin.site.register', (['Blog', 'BlogAdmin'], {}), '(Blog, BlogAdmin)\n', (263, 280), False, 'from django.contrib import admin\n')] |
import requests # Pega informações de API's
from datetime import datetime # Data e hora atual
from openpyxl import Workbook # Cria arquivo Excel
from openpyxl.styles import Alignment, Font # Estilos para células
import pandas as pd # Nesse caso, estou usando p/ transformar em html
# Busca as informações do site
r... | [
"openpyxl.Workbook",
"openpyxl.styles.Font",
"pandas.read_excel",
"openpyxl.styles.Alignment",
"requests.get",
"datetime.datetime.now"
] | [((332, 411), 'requests.get', 'requests.get', (['"""https://economia.awesomeapi.com.br/last/USD-BRL,EUR-BRL,BTC-BRL"""'], {}), "('https://economia.awesomeapi.com.br/last/USD-BRL,EUR-BRL,BTC-BRL')\n", (344, 411), False, 'import requests\n'), ((666, 676), 'openpyxl.Workbook', 'Workbook', ([], {}), '()\n', (674, 676), Fal... |
from flask import Flask, render_template
# create a flask application name app
app = Flask(__name__)
@app.route("/")
def index():
return render_template('index.html')
if __name__=="__main__":
app.run(debug=True) | [
"flask.Flask",
"flask.render_template"
] | [((86, 101), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (91, 101), False, 'from flask import Flask, render_template\n'), ((143, 172), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (158, 172), False, 'from flask import Flask, render_template\n')] |
import numpy as np
import atexit
import sys
aims = sys.modules['soma.aims']
'''
IO formats readers / writers written in python for aims.
Currently:
Numpy format for matrices
'''
class NpyFormat(aims.FileFormat_SparseOrDenseMatrix):
def read(self, filename, obj, context, options=None):
mat = np.load(fil... | [
"atexit.register",
"numpy.load",
"numpy.save",
"numpy.asarray"
] | [((2154, 2192), 'atexit.register', 'atexit.register', (['remove_python_formats'], {}), '(remove_python_formats)\n', (2169, 2192), False, 'import atexit\n'), ((309, 326), 'numpy.load', 'np.load', (['filename'], {}), '(filename)\n', (316, 326), True, 'import numpy as np\n'), ((1280, 1302), 'numpy.save', 'np.save', (['fil... |
import sys, time, itertools, resource, logging
from multiprocessing import Pool, Process
from util import psutil_process, print_datetime, array2string, PyTorchDType as dtype
import torch
import numpy as np
import gurobipy as grb
from scipy.special import loggamma
from sampleForIntegral import integrateOfExponentialOv... | [
"util.array2string",
"sampleForIntegral.integrateOfExponentialOverSimplexInduction2",
"torch.optim.lr_scheduler.StepLR",
"numpy.abs",
"torch.empty",
"sys.stdout.flush",
"numpy.diag",
"numpy.full",
"scipy.special.loggamma",
"numpy.copy",
"torch.zeros",
"torch.zeros_like",
"util.print_datetime... | [((705, 719), 'gurobipy.Model', 'grb.Model', (['"""M"""'], {}), "('M')\n", (714, 719), True, 'import gurobipy as grb\n'), ((3943, 4000), 'torch.zeros', 'torch.zeros', (['[self.K, self.K]'], {'dtype': 'dtype', 'device': 'device'}), '([self.K, self.K], dtype=dtype, device=device)\n', (3954, 4000), False, 'import torch\n'... |
# import numpy as np
from sklearn.pipeline import Pipeline
# from sklearn.svm import SVC, SVR
from sklearn.linear_model import SGDClassifier
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from sklearn.model_selection import cross_val_predict
from sklearn.metrics import accuracy_... | [
"sklearn.preprocessing.StandardScaler",
"sklearn.linear_model.SGDClassifier",
"sklearn.metrics.accuracy_score",
"sklearn.model_selection.cross_val_predict",
"sklearn.metrics.classification_report",
"sklearn.decomposition.PCA",
"sklearn.pipeline.Pipeline"
] | [((482, 506), 'sklearn.linear_model.SGDClassifier', 'SGDClassifier', ([], {'n_jobs': '(-1)'}), '(n_jobs=-1)\n', (495, 506), False, 'from sklearn.linear_model import SGDClassifier\n'), ((714, 760), 'sklearn.pipeline.Pipeline', 'Pipeline', (["[('preproc', preproc), ('clf', clf)]"], {}), "([('preproc', preproc), ('clf', c... |
import json
import re
import urllib.parse
from os import popen
from random import choice
import requests
from bs4 import BeautifulSoup
from bot.helper.ext_utils.exceptions import DirectDownloadLinkException
def direct_link_generator(link: str):
""" direct links generator """
if not link:
... | [
"json.loads",
"bot.helper.ext_utils.exceptions.DirectDownloadLinkException",
"requests.Session",
"os.popen",
"random.choice",
"re.findall",
"requests.get",
"bs4.BeautifulSoup",
"re.search",
"re.sub"
] | [((1210, 1228), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1226, 1228), False, 'import requests\n'), ((1334, 1373), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.content', '"""lxml"""'], {}), "(response.content, 'lxml')\n", (1347, 1373), False, 'from bs4 import BeautifulSoup\n'), ((4758, 4811), 'req... |
from rest_framework.routers import DefaultRouter
from django.urls import path,include,re_path
from . import views
from .views import UserProfileViewSet,accountView,loginView,registerView
router = DefaultRouter()
router.register('profiles',UserProfileViewSet,base_name='user-profile-viewset')
urlpatterns = [
path('... | [
"django.urls.path",
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((197, 212), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (210, 212), False, 'from rest_framework.routers import DefaultRouter\n'), ((349, 415), 'django.urls.path', 'path', (['"""user/"""', 'accountView'], {'name': '"""account_email_verification_sent"""'}), "('user/', accountView, name='a... |
import argparse
import logging
import math
import time
from threading import Thread
from typing import List
import pandas as pd
from mutester.data_analysis import DataAnalysis
from mutester.data_crawler import DataCrawler
def analysis_thread(repository_path, environment_path, mutant_ids: List[int], results: List[Da... | [
"pandas.DataFrame",
"threading.Thread",
"argparse.ArgumentParser",
"logging.basicConfig",
"mutester.data_crawler.DataCrawler",
"time.strftime",
"time.time",
"logging.info",
"mutester.data_analysis.DataAnalysis",
"pandas.read_pickle"
] | [((363, 419), 'mutester.data_analysis.DataAnalysis', 'DataAnalysis', (['repository_path', 'environment_path', 'timeout'], {}), '(repository_path, environment_path, timeout)\n', (375, 419), False, 'from mutester.data_analysis import DataAnalysis\n'), ((667, 681), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (67... |
#-*- coding: utf-8 -*-
from threading import Thread
import time
def loop(idx, nsec):
print("start loop", idx, " at ", time.ctime())
time.sleep(nsec)
print("start loop", idx, " at ", time.ctime())
def main():
print("Process start at ", time.ctime())
thread0 = Thread(target=loop, args=(0, 4))
th... | [
"threading.Thread",
"time.ctime",
"time.sleep"
] | [((141, 157), 'time.sleep', 'time.sleep', (['nsec'], {}), '(nsec)\n', (151, 157), False, 'import time\n'), ((281, 313), 'threading.Thread', 'Thread', ([], {'target': 'loop', 'args': '(0, 4)'}), '(target=loop, args=(0, 4))\n', (287, 313), False, 'from threading import Thread\n'), ((348, 380), 'threading.Thread', 'Thread... |