code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
import os
import json
from tqdm import tqdm
from augment import process
import cfg
all_songs = []
for root, dirs, files in tqdm(list(os.walk(cfg.SONGS_DIR))):
if not('ITG' in root or 'YARK' in root):
continue
found_sm = None
found_ssc = None
for name in files:
if name.lower().endswith... | [
"os.mkdir",
"json.dump",
"os.path.isdir",
"os.walk",
"augment.process",
"os.path.join"
] | [((925, 947), 'os.path.isdir', 'os.path.isdir', (['"""./res"""'], {}), "('./res')\n", (938, 947), False, 'import os\n'), ((953, 968), 'os.mkdir', 'os.mkdir', (['"""res"""'], {}), "('res')\n", (961, 968), False, 'import os\n'), ((1015, 1038), 'json.dump', 'json.dump', (['all_songs', 'f'], {}), '(all_songs, f)\n', (1024,... |
"""
sentry.models.user
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import warnings
from django.contrib.auth.models import AbstractBaseUser
from django.db import models
from djang... | [
"sentry.models.UserOption.objects.filter",
"sentry.models.Project.objects.filter",
"sentry.models.GroupBookmark.objects.filter",
"sentry.models.Team.objects.filter",
"sentry.models.TeamMember.objects.filter",
"warnings.warn",
"django.utils.translation.ugettext_lazy",
"sentry.manager.UserManager",
"s... | [((1812, 1844), 'sentry.manager.UserManager', 'UserManager', ([], {'cache_fields': "['pk']"}), "(cache_fields=['pk'])\n", (1823, 1844), False, 'from sentry.manager import UserManager\n'), ((546, 559), 'django.utils.translation.ugettext_lazy', '_', (['"""username"""'], {}), "('username')\n", (547, 559), True, 'from djan... |
from django.db import models
from django_hstore import hstore
class Ref(models.Model):
name = models.CharField(max_length=32)
class HStoreModel(models.Model):
objects = hstore.HStoreManager()
class Meta:
abstract = True
class DataBag(HStoreModel):
name = models.CharField(max_length=32)
... | [
"django.db.models.CharField",
"django_hstore.hstore.HStoreManager",
"django_hstore.hstore.ReferencesField",
"django_hstore.hstore.DictionaryField"
] | [((100, 131), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(32)'}), '(max_length=32)\n', (116, 131), False, 'from django.db import models\n'), ((181, 203), 'django_hstore.hstore.HStoreManager', 'hstore.HStoreManager', ([], {}), '()\n', (201, 203), False, 'from django_hstore import hstore\n'), ... |
"""Test Ecole information functions in Python.
Most information functions are written in Ecole C++ library.
This is where the logic should be tested.
Here,
- Some tests automatically run the same assertions on all functions;
- Other tests that information returned form information functions are bound to the correc... | [
"ecole.dynamics.BranchingDynamics",
"ecole.information.Nothing"
] | [((900, 934), 'ecole.dynamics.BranchingDynamics', 'ecole.dynamics.BranchingDynamics', ([], {}), '()\n', (932, 934), False, 'import ecole\n'), ((1743, 1770), 'ecole.information.Nothing', 'ecole.information.Nothing', ([], {}), '()\n', (1768, 1770), False, 'import ecole\n'), ((690, 717), 'ecole.information.Nothing', 'ecol... |
import os
from subprocess import call
from Integrator import dolog, get_file_from_path, build_path, delete_dir
from Integrator import get_parent_path, log_file_dir, config_folder_name
from . import call_and_get_log, timeout_comm
import sys
ar2dtool_config_types = ['ar2dtool-taxonomy.conf', 'ar2dtool-class.conf']
f... | [
"Integrator.get_parent_path",
"Integrator.get_file_from_path",
"os.path.join",
"Integrator.dolog"
] | [((2113, 2155), 'os.path.join', 'os.path.join', (['ar2dtool_dir', '"""ar2dtool.jar"""'], {}), "(ar2dtool_dir, 'ar2dtool.jar')\n", (2125, 2155), False, 'import os\n'), ((2453, 2481), 'Integrator.dolog', 'dolog', (["('drawing is: ' + comm)"], {}), "('drawing is: ' + comm)\n", (2458, 2481), False, 'from Integrator import ... |
"""
Created: Tue Jul 30 07:56:52 2019
@author: <NAME> <<EMAIL>>
"""
import os
import site
from julia.api import LibJulia, Julia
api = LibJulia.load(julia=os.path.join(site.USER_BASE, 'bin', 'julia-py'))
api.sysimage = 'julia_sysimage.so'
api.init_julia()
#%%
ret = api.jl_eval_string(b"sin(pi)")
print(float(api.jl_u... | [
"os.path.join"
] | [((156, 203), 'os.path.join', 'os.path.join', (['site.USER_BASE', '"""bin"""', '"""julia-py"""'], {}), "(site.USER_BASE, 'bin', 'julia-py')\n", (168, 203), False, 'import os\n')] |
import os
import sys
crt_dir = os.getcwd()
this_dir = os.path.join(crt_dir, 'd435_camera')
# when this folder serve as a module
if os.path.isdir(this_dir):
sys.path.append(this_dir)
print('d435_module added to python path: {}'.format(this_dir)) | [
"os.getcwd",
"sys.path.append",
"os.path.isdir",
"os.path.join"
] | [((35, 46), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (44, 46), False, 'import os\n'), ((59, 95), 'os.path.join', 'os.path.join', (['crt_dir', '"""d435_camera"""'], {}), "(crt_dir, 'd435_camera')\n", (71, 95), False, 'import os\n'), ((139, 162), 'os.path.isdir', 'os.path.isdir', (['this_dir'], {}), '(this_dir)\n', (1... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | [
"unittest.main",
"qiskit_nature.circuit.library.UCCSD",
"qiskit.BasicAer.get_backend",
"qiskit.algorithms.optimizers.COBYLA",
"qiskit_nature.circuit.library.HartreeFock",
"qiskit_nature.algorithms.VQEUCCFactory",
"qiskit_nature.mappers.second_quantization.JordanWignerMapper",
"qiskit.opflow.AerPauliEx... | [((3746, 3761), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3759, 3761), False, 'import unittest\n'), ((1627, 1663), 'qiskit_nature.algorithms.VQEUCCFactory', 'VQEUCCFactory', (['self.quantum_instance'], {}), '(self.quantum_instance)\n', (1640, 1663), False, 'from qiskit_nature.algorithms import VQEUCCFactory\... |
from django.views.generic import CreateView, UpdateView, ListView
from django.urls import reverse
from aberowl.models import Ontology, Submission
from aberowl.forms import OntologyForm, SubmissionForm
from aberowlweb.mixins import FormRequestMixin, ActionMixin
from django.shortcuts import get_object_or_404
from aberowl... | [
"aberowl.tasks.reload_ontology.delay",
"django.contrib.messages.error",
"django.urls.reverse",
"django.shortcuts.get_object_or_404",
"django.contrib.messages.info"
] | [((923, 947), 'django.urls.reverse', 'reverse', (['"""list_ontology"""'], {}), "('list_ontology')\n", (930, 947), False, 'from django.urls import reverse\n'), ((1866, 1909), 'django.urls.reverse', 'reverse', (['"""create_submission"""'], {'kwargs': 'kwargs'}), "('create_submission', kwargs=kwargs)\n", (1873, 1909), Fal... |
import json
from django.shortcuts import get_object_or_404, render
from django.views.decorators.http import require_http_methods
from django.http import HttpResponse
from ipware.ip import get_ip
from core.models import Event
from ..models import EventSurvey, EventSurveyResult, GlobalSurvey, GlobalSurveyResult
@re... | [
"json.loads",
"django.http.HttpResponse",
"ipware.ip.get_ip",
"json.dumps",
"django.shortcuts.get_object_or_404",
"django.shortcuts.render",
"django.views.decorators.http.require_http_methods"
] | [((318, 363), 'django.views.decorators.http.require_http_methods', 'require_http_methods', (["['GET', 'HEAD', 'POST']"], {}), "(['GET', 'HEAD', 'POST'])\n", (338, 363), False, 'from django.views.decorators.http import require_http_methods\n'), ((1353, 1394), 'django.shortcuts.render', 'render', (['request', '"""survey_... |
import hashlib
import os
import bs4
import numpy as np
from .group import Group
from .path import Path
from .shapes import Rectangle
class TexConfig:
main_font = None
mono_font = None
sans_font = None
margin = 5.5
scale_factor = 8
fill = [255, 255, 255]
stroke = [255, 255, 255]
strok... | [
"bs4.BeautifulSoup",
"os.path.exists",
"os.system",
"numpy.array"
] | [((997, 1035), 'os.path.exists', 'os.path.exists', (['f"""/tmp/{filename}.tex"""'], {}), "(f'/tmp/{filename}.tex')\n", (1011, 1035), False, 'import os\n'), ((1687, 1818), 'os.system', 'os.system', (['f"""cd /tmp && xelatex -no-pdf {filename}.tex > /dev/null 2>&1 && dvisvgm -e -n {filename}.xdv > /dev/null 2>&1"""'], {}... |
"""
Name: NEAT evolved by Golden-Section Search
Function(s):
Reproduction by Golden-Section Search and Random Near Search.
"""
from ReverseEncodingTree.evolution.bean.genome import create_golden_section_new
from ReverseEncodingTree.evolution.methods import bi
class Reproduction(bi.Reproduction):
d... | [
"ReverseEncodingTree.evolution.bean.genome.create_golden_section_new"
] | [((837, 909), 'ReverseEncodingTree.evolution.bean.genome.create_golden_section_new', 'create_golden_section_new', (['matrix_1', 'matrix_2', 'self.genome_config', 'index'], {}), '(matrix_1, matrix_2, self.genome_config, index)\n', (862, 909), False, 'from ReverseEncodingTree.evolution.bean.genome import create_golden_se... |
from telethon import TelegramClient, events
from download_from_url import download_file, get_size
import os
import time
import datetime
import aiohttp
api_id = int("API ID")
api_hash = "API HASH"
bot_token = "<PASSWORD>"
download_path = "Downloads/"
bot = TelegramClient('Uploader bot', api_id, api_hash).s... | [
"os.mkdir",
"os.remove",
"telethon.events.NewMessage",
"datetime.datetime.today",
"os.path.basename",
"telethon.TelegramClient",
"os.path.getsize",
"os.path.isdir",
"time.time",
"aiohttp.ClientSession",
"download_from_url.get_size",
"datetime.timedelta",
"download_from_url.download_file"
] | [((483, 508), 'datetime.datetime.today', 'datetime.datetime.today', ([], {}), '()\n', (506, 508), False, 'import datetime\n'), ((670, 691), 'os.path.getsize', 'os.path.getsize', (['file'], {}), '(file)\n', (685, 691), False, 'import os\n'), ((712, 726), 'download_from_url.get_size', 'get_size', (['size'], {}), '(size)\... |
#!/usr/bin/env python
import base64
import requests
import binascii
import subprocess
from ..common import *
import random
import string
import ctypes
from json import loads
from urllib import request
__all__ = ['ixigua_download', 'ixigua_download_playlist_by_url']
headers = {
"user-agent": "Mozilla/5.0 (Window... | [
"requests.session",
"subprocess.Popen",
"urllib.request.Request",
"random.sample",
"base64.b64decode",
"random.random",
"ctypes.c_uint32"
] | [((3465, 3551), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'stdout': 'subprocess.PIPE', 'shell': '(True)', 'stderr': 'subprocess.PIPE'}), '(cmd, stdout=subprocess.PIPE, shell=True, stderr=subprocess\n .PIPE)\n', (3481, 3551), False, 'import subprocess\n'), ((4074, 4092), 'requests.session', 'requests.session... |
from __future__ import absolute_import, division, print_function
from iotbx.shelx.errors import *
from iotbx.shelx.lexer import *
from iotbx.shelx.parsers import *
import iotbx.shelx.writer # implicit import
import boost.python
ext = boost.python.import_ext("iotbx_shelx_ext")
def _cctbx_xray_structure_from(file=None,... | [
"os.path.splitext",
"os.path.isfile",
"iotbx.builders.crystal_structure_builder",
"iotbx.reflection_file_reader.any_reflection_file"
] | [((628, 744), 'iotbx.builders.crystal_structure_builder', 'builders.crystal_structure_builder', ([], {'set_grad_flags': 'set_grad_flags', 'min_distance_sym_equiv': 'min_distance_sym_equiv'}), '(set_grad_flags=set_grad_flags,\n min_distance_sym_equiv=min_distance_sym_equiv)\n', (662, 744), False, 'from iotbx import b... |
from aiida import orm
from aiida.engine import calcfunction
from aiida_siesta.workflows.base import SiestaBaseWorkChain
@calcfunction
def get_bandgap(e_fermi, band):
"""
Takes a band object, and a Fermi energy, and extracts the band gap value and 'is_insulator' boolean
:param band: (orm.BandsData): band-s... | [
"aiida.orm.nodes.data.array.bands.find_bandgap",
"aiida.orm.Dict",
"aiida.orm.Float"
] | [((774, 830), 'aiida.orm.nodes.data.array.bands.find_bandgap', 'find_bandgap', ([], {'fermi_energy': 'e_fermi.value', 'bandsdata': 'band'}), '(fermi_energy=e_fermi.value, bandsdata=band)\n', (786, 830), False, 'from aiida.orm.nodes.data.array.bands import find_bandgap\n'), ((969, 990), 'aiida.orm.Dict', 'orm.Dict', ([]... |
# coding: utf-8
from __future__ import unicode_literals, division
from custodian.custodian import Validator
from pymatgen.io.vaspio.vasp_output import Vasprun
class VasprunXMLValidator(Validator):
"""
Checks that a valid vasprun.xml was generated
"""
def __init__(self):
pass
def check(... | [
"pymatgen.io.vaspio.vasp_output.Vasprun"
] | [((352, 374), 'pymatgen.io.vaspio.vasp_output.Vasprun', 'Vasprun', (['"""vasprun.xml"""'], {}), "('vasprun.xml')\n", (359, 374), False, 'from pymatgen.io.vaspio.vasp_output import Vasprun\n')] |
def tablify(data, column_names):
"""Convert a list of lists (data) into a ascii table."""
import prettytable
if not data:
return('')
default_alignment = 'l'
alignments = {'left': 'l', 'right': 'r', 'center': 'c'}
columns = []
max_row_len = max([len(row) for row in data])
for col... | [
"prettytable.PrettyTable"
] | [((645, 708), 'prettytable.PrettyTable', 'prettytable.PrettyTable', (["[column['name'] for column in columns]"], {}), "([column['name'] for column in columns])\n", (668, 708), False, 'import prettytable\n')] |
import scipy
import re
import os
from datetime import datetime
import numpy as np
import pandas as pd
from _bisect import bisect
from itertools import groupby
class DataReader:
"""Provides functions to read raw data acquired during the cognitive load study
i.e. tasks information and wireless data)."""
de... | [
"os.remove",
"pandas.read_csv",
"numpy.unwrap",
"_bisect.bisect",
"datetime.datetime.strptime",
"numpy.array",
"itertools.groupby",
"os.path.join",
"os.listdir",
"re.compile"
] | [((11206, 11254), 'datetime.datetime.strptime', 'datetime.strptime', (['value', '"""%Y:%m:%d:%H:%M:%S:%f"""'], {}), "(value, '%Y:%m:%d:%H:%M:%S:%f')\n", (11223, 11254), False, 'from datetime import datetime\n'), ((13543, 13632), 're.compile', 're.compile', (['"""(\\\\S+), Hidden Pattern Question Slide, HiddenPattern(\\... |
# MIT 6.00.1x
# Problem Set 3
# Hangman Game
import random
import string
WORDLIST_FILENAME = "words.txt"
def loadWords():
"""
Returns a list of valid words. Words are strings of lowercase letters.
"""
print("Loading word list from file...")
# inFile: file
inFile = open(WORDLIST_FILENAME, 'r'... | [
"random.choice"
] | [((642, 665), 'random.choice', 'random.choice', (['wordlist'], {}), '(wordlist)\n', (655, 665), False, 'import random\n')] |
import sys
from datetime import timedelta
import pytz
import re
from django.conf import settings
from django.db import connections
from django.db.models import Sum, Q
from django.db.utils import ProgrammingError
from django.test import TransactionTestCase, utils
from django.utils import timezone
from sphinxsearch.rou... | [
"sphinxsearch.routers.SphinxRouter",
"django.utils.timezone.now",
"django.db.models.Sum",
"django.db.models.Q",
"testapp.models.OverridenSphinxModel",
"sphinxsearch.utils.sphinx_escape",
"datetime.timedelta",
"pytz.timezone",
"django.test.utils.CaptureQueriesContext",
"sys.exc_info",
"testapp.mo... | [((1470, 1541), 'django.test.utils.CaptureQueriesContext', 'utils.CaptureQueriesContext', (['connections[settings.SPHINX_DATABASE_NAME]'], {}), '(connections[settings.SPHINX_DATABASE_NAME])\n', (1497, 1541), False, 'from django.test import TransactionTestCase, utils\n'), ((14133, 14159), 're.sub', 're.sub', (['"""\\\\s... |
from typing import Optional
import argparse
import tensorflow as tf
class conv_set:
def __init__(self, filters: int):
self.filters = filters
def __call__(self, inputs: tf.Tensor) -> tf.Tensor:
y = tf.keras.layers.Conv2D(
self.filters, kernel_size=3, padding="SAME", activation="rel... | [
"tensorflow.keras.layers.Cropping2D",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.Input",
"tensorflow.keras.layers.Softmax",
"tensorflow.keras.Model",
"tensorflow.keras.layers.concatenate",
"tensorflow.keras.layers.MaxPool2D",
"tensorflow.keras.l... | [((1137, 1172), 'tensorflow.keras.Input', 'tf.keras.Input', ([], {'shape': '(224, 224, 3)'}), '(shape=(224, 224, 3))\n', (1151, 1172), True, 'import tensorflow as tf\n'), ((2054, 2094), 'tensorflow.keras.Model', 'tf.keras.Model', ([], {'inputs': 'x', 'outputs': 'output'}), '(inputs=x, outputs=output)\n', (2068, 2094), ... |
"""Testing utilities."""
import urlparse
class Url(object):
"""
A wrapper class for comparing urls with querystrings while avoiding
dict-ordering dependencies. Order of keys in querystring should not matter,
although order of multiple values for a single key does matter.
"""
def __init__(self... | [
"urlparse.urlparse",
"urlparse.parse_qs"
] | [((367, 389), 'urlparse.urlparse', 'urlparse.urlparse', (['url'], {}), '(url)\n', (384, 389), False, 'import urlparse\n'), ((715, 745), 'urlparse.parse_qs', 'urlparse.parse_qs', (['parts.query'], {}), '(parts.query)\n', (732, 745), False, 'import urlparse\n')] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import tensorflow as tf
sys.path.append('../../../')
from io_utils import RuSentRelBasedExperimentsIOUtils
from arekit.contrib.networks.context.architectures.att_self_z_yang_bilstm import AttentionSelfZYangBiLSTM
from arekit.contrib.networks.context.configurations... | [
"sys.path.append",
"tensorflow.contrib.layers.xavier_initializer",
"io_utils.RuSentRelBasedExperimentsIOUtils",
"rusentrel.ctx_names.ModelNames"
] | [((79, 107), 'sys.path.append', 'sys.path.append', (['"""../../../"""'], {}), "('../../../')\n", (94, 107), False, 'import sys\n'), ((1115, 1153), 'tensorflow.contrib.layers.xavier_initializer', 'tf.contrib.layers.xavier_initializer', ([], {}), '()\n', (1151, 1153), True, 'import tensorflow as tf\n'), ((1957, 1991), 'i... |
import numpy as np
import matplotlib.pyplot as plt
import torch
'''
compensation = {
"no_comp":
"simple":
"dynamic":
"bias":
"double_sim":
}
'''
quantized = True
visualize = False
symmetric = True
def asym_quant_param(w, k):
num_intervals = 2 ** k - 1
scale = (torch.max(w) - torch.min(w)... | [
"torch.mean",
"torch.ones",
"torch.ones_like",
"torch.stack",
"torch.where",
"torch.zeros_like",
"torch.min",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"torch.normal",
"torch.clamp",
"torch.max",
"torch.arange",
"torch.chunk",
"torch.abs",
"torch.round",
"matplotlib.pypl... | [((666, 700), 'torch.clamp', 'torch.clamp', (['w_q', '(0)', 'num_intervals'], {}), '(w_q, 0, num_intervals)\n', (677, 700), False, 'import torch\n'), ((768, 790), 'torch.round', 'torch.round', (['(w / scale)'], {}), '(w / scale)\n', (779, 790), False, 'import torch\n'), ((801, 852), 'torch.clamp', 'torch.clamp', (['w_q... |
#!/usr/bin/env python
"""Build a mulled images for a tool source (Galaxy or CWL tool).
Examples:
Build mulled images for requirements defined in a tool:
mulled-build-tool build path/to/tool_file.xml
"""
from galaxy.tool_util.parser import get_tool_source
from ._cli import arg_parser
from .mulled_build import (... | [
"galaxy.tool_util.parser.get_tool_source"
] | [((898, 924), 'galaxy.tool_util.parser.get_tool_source', 'get_tool_source', (['args.tool'], {}), '(args.tool)\n', (913, 924), False, 'from galaxy.tool_util.parser import get_tool_source\n')] |
"""Test runway.core.providers.aws._response."""
# pylint: disable=no-self-use
# pyright: basic
from __future__ import annotations
from typing import TYPE_CHECKING
from runway.core.providers.aws import BaseResponse, ResponseError, ResponseMetadata
if TYPE_CHECKING:
from pytest_mock import MockerFixture
MODULE = ... | [
"runway.core.providers.aws.ResponseMetadata",
"runway.core.providers.aws.BaseResponse",
"runway.core.providers.aws.ResponseError"
] | [((1353, 1367), 'runway.core.providers.aws.BaseResponse', 'BaseResponse', ([], {}), '()\n', (1365, 1367), False, 'from runway.core.providers.aws import BaseResponse, ResponseError, ResponseMetadata\n'), ((2109, 2124), 'runway.core.providers.aws.ResponseError', 'ResponseError', ([], {}), '()\n', (2122, 2124), False, 'fr... |
"""Fedora 3.x RELS-EXTseries to BIBFRAME 2.0 ingester
This ingester is not intended to generated fully formed BF RDF but
supplement existing ingesters like MODS and DC. The RELS-EXT ingester adds
additional properties and classes to existing BF entities.
"""
__author__ = "<NAME>, <NAME>"
import rdflib
from bibcat.r... | [
"rdflib.Namespace"
] | [((359, 417), 'rdflib.Namespace', 'rdflib.Namespace', (['"""http://id.loc.gov/ontologies/bibframe/"""'], {}), "('http://id.loc.gov/ontologies/bibframe/')\n", (375, 417), False, 'import rdflib\n')] |
from flask_restful import Resource, reqparse
from Vehiculos.models.vehiculo import VehiculoModel
class Vehiculo(Resource):
parser = reqparse.RequestParser()
parser.add_argument(
'marca_vehiculo',
type= str,
required = True,
help = "Falta la marca_vehiculo"
)
... | [
"flask_restful.reqparse.RequestParser",
"Vehiculos.models.vehiculo.VehiculoModel",
"Vehiculos.models.vehiculo.VehiculoModel.query.filter_by"
] | [((143, 167), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (165, 167), False, 'from flask_restful import Resource, reqparse\n'), ((877, 939), 'Vehiculos.models.vehiculo.VehiculoModel', 'VehiculoModel', (["data['marca_vehiculo']", "data['modelo_vehiculo']"], {}), "(data['marca_vehi... |
import os
import wave
import time
import pickle
#import pyaudio
import warnings
import numpy as np
import sounddevice as sd
from scipy.io.wavfile import write
from sklearn import preprocessing
from scipy.io.wavfile import read
import python_speech_features as mfcc
from sklearn.mixture import GaussianMixture... | [
"sklearn.preprocessing.scale",
"warnings.filterwarnings",
"numpy.argmax",
"numpy.asarray",
"numpy.zeros",
"sklearn.mixture.GaussianMixture",
"numpy.hstack",
"scipy.io.wavfile.write",
"scipy.io.wavfile.read",
"time.sleep",
"sounddevice.wait",
"python_speech_features.mfcc",
"os.path.join",
"... | [((325, 358), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (348, 358), False, 'import warnings\n'), ((472, 492), 'numpy.zeros', 'np.zeros', (['(rows, 20)'], {}), '((rows, 20))\n', (480, 492), True, 'import numpy as np\n'), ((1059, 1128), 'python_speech_features.mfcc', 'm... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import os
import tensorflow as tf
from model.config import cfg
from model.test import im_detect
from nets.resnet_v1 import resnetv1
from nets.vgg16 import vgg16
from utils.timer import Timer
CLASSE... | [
"tensorflow.train.Saver",
"tensorflow.Session",
"model.test.im_detect",
"tensorflow.ConfigProto",
"os.path.isfile",
"cv2.imread",
"nets.resnet_v1.resnetv1",
"nets.vgg16.vgg16",
"os.path.join",
"utils.timer.Timer"
] | [((1191, 1291), 'os.path.join', 'os.path.join', (['"""output"""', 'extraction_net', 'DATASETS[dataset][0]', '"""default"""', 'NETS[extraction_net][0]'], {}), "('output', extraction_net, DATASETS[dataset][0], 'default',\n NETS[extraction_net][0])\n", (1203, 1291), False, 'import os\n'), ((1582, 1623), 'tensorflow.Con... |
import sys
import simulator_diagnoser as sd
if __name__ == "__main__":
config = sd.ConfigParser()
grammar = config.get_grammar()
graph = config.get_graph()
symptoms = config.get_symptoms()
dx = sd.SimpleDiagnoser(grammar)
dxs = dx.diagnose(graph, symptoms)
if len(sys.argv) == 1:
... | [
"simulator_diagnoser.ConfigParser",
"simulator_diagnoser.SimpleDiagnoser",
"simulator_diagnoser.PdfWriter"
] | [((85, 102), 'simulator_diagnoser.ConfigParser', 'sd.ConfigParser', ([], {}), '()\n', (100, 102), True, 'import simulator_diagnoser as sd\n'), ((217, 244), 'simulator_diagnoser.SimpleDiagnoser', 'sd.SimpleDiagnoser', (['grammar'], {}), '(grammar)\n', (235, 244), True, 'import simulator_diagnoser as sd\n'), ((442, 456),... |
from enum import Enum
from PyQt5 import QtGui
from PyQt5.QtCore import Qt
from PyQt5.Qt import QObject
from pineboolib import decorators
from pineboolib.flcontrols import ProjectClass
from pineboolib.fllegacy.FLStylePainter import FLStylePainter
class MReportObject(ProjectClass, QObject):
class BorderStyle(En... | [
"PyQt5.QtGui.QPen"
] | [((2159, 2226), 'PyQt5.QtGui.QPen', 'QtGui.QPen', (['self.borderColor_', 'self.borderWidth_', 'self.borderStyle_'], {}), '(self.borderColor_, self.borderWidth_, self.borderStyle_)\n', (2169, 2226), False, 'from PyQt5 import QtGui\n')] |
from pathlib import Path
import pickle
from rich.table import Table
from rich import box
from rich.console import Console
from typing import Callable, Dict
import panzoto.config as CFG
from panzoto.matrix import Matrix
from panzoto.utils import load_matrix, log_output, timer
class Portal():
def __init__(self):
... | [
"pickle.dump",
"panzoto.utils.load_matrix",
"pathlib.Path",
"rich.console.Console",
"panzoto.matrix.Matrix",
"rich.table.Table"
] | [((852, 867), 'pathlib.Path', 'Path', (['save_path'], {}), '(save_path)\n', (856, 867), False, 'from pathlib import Path\n'), ((2412, 2459), 'rich.table.Table', 'Table', ([], {'title': '"""Matrix Commands"""', 'box': 'box.ROUNDED'}), "(title='Matrix Commands', box=box.ROUNDED)\n", (2417, 2459), False, 'from rich.table ... |
import sqlite3
class SQLiteDriver:
def __init__(self, dbname: str ):
self.config = dbname
def __enter__(self) -> 'cursor':
self.connection = sqlite3.connect(self.config)
assert self.connection is not None, 'failed getting connection from DB'
self.connection.execute( 'PRAGMA f... | [
"sqlite3.connect"
] | [((169, 197), 'sqlite3.connect', 'sqlite3.connect', (['self.config'], {}), '(self.config)\n', (184, 197), False, 'import sqlite3\n')] |
from requests import get, post
from pprint import pprint
from srcipts.requests.common import URL
tokens = post(f'{URL}/signin', json={'nickname': 'Roman',
'unhashed_password': '<PASSWORD>'}).json()
pprint(tokens)
headers = {'Authorization': f'Bearer {tokens["access_token"]}'}
ppr... | [
"requests.post",
"pprint.pprint",
"requests.get"
] | [((237, 251), 'pprint.pprint', 'pprint', (['tokens'], {}), '(tokens)\n', (243, 251), False, 'from pprint import pprint\n'), ((108, 196), 'requests.post', 'post', (['f"""{URL}/signin"""'], {'json': "{'nickname': 'Roman', 'unhashed_password': '<PASSWORD>'}"}), "(f'{URL}/signin', json={'nickname': 'Roman', 'unhashed_passw... |
# coding=utf8
import os
def getpath(dir_path, *path):
return os.path.join(dir_path, *path)
| [
"os.path.join"
] | [((67, 96), 'os.path.join', 'os.path.join', (['dir_path', '*path'], {}), '(dir_path, *path)\n', (79, 96), False, 'import os\n')] |
# ROS utilities used by the CRI group
#! /usr/bin/env python
import os
import sys
import copy
import time
import numpy as np
import rospy
import rospkg
import sys
import inspect
from ur_control import transformations, spalg
from sensor_msgs.msg import JointState
from pyquaternion import Quaternion
def load_urdf_string... | [
"rospy.get_namespace",
"rospy.logerr",
"numpy.clip",
"rospy.logwarn",
"numpy.zeros_like",
"ur_control.spalg.skew",
"numpy.identity",
"ur_control.transformations.angular_velocity_from_quaternions",
"rospy.is_shutdown",
"pyquaternion.Quaternion",
"rospy.logfatal",
"copy.deepcopy",
"numpy.minim... | [((355, 371), 'rospkg.RosPack', 'rospkg.RosPack', ([], {}), '()\n', (369, 371), False, 'import rospkg\n'), ((10271, 10288), 'sys.stdin.read', 'sys.stdin.read', (['(1)'], {}), '(1)\n', (10285, 10288), False, 'import sys\n'), ((10773, 10792), 'rospy.is_shutdown', 'rospy.is_shutdown', ([], {}), '()\n', (10790, 10792), Fal... |
import collections
import os
from shutil import rmtree
import numpy as np
import onnx
import pandas as pd
import requests
import torch
from matplotlib import pyplot as plt
from onnx_tf.backend import prepare
from PIL import Image
from scipy.signal import spectrogram
from tensorflowjs.converters import tf_saved_model_c... | [
"torch.nn.Dropout",
"os.remove",
"numpy.random.seed",
"pandas.read_csv",
"torch.argmax",
"torch.nn.MaxPool1d",
"torch.randn",
"torch.cat",
"collections.defaultdict",
"numpy.around",
"matplotlib.pyplot.figure",
"os.path.isfile",
"torch.nn.init.constant_",
"matplotlib.pyplot.imsave",
"shut... | [((510, 529), 'os.getenv', 'os.getenv', (['"""TMPDIR"""'], {}), "('TMPDIR')\n", (519, 529), False, 'import os\n'), ((537, 554), 'os.getenv', 'os.getenv', (['"""FULL"""'], {}), "('FULL')\n", (546, 554), False, 'import os\n'), ((688, 739), 'os.makedirs', 'os.makedirs', (['combined_model_name_dir'], {'exist_ok': '(True)'}... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 CERN.
#
# invenio-app-ils is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Facets tests."""
from __future__ import absolute_import, print_function
from elasticsearch_dsl.query import R... | [
"invenio_app_ils.facets.keyed_range_filter",
"elasticsearch_dsl.query.Range"
] | [((534, 574), 'invenio_app_ils.facets.keyed_range_filter', 'keyed_range_filter', (['"""field"""', 'range_query'], {}), "('field', range_query)\n", (552, 574), False, 'from invenio_app_ils.facets import keyed_range_filter\n'), ((608, 630), 'elasticsearch_dsl.query.Range', 'Range', ([], {'field': "{'lt': 1}"}), "(field={... |
"""Data related commands to use on the command-line."""
import os
import click
from flask import current_app
from flask.cli import with_appcontext
from invenio_db import db
from invenio_files_rest.models import Location
def load_locations(force=False):
"""
Load default file store and archive location.
... | [
"invenio_db.db.session.add",
"invenio_files_rest.models.Location",
"os.makedirs",
"invenio_files_rest.models.Location.query.filter_by",
"os.path.exists",
"invenio_db.db.session.commit",
"invenio_db.db.session.rollback",
"click.group",
"os.path.join"
] | [((1380, 1393), 'click.group', 'click.group', ([], {}), '()\n', (1391, 1393), False, 'import click\n'), ((515, 606), 'os.path.join', 'os.path.join', (['current_app.instance_path', "current_app.config['FIXTURES_FILES_LOCATION']"], {}), "(current_app.instance_path, current_app.config[\n 'FIXTURES_FILES_LOCATION'])\n",... |
""" rest subsystem's configuration
- config-file schema
- settings
"""
import trafaret as T
from servicelib.application_keys import APP_OPENAPI_SPECS_KEY
APP_OPENAPI_SPECS_KEY = APP_OPENAPI_SPECS_KEY
CONFIG_SECTION_NAME = 'rest'
schema = T.Dict({
"version": T.Enum("v0"),
"location": T.Or(T.String, ... | [
"trafaret.List",
"trafaret.String",
"trafaret.Enum",
"trafaret.Key",
"trafaret.Or"
] | [((438, 472), 'trafaret.Key', 'T.Key', (['"""extra_urls"""'], {'optional': '(True)'}), "('extra_urls', optional=True)\n", (443, 472), True, 'import trafaret as T\n'), ((275, 287), 'trafaret.Enum', 'T.Enum', (['"""v0"""'], {}), "('v0')\n", (281, 287), True, 'import trafaret as T\n'), ((305, 326), 'trafaret.Or', 'T.Or', ... |
import itertools
import os
import warnings
import cv2
import matplotlib; matplotlib.use('agg')
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from PIL import Image
from sklearn import metrics
import resnet
... | [
"warnings.filterwarnings",
"torch.load",
"PIL.Image.open",
"matplotlib.use",
"matplotlib.pyplot.rc",
"torch.no_grad"
] | [((74, 95), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (88, 95), False, 'import matplotlib\n'), ((383, 416), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (406, 416), False, 'import warnings\n'), ((417, 457), 'matplotlib.pyplot.rc', 'plt.rc', ([... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import os
from config import basedir
from flask_bootstrap import Bootstrap
from flask_login import LoginManager
app = Flask(__name__, static_url_path='/static')
db = SQLAlchemy(app)
bootstrap = Bootstrap(app)
login_manager = LoginManager(app)
login_manag... | [
"flask_sqlalchemy.SQLAlchemy",
"flask_login.LoginManager",
"flask.Flask",
"flask_bootstrap.Bootstrap"
] | [((184, 226), 'flask.Flask', 'Flask', (['__name__'], {'static_url_path': '"""/static"""'}), "(__name__, static_url_path='/static')\n", (189, 226), False, 'from flask import Flask\n'), ((232, 247), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (242, 247), False, 'from flask_sqlalchemy import SQL... |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | [
"polyaxon.env_vars.getters.user.get_local_owner",
"polyaxon.utils.string_utils.validate_slug",
"polyaxon.utils.formatting.Printer.print_error",
"polyaxon.exceptions.PolyaxonClientException",
"sys.exit"
] | [((2004, 2034), 'polyaxon.env_vars.getters.user.get_local_owner', 'get_local_owner', ([], {'is_cli': 'is_cli'}), '(is_cli=is_cli)\n', (2019, 2034), False, 'from polyaxon.env_vars.getters.user import get_local_owner\n'), ((1800, 1828), 'polyaxon.utils.formatting.Printer.print_error', 'Printer.print_error', (['message'],... |
import json
import sys
from typing import cast, Dict, List, Union
import looker_sdk
from looker_sdk import models, error
import sdk_exceptions
sdk = looker_sdk.init31("../../looker.ini")
def main() -> None:
"""Given a look id, obtain the query behind it and run it with the desired
filter values.
http... | [
"sdk_exceptions.RunInlineQueryError",
"looker_sdk.init31",
"json.loads",
"sdk_exceptions.NotFoundError",
"sdk_exceptions.ArgumentError",
"looker_sdk.models.WriteQuery"
] | [((152, 189), 'looker_sdk.init31', 'looker_sdk.init31', (['"""../../looker.ini"""'], {}), "('../../looker.ini')\n", (169, 189), False, 'import looker_sdk\n'), ((2244, 2571), 'looker_sdk.models.WriteQuery', 'models.WriteQuery', ([], {'model': 'q.model', 'view': 'q.view', 'fields': 'q.fields', 'pivots': 'q.pivots', 'fill... |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Eltex.MA4000.get_inventory
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# -----------------------------------------------------... | [
"noc.core.text.parse_table",
"re.compile"
] | [((633, 767), 're.compile', 're.compile', (['"""^\\\\s*Module type:\\\\s+(?P<part_no>\\\\S+)\\\\s*\\\\n^\\\\s*Hardware version:\\\\s+(?P<revision>\\\\S+)\\\\s*\\\\n"""', 're.MULTILINE'], {}), "(\n '^\\\\s*Module type:\\\\s+(?P<part_no>\\\\S+)\\\\s*\\\\n^\\\\s*Hardware version:\\\\s+(?P<revision>\\\\S+)\\\\s*\\\\n'\n... |
import os
import unittest
import subprocess
class TestPullRequest(unittest.TestCase):
def test_branch_missing(self):
ENV = os.environ.copy()
CMD = [
"python3",
"./bleach/__main__.py",
"shesekino",
"bleach",
"branch",
"test-branch-discrepa... | [
"os.environ.copy",
"subprocess.check_output"
] | [((137, 154), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (152, 154), False, 'import os\n'), ((396, 458), 'subprocess.check_output', 'subprocess.check_output', (['CMD'], {'stdin': 'None', 'stderr': 'None', 'env': 'ENV'}), '(CMD, stdin=None, stderr=None, env=ENV)\n', (419, 458), False, 'import subprocess\n')... |
# -*- coding: utf-8 -*-
import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
from kouzi_crawler.items import KouziCrawlerItem
class QzkeySpider(CrawlSpider):
name = 'qzkey'
allowed_domains = ['qzkey.com']
start_urls = ['http://mimi1688.aly611.qzkey.com/... | [
"scrapy.linkextractors.LinkExtractor",
"kouzi_crawler.items.KouziCrawlerItem"
] | [((351, 400), 'scrapy.linkextractors.LinkExtractor', 'LinkExtractor', ([], {'allow': '"""Product.aspx\\\\?typeid=\\\\d+"""'}), "(allow='Product.aspx\\\\?typeid=\\\\d+')\n", (364, 400), False, 'from scrapy.linkextractors import LinkExtractor\n'), ((691, 709), 'kouzi_crawler.items.KouziCrawlerItem', 'KouziCrawlerItem', (... |
import unittest
from find_password import find_password
class TestFindPassword(unittest.TestCase):
def test_find_password(self):
assert find_password('abc') == '<PASSWORD>'
assert find_password('abc', complex=True) == '<PASSWORD>'
| [
"find_password.find_password"
] | [((151, 171), 'find_password.find_password', 'find_password', (['"""abc"""'], {}), "('abc')\n", (164, 171), False, 'from find_password import find_password\n'), ((203, 237), 'find_password.find_password', 'find_password', (['"""abc"""'], {'complex': '(True)'}), "('abc', complex=True)\n", (216, 237), False, 'from find_p... |
#!/usr/bin/env python 3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 PanXu, Inc. All Rights Reserved
#
"""
acsa label decoder
Authors: PanXu
Date: 2020/07/18 18:14:00
"""
from typing import List
import torch
from easytext.data import LabelVocabulary
from easytext.label_decoder import ModelLabelDecoder
from eas... | [
"easytext.label_decoder.MaxLabelIndexDecoder"
] | [((585, 607), 'easytext.label_decoder.MaxLabelIndexDecoder', 'MaxLabelIndexDecoder', ([], {}), '()\n', (605, 607), False, 'from easytext.label_decoder import MaxLabelIndexDecoder\n')] |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 31 22:04:01 2021
@author: Julien
https://en.wikipedia.org/wiki/Sierpi%C5%84ski_triangle
"""
# _____ _
# |_ _| | |
# | | _ __ ___ _ __ ___ _ __| |_ ___
# | | | '_ ` _ \| '_ \ / _ \|... | [
"numpy.exp",
"numpy.sin",
"matplotlib.pyplot.show",
"matplotlib.pyplot.axis"
] | [((4143, 4160), 'matplotlib.pyplot.axis', 'plt.axis', (['"""equal"""'], {}), "('equal')\n", (4151, 4160), True, 'import matplotlib.pyplot as plt\n'), ((4166, 4176), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (4174, 4176), True, 'import matplotlib.pyplot as plt\n'), ((873, 890), 'numpy.sin', 'np.sin', (['(n... |
from typing import Final
import pytest
from dags.out_of_stock_elt.authorizer import Authorizer
from dags.out_of_stock_elt.errors import GatherFailed
from dags.out_of_stock_elt.gatherer import ProductGatherer
_TESTED_DATE: Final = "2021-01-02"
_EXPECTED_PRODUCT_ID: Final = 1
_TIMEOUT: Final = 30.0
_EXPECTED_RESULT:... | [
"pytest.raises",
"dags.out_of_stock_elt.authorizer.Authorizer"
] | [((753, 793), 'dags.out_of_stock_elt.authorizer.Authorizer', 'Authorizer', (['auth_url', 'username', 'password'], {}), '(auth_url, username, password)\n', (763, 793), False, 'from dags.out_of_stock_elt.authorizer import Authorizer\n'), ((1180, 1207), 'pytest.raises', 'pytest.raises', (['GatherFailed'], {}), '(GatherFai... |
"""
BCI2000RawIO is a class to read BCI2000 .dat files.
https://www.bci2000.org/mediawiki/index.php/Technical_Reference:BCI2000_File_Format
"""
from .baserawio import (BaseRawIO, _signal_channel_dtype, _signal_stream_dtype,
_spike_channel_dtype, _event_channel_dtype)
import numpy as np
import re
try... | [
"numpy.pad",
"numpy.right_shift",
"numpy.ceil",
"numpy.logical_and",
"os.stat",
"numpy.char.mod",
"numpy.dtype",
"numpy.ones",
"re.match",
"numpy.isnan",
"re.findall",
"numpy.arange",
"numpy.array",
"urllib.url2pathname",
"numpy.diff",
"numpy.memmap",
"time.strptime"
] | [((1063, 1119), 'numpy.array', 'np.array', (["[('Signals', '0')]"], {'dtype': '_signal_stream_dtype'}), "([('Signals', '0')], dtype=_signal_stream_dtype)\n", (1071, 1119), True, 'import numpy as np\n'), ((2336, 2387), 'numpy.array', 'np.array', (['sig_channels'], {'dtype': '_signal_channel_dtype'}), '(sig_channels, dty... |
import unittest
from jsonschema import ValidationError
from mobie.validation.utils import validate_with_schema
class TestSourceMetadata(unittest.TestCase):
def test_image_source(self):
from mobie.metadata import get_image_metadata
ds_folder = "/path"
xml_path = "/path/to/bdv.xml"
... | [
"unittest.main",
"mobie.metadata.get_image_metadata",
"mobie.metadata.get_segmentation_metadata",
"mobie.validation.utils.validate_with_schema"
] | [((5135, 5150), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5148, 5150), False, 'import unittest\n'), ((351, 412), 'mobie.metadata.get_image_metadata', 'get_image_metadata', (['ds_folder', 'xml_path'], {'file_format': '"""bdv.n5"""'}), "(ds_folder, xml_path, file_format='bdv.n5')\n", (369, 412), False, 'from m... |
# coding: utf-8
# In[21]:
import nltk
import re
import string
from nltk.stem import PorterStemmer
from nltk.corpus import stopwords
from collections import defaultdict
import random
# In[22]:
def preprocessing(line, negative_contruct:list, smile_positive:list, smile_negative:list, ps:'Porter Stemmer', stop_word... | [
"nltk.stem.PorterStemmer",
"random.shuffle",
"collections.defaultdict",
"nltk.corpus.stopwords.words",
"re.sub"
] | [((2277, 2292), 'nltk.stem.PorterStemmer', 'PorterStemmer', ([], {}), '()\n', (2290, 2292), False, 'from nltk.stem import PorterStemmer\n'), ((340, 368), 're.sub', 're.sub', (['"""http\\\\S+"""', '""""""', 'line'], {}), "('http\\\\S+', '', line)\n", (346, 368), False, 'import re\n'), ((394, 422), 're.sub', 're.sub', ([... |
import tensorflow as tf
import numpy as np
from .layers import *
from .support import visualize_images
from .global_definitions import *
def apply_gradient_descent(var_list, obj):
"""
Sets up the gradient descent optimizer
Args:
var_list: List of variables to optimizer over.
obj: N... | [
"tensorflow.nn.l2_loss",
"tensorflow.abs",
"tensorflow.summary.image",
"tensorflow.summary.scalar",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.get_collection",
"tensorflow.argmax",
"tensorflow.train.RMSPropOptimizer",
"tensorflow.add_to_collection",
"tensorflow.variable_scope",... | [((3886, 3937), 'tensorflow.add_to_collection', 'tf.add_to_collection', (['"""trainable_params"""', 'params[0]'], {}), "('trainable_params', params[0])\n", (3906, 3937), True, 'import tensorflow as tf\n'), ((3943, 3994), 'tensorflow.add_to_collection', 'tf.add_to_collection', (['"""trainable_params"""', 'params[1]'], {... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-11-24 11:16
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import jsonfield.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... | [
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.BooleanField",
"django.db.models.AutoField"
] | [((423, 516), '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", (439, 516), False, 'from django.db import migrations, models\... |
from time import sleep
from fastapi import FastAPI
from pydantic import BaseModel
from datetime import datetime,date
from producer import produceKafka
import json
mensagem = {"mensagem":"",
"payload": [],
"id":0,
"status":""}
app = FastAPI()
class Pedido(BaseModel):
i... | [
"datetime.datetime.now",
"json.dumps",
"fastapi.FastAPI"
] | [((278, 287), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (285, 287), False, 'from fastapi import FastAPI\n'), ((855, 882), 'json.dumps', 'json.dumps', (['pedido.__dict__'], {}), '(pedido.__dict__)\n', (865, 882), False, 'import json\n'), ((762, 776), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (774,... |
# python3
#coding:utf-8
import requests
from bs4 import BeautifulSoup
def downloadPic(url):
req = requests.get(url)
imageName = url.split('/')[-1]
with open(imageName, 'wb') as fp:
fp.write(req.content)
html = requests.get("http://tieba.baidu.com/p/2166231880").content
soup = BeautifulSoup(html, "... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((299, 333), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (312, 333), False, 'from bs4 import BeautifulSoup\n'), ((103, 120), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (115, 120), False, 'import requests\n'), ((232, 283), 'requests.get', 'request... |
import pyone
import configparser
import os
import time
class one_interface(object):
def __init__(self):
self.config = None
self.client = None
self.root_public_key = None
self.template = None
self.template_id = None
self.cluster_vm_ids = []
self.cluster_vm_ip... | [
"pyone.OneServer",
"time.sleep",
"time.time",
"os.path.isfile",
"configparser.ConfigParser"
] | [((440, 467), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (465, 467), False, 'import configparser\n'), ((798, 850), 'pyone.OneServer', 'pyone.OneServer', (['endpoint'], {'session': "(uname + ':' + pwd)"}), "(endpoint, session=uname + ':' + pwd)\n", (813, 850), False, 'import pyone\n'), (... |
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# 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 applicab... | [
"absl.testing.absltest.main",
"ipagnn.lib.config_utils.save_config",
"ipagnn.lib.config_utils.load_config",
"ipagnn.config.config.get_config",
"tempfile.mkdtemp",
"ipagnn.lib.config_utils.equals",
"os.path.join"
] | [((1784, 1799), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (1797, 1799), False, 'from absl.testing import absltest\n'), ((957, 975), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (973, 975), False, 'import tempfile\n'), ((991, 1027), 'os.path.join', 'os.path.join', (['tempdir', '"""con... |
from tensorboardX import SummaryWriter
with SummaryWriter() as w:
# https://download.01.org/opencv/2019/open_model_zoo/R3/20190905_163000_models_bin/mobilenetv2-int8-sparse-v1-tf-0001/FP32/mobilenetv2-int8-sparse-v1-tf-0001.xml
w.add_openvino_graph('examples/mobilenetv2.xml')
| [
"tensorboardX.SummaryWriter"
] | [((44, 59), 'tensorboardX.SummaryWriter', 'SummaryWriter', ([], {}), '()\n', (57, 59), False, 'from tensorboardX import SummaryWriter\n')] |
# start_scheduler_marker_0
import csv
from datetime import datetime
import requests
from dagster import get_dagster_logger, job, op, repository, schedule
@op
def hello_cereal(context):
response = requests.get("https://docs.dagster.io/assets/cereal.csv")
lines = response.text.split("\n")
cereals = [row fo... | [
"dagster.get_dagster_logger",
"datetime.datetime.today",
"csv.DictReader",
"dagster.schedule",
"requests.get"
] | [((590, 685), 'dagster.schedule', 'schedule', ([], {'cron_schedule': '"""45 6 * * *"""', 'job': 'hello_cereal_job', 'execution_timezone': '"""US/Central"""'}), "(cron_schedule='45 6 * * *', job=hello_cereal_job,\n execution_timezone='US/Central')\n", (598, 685), False, 'from dagster import get_dagster_logger, job, o... |
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import os
import matplotlib.patches as patches
import pickle
import math
import corepytools as corepy
import json
CoreOfStudy = 'Public'
Corebeta=json.load(open(os.path.join(CoreOfStudy + '.json')))
Formation_names = '-'.join(Corebeta["Formati... | [
"os.path.join",
"matplotlib.patches.Rectangle",
"corepytools.RootDir",
"PIL.Image.open",
"numpy.shape",
"pickle.load",
"corepytools.OutputXRF",
"numpy.array",
"os.path.splitext",
"matplotlib.pyplot.subplots",
"os.listdir"
] | [((531, 550), 'pickle.load', 'pickle.load', (['infile'], {}), '(infile)\n', (542, 550), False, 'import pickle\n'), ((598, 653), 'corepytools.OutputXRF', 'corepy.OutputXRF', (["Corebeta['corename']", 'Formation_names'], {}), "(Corebeta['corename'], Formation_names)\n", (614, 653), True, 'import corepytools as corepy\n')... |
# -*- coding: UTF-8 -*-
import logging
import traceback
import simplejson as json
from django.http import HttpResponse
from common.utils.permission import superuser_required
from sql.models import Config
from django.db import transaction
from django.core.cache import cache
logger = logging.getLogger('default')
cla... | [
"sql.models.Config.objects.get_or_create",
"sql.models.Config",
"simplejson.dumps",
"django.core.cache.cache.get",
"django.core.cache.cache.add",
"django.core.cache.cache.delete",
"traceback.format_exc",
"simplejson.loads",
"django.db.transaction.atomic",
"logging.getLogger",
"sql.models.Config.... | [((286, 314), 'logging.getLogger', 'logging.getLogger', (['"""default"""'], {}), "('default')\n", (303, 314), False, 'import logging\n'), ((1983, 2021), 'sql.models.Config.objects.get_or_create', 'Config.objects.get_or_create', ([], {'item': 'key'}), '(item=key)\n', (2011, 2021), False, 'from sql.models import Config\n... |
# -*- coding: utf-8 -*-
#
# Copyright 2018 Huawei Technologies Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | [
"openstack.load_balancer.load_balancer_service.LoadBalancerService",
"openstack.resource2.QueryParameters",
"openstack.resource2.Body",
"openstack.resource2.URI",
"openstack.utils.urljoin"
] | [((862, 894), 'openstack.load_balancer.load_balancer_service.LoadBalancerService', 'lb_service.LoadBalancerService', ([], {}), '()\n', (892, 894), True, 'from openstack.load_balancer import load_balancer_service as lb_service\n'), ((1052, 1361), 'openstack.resource2.QueryParameters', 'resource.QueryParameters', (['"""i... |
#%%
#Import packages
import numpy as np
import pandas as pd
import os
import mlxtend
import seaborn as sns
import matplotlib.pyplot as plt
import math
import scipy.stats as stats
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_sc... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"pandas.crosstab",
"seaborn.heatmap",
"pandas.read_csv",
"statsmodels.stats.weightstats.ztest",
"matplotlib.pyplot.violinplot",
"numpy.ndarray.tolist",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots"
] | [((8463, 8522), 'pandas.read_csv', 'pd.read_csv', (['"""diabetes_012_health_indicators_BRFSS2015.csv"""'], {}), "('diabetes_012_health_indicators_BRFSS2015.csv')\n", (8474, 8522), True, 'import pandas as pd\n'), ((1488, 1510), 'numpy.ndarray.tolist', 'np.ndarray.tolist', (['pos'], {}), '(pos)\n', (1505, 1510), True, 'i... |
from asciimatics.screen import Screen
from momba import engine
from . import model
def game(screen):
explorer = engine.Explorer.new_discrete_time(model.network)
(state,) = explorer.initial_states
while True:
player = model.Cell(
state.global_env["pos_x"].as_int, state.global_env["p... | [
"asciimatics.screen.Screen.wrapper",
"momba.engine.Explorer.new_discrete_time"
] | [((1903, 1923), 'asciimatics.screen.Screen.wrapper', 'Screen.wrapper', (['game'], {}), '(game)\n', (1917, 1923), False, 'from asciimatics.screen import Screen\n'), ((120, 168), 'momba.engine.Explorer.new_discrete_time', 'engine.Explorer.new_discrete_time', (['model.network'], {}), '(model.network)\n', (153, 168), False... |
# Copyright 2014: Mirantis 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... | [
"rally.benchmark.context.tempest.Tempest",
"rally.exceptions.TempestSetupFailure",
"mock.patch",
"rally.exceptions.TempestConfigCreationFailure",
"subprocess.CalledProcessError",
"mock.MagicMock"
] | [((1119, 1152), 'mock.patch', 'mock.patch', (["(CONTEXT + '.os.mkdir')"], {}), "(CONTEXT + '.os.mkdir')\n", (1129, 1152), False, 'import mock\n'), ((1158, 1211), 'mock.patch', 'mock.patch', (["(TEMPEST + '.Tempest.generate_config_file')"], {}), "(TEMPEST + '.Tempest.generate_config_file')\n", (1168, 1211), False, 'impo... |
__author__ = 'dlgltlzed'
import unittest
from ShiftParser import ShiftParser
import json
class TestMethods(unittest.TestCase):
def test_main(self):
"""
Creates tokens from an input
"""
with open("testInput.txt") as input, open("testInput.txt.tokens.json") as output:
se... | [
"unittest.main",
"os.remove",
"subprocess.call"
] | [((1338, 1353), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1351, 1353), False, 'import unittest\n'), ((966, 1060), 'subprocess.call', 'subprocess.call', (['"""python ShiftParser.py testInput.txt testInput_test_command.tokens.json"""'], {}), "(\n 'python ShiftParser.py testInput.txt testInput_test_command.t... |
# Copyright 2016 - Nokia
#
# 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, sof... | [
"vitrage.evaluator.actions.action_executor.ActionExecutor",
"six.moves.queue.Queue",
"oslo_config.cfg.ConfigOpts",
"vitrage.evaluator.template_data.ActionSpecs",
"vitrage.opts.register_opts"
] | [((2526, 2542), 'oslo_config.cfg.ConfigOpts', 'cfg.ConfigOpts', ([], {}), '()\n', (2540, 2542), False, 'from oslo_config import cfg\n'), ((2912, 2925), 'six.moves.queue.Queue', 'queue.Queue', ([], {}), '()\n', (2923, 2925), False, 'from six.moves import queue\n'), ((3575, 3627), 'vitrage.evaluator.template_data.ActionS... |
import torch
import torchvision.models as models
from torchsummary import summary
import numpy as np
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from torch.utils.data.dataset import Dataset
from torchvision import transforms
from PIL import Image
import os
from torch.optim.... | [
"os.remove",
"torch.optim.lr_scheduler.StepLR",
"argparse.ArgumentParser",
"random.sample",
"os.walk",
"matplotlib.pyplot.figure",
"torchvision.transforms.Normalize",
"torch.no_grad",
"os.path.join",
"torch.utils.data.DataLoader",
"torch.nn.Linear",
"sklearn.metrics.average_precision_score",
... | [((545, 608), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""alexnet.log"""', 'level': 'logging.INFO'}), "(filename='alexnet.log', level=logging.INFO)\n", (564, 608), False, 'import logging\n'), ((619, 665), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""AlexNet"""'}... |
#!/usr/bin/env python3
'''
Imagine an accounting routine used in a book shop. It works on a list with sublists, which look like this:
# Order Number Book Title and Author Quantity Price per Item
# 34587 Learning Python, <NAME> 4 40.95
# 98762 Programming Python, <NAME> 5 56.80
# 77226 Head First Python, <NAME> 3 32.... | [
"functools.reduce"
] | [((1985, 2018), 'functools.reduce', 'reduce', (['(lambda a, b: a + b)', 'x[1:]'], {}), '(lambda a, b: a + b, x[1:])\n', (1991, 2018), False, 'from functools import reduce\n')] |
# Generated by Django 3.1.2 on 2020-10-15 00:52
from django.db import migrations
def add_choose_permission_to_admin_groups(apps, _schema_editor):
ContentType = apps.get_model('contenttypes.ContentType')
Permission = apps.get_model('auth.Permission')
Group = apps.get_model('auth.Group')
# Get documen... | [
"django.db.migrations.RunPython",
"django.db.migrations.AlterModelOptions"
] | [((3149, 3338), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""document"""', 'options': "{'permissions': [('choose_document', 'Can choose document')],\n 'verbose_name': 'document', 'verbose_name_plural': 'documents'}"}), "(name='document', options={'permissions': [(\n ... |
import unittest
import torch
from torch import nn
from fluence.optim import Lamb, Lookahead
class Test_Optim(unittest.TestCase):
def test_lookahead(self):
model = nn.Linear(8, 8)
base_optim = torch.optim.Adam(model.parameters())
optim = Lookahead(base_optim, k=5, alpha=0.8)
output... | [
"unittest.main",
"fluence.optim.Lookahead",
"torch.rand",
"torch.nn.Linear"
] | [((578, 593), 'unittest.main', 'unittest.main', ([], {}), '()\n', (591, 593), False, 'import unittest\n'), ((178, 193), 'torch.nn.Linear', 'nn.Linear', (['(8)', '(8)'], {}), '(8, 8)\n', (187, 193), False, 'from torch import nn\n'), ((268, 305), 'fluence.optim.Lookahead', 'Lookahead', (['base_optim'], {'k': '(5)', 'alph... |
import pandas as pd
import numpy as np
import pyspark
# import mysql.connector
# from pymongo import MongoClient
from datetime import datetime, date
# need to import to use pyspark
from pyspark.sql import Row
# need to import for session creation
from pyspark.sql import SparkSession
# creating the session
sp... | [
"datetime.datetime",
"datetime.date",
"pyspark.sql.SparkSession.builder.getOrCreate"
] | [((326, 360), 'pyspark.sql.SparkSession.builder.getOrCreate', 'SparkSession.builder.getOrCreate', ([], {}), '()\n', (358, 360), False, 'from pyspark.sql import SparkSession\n'), ((458, 474), 'datetime.date', 'date', (['(2000)', '(8)', '(1)'], {}), '(2000, 8, 1)\n', (462, 474), False, 'from datetime import datetime, dat... |
import os.path as osp
from copy import deepcopy
import torch
from mmcv.runner import HOOKS, Hook
from mmcv.runner.checkpoint import save_checkpoint
from mmcv.runner.log_buffer import LogBuffer
from mmdet.core import DistEvalHook, EvalHook
@HOOKS.register_module()
class SWAHook(Hook):
r"""SWA Object Detection Ho... | [
"copy.deepcopy",
"os.path.join",
"mmcv.runner.checkpoint.save_checkpoint",
"mmcv.runner.HOOKS.register_module",
"mmcv.runner.log_buffer.LogBuffer",
"torch.tensor"
] | [((244, 267), 'mmcv.runner.HOOKS.register_module', 'HOOKS.register_module', ([], {}), '()\n', (265, 267), False, 'from mmcv.runner import HOOKS, Hook\n'), ((1974, 1985), 'mmcv.runner.log_buffer.LogBuffer', 'LogBuffer', ([], {}), '()\n', (1983, 1985), False, 'from mmcv.runner.log_buffer import LogBuffer\n'), ((4711, 472... |
#!/usr/bin/python
from RedisQueue import RedisQueue
import subprocess
import json
import base64
q = RedisQueue('messages', namespace='ansible', host='localhost', port=6379, db=1)
while True:
res = q.get()
message = json.loads(res)
subprocess.Popen(["/home/ubuntu/ansible-bot/message_bridge/run_ansible_controller.sh... | [
"RedisQueue.RedisQueue",
"base64.b64encode",
"json.loads"
] | [((101, 179), 'RedisQueue.RedisQueue', 'RedisQueue', (['"""messages"""'], {'namespace': '"""ansible"""', 'host': '"""localhost"""', 'port': '(6379)', 'db': '(1)'}), "('messages', namespace='ansible', host='localhost', port=6379, db=1)\n", (111, 179), False, 'from RedisQueue import RedisQueue\n'), ((219, 234), 'json.loa... |
# -*- coding: utf-8 -*-
"""
Wrapper class for Bluetooth LE data from collectors
"""
import re
from time import time as _time
from datetime import datetime as _dt
from datetime import timezone as _tz
from .ruuvitag_misc import hex_string
class BLEData(object):
"""A simple wrapper class representing a BLE data from ... | [
"time.time",
"re.compile"
] | [((547, 655), 're.compile', 're.compile', (['"""(\n ^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$\n )"""', '(re.VERBOSE | re.IGNORECASE)'], {}), '("""(\n ^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$\n )""",\n re.VERBOSE | re.IGNORECASE)\n', (557, 655), False, 'import re\n'), ((926, 933), 'time.time', ... |
from azureml.core.run import Run
import os
import argparse
from sklearn.datasets import load_diabetes
from sklearn.linear_model import Ridge
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split
from sklearn.externals import joblib
parser = argparse.ArgumentParser("train"... | [
"sklearn.externals.joblib.dump",
"argparse.ArgumentParser",
"os.getcwd",
"sklearn.model_selection.train_test_split",
"azureml.core.run.Run.get_context",
"sklearn.datasets.load_diabetes",
"sklearn.metrics.mean_squared_error",
"sklearn.linear_model.Ridge"
] | [((289, 321), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""train"""'], {}), "('train')\n", (312, 321), False, 'import argparse\n'), ((965, 982), 'azureml.core.run.Run.get_context', 'Run.get_context', ([], {}), '()\n', (980, 982), False, 'from azureml.core.run import Run\n'), ((1042, 1072), 'sklearn.datas... |
# @author : <NAME>
import os
import json
import numpy as np
import tensorflow as tf
IMAGENET_MEAN = np.array([103.939, 116.779, 123.68]).reshape(1, 3)
# read the json file and return the content
def read_config_file(json_file_name):
# open and read the json file
config = json.load(open(json_file_name))
... | [
"os.makedirs",
"os.path.exists",
"tensorflow.concat",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.transpose",
"tensorflow.image.decode_png",
"tensorflow.cast",
"numpy.array",
"tensorflow.squeeze",
"tensorflow.read_file",
"tensorflow.split"
] | [((601, 623), 'tensorflow.read_file', 'tf.read_file', (['img_name'], {}), '(img_name)\n', (613, 623), True, 'import tensorflow as tf\n'), ((641, 663), 'tensorflow.read_file', 'tf.read_file', (['lbl_name'], {}), '(lbl_name)\n', (653, 663), True, 'import tensorflow as tf\n'), ((688, 731), 'tensorflow.image.decode_png', '... |
#!/usr/bin/env python3
__author__ = "Visual Studio"
__description__ = "A script to extract XDKRecoveryXenonXXXXX.exe and XDKSetupXenonXXXXX.exe files"
__platforms__ = ["Windows", "Linux", "macOS"]
from ctypes import *
from os import mkdir
from argparse import ArgumentParser
from os.path import join, isfile, isdir
DO... | [
"os.mkdir",
"argparse.ArgumentParser",
"os.path.isdir",
"os.path.isfile",
"os.path.join"
] | [((4020, 4148), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""A script to extract XDKRecoveryXenonXXXXX.X(X).exe and XDKSetupXenonXXXXX.X(X).exe files"""'}), "(description=\n 'A script to extract XDKRecoveryXenonXXXXX.X(X).exe and XDKSetupXenonXXXXX.X(X).exe files'\n )\n", (4034, 4148), Fa... |
from guardian.shortcuts import get_perms
import pytest
async def get_collaborators(page):
"""Return the list of collaborator emails."""
rows = await page.xpath(
'//div[contains(.,"Collaborators")]'
'/../following-sibling::div/div[contains(@class, "v-avatar")]'
)
return [(await page.eva... | [
"guardian.shortcuts.get_perms"
] | [((4692, 4724), 'guardian.shortcuts.get_perms', 'get_perms', (['collaborator', 'project'], {}), '(collaborator, project)\n', (4701, 4724), False, 'from guardian.shortcuts import get_perms\n'), ((4756, 4787), 'guardian.shortcuts.get_perms', 'get_perms', (['tier_1_user', 'project'], {}), '(tier_1_user, project)\n', (4765... |
from __future__ import division
import collections
import gzip
import itertools
from cdec.sa._sa import gzip_or_text
# Same as Cython implementation. Collisions with NULL in bitext?
NULL_WORD = 'NULL'
def learn_vocab(text_f):
vocab = set()
for line in gzip_or_text(text_f):
for word in line.strip().... | [
"collections.defaultdict",
"cdec.sa._sa.gzip_or_text",
"gzip.open"
] | [((265, 285), 'cdec.sa._sa.gzip_or_text', 'gzip_or_text', (['text_f'], {}), '(text_f)\n', (277, 285), False, 'from cdec.sa._sa import gzip_or_text\n'), ((415, 437), 'gzip.open', 'gzip.open', (['out_f', '"""wb"""'], {}), "(out_f, 'wb')\n", (424, 437), False, 'import gzip\n'), ((674, 702), 'collections.defaultdict', 'col... |
"""
Author: <NAME> (<EMAIL>)
Description: This class is simply responsible for determining the nearest neighboring images of an image
"""
import helpers
import logging
import tensorflow as tf
FLAGS = tf.flags.FLAGS
class Neighbor:
def __init__(self, input_encoding, training_encodings, training_filenames... | [
"tensorflow.gather",
"logging.info",
"tensorflow.nn.top_k",
"helpers.get_cosine_similarity"
] | [((331, 390), 'logging.info', 'logging.info', (['"""New \'Neighbor\' instance has be initialized."""'], {}), '("New \'Neighbor\' instance has be initialized.")\n', (343, 390), False, 'import logging\n'), ((505, 570), 'helpers.get_cosine_similarity', 'helpers.get_cosine_similarity', (['input_encoding', 'training_encodin... |
from __future__ import annotations
from math import cos, sin
import xml.etree.ElementTree as ET
class Figure(object):
def __init__(self, type_, attributes=None):
self.type_ = type_
self.attributes = attributes if attributes else dict()
self.children = []
def __sub_element__(self, pa... | [
"math.cos",
"math.sin",
"xml.etree.ElementTree.SubElement"
] | [((448, 487), 'xml.etree.ElementTree.SubElement', 'ET.SubElement', (['parent', 'self.type_', 'attr'], {}), '(parent, self.type_, attr)\n', (461, 487), True, 'import xml.etree.ElementTree as ET\n'), ((12117, 12127), 'math.cos', 'cos', (['angle'], {}), '(angle)\n', (12120, 12127), False, 'from math import cos, sin\n'), (... |
"""
Unit and regression test for the quentem_mechenex package.
"""
# Import package, test suite, and other packages as needed
import quentem_mechenex as qm
import pytest
import sys
import numpy as np
@pytest.fixture()
def noble_gas_instance():
noble_gas_instance = qm.NobleGasModel()
return noble_gas_instance
... | [
"quentem_mechenex.NobleGasModel",
"quentem_mechenex.HartreeFock",
"pytest.fixture",
"numpy.isclose",
"numpy.array"
] | [((203, 219), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (217, 219), False, 'import pytest\n'), ((322, 338), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (336, 338), False, 'import pytest\n'), ((271, 289), 'quentem_mechenex.NobleGasModel', 'qm.NobleGasModel', ([], {}), '()\n', (287, 289), True, 'imp... |
"""
Copyright 2020 InfAI (CC SES)
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... | [
"cc_lib.logger.getLogger",
"urllib3.disable_warnings"
] | [((663, 730), 'urllib3.disable_warnings', 'urllib3.disable_warnings', (['urllib3.exceptions.InsecureRequestWarning'], {}), '(urllib3.exceptions.InsecureRequestWarning)\n', (687, 730), False, 'import logging, cc_lib, urllib3\n'), ((917, 949), 'cc_lib.logger.getLogger', 'cc_lib.logger.getLogger', (['"""dyson"""'], {}), "... |
# ---------------------------------------------------------------------
# Nateks.NetXpert.get_version
# ---------------------------------------------------------------------
# Copyright (C) 2007-2016 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Pyt... | [
"re.compile"
] | [((583, 689), 're.compile', 're.compile', (['""".*Series Software, Version (?P<version>[\\\\S\\\\s]*)\\\\, RELEASE SOFTWARE"""', 're.MULTILINE'], {}), "(\n '.*Series Software, Version (?P<version>[\\\\S\\\\s]*)\\\\, RELEASE SOFTWARE',\n re.MULTILINE)\n", (593, 689), False, 'import re\n'), ((707, 806), 're.compile... |
#!/usr/bin/env python3
import numpy as np
from src.classifiers.digit.cnn import DigitClassifier
from src.classifiers.speech.mlp import SpeechClassifier
from src.classifiers.word.cnn import WordClassifier
from src.sound.SoundRecorder import SoundRecorder
from src.VoiceModule import VoiceModule
from src.classifiers.gen... | [
"src.sound.SoundRecorder.SoundRecorder",
"src.classifiers.word.cnn.WordClassifier",
"src.VoiceModule.VoiceModule",
"sounddevice.play",
"src.classifiers.gender.cnn_44kHz.GenderClassifier",
"numpy.squeeze"
] | [((442, 477), 'src.sound.SoundRecorder.SoundRecorder', 'SoundRecorder', ([], {'default_duration': '(1.5)'}), '(default_duration=1.5)\n', (455, 477), False, 'from src.sound.SoundRecorder import SoundRecorder\n'), ((543, 553), 'sounddevice.play', 'sd.play', (['r'], {}), '(r)\n', (550, 553), True, 'import sounddevice as s... |
import pytest
import os
import sys
import json
from tempfile import TemporaryDirectory
import time
from traitlets.config.loader import Config # type: ignore
from jupyter_client import KernelManager # type: ignore
from jupyter_core import paths # type: ignore
from subprocess import PIPE
TIMEOUT = 30
TEST_KERNEL_NAM... | [
"tempfile.TemporaryDirectory",
"os.makedirs",
"jupyter_core.paths.jupyter_data_dir",
"pytest.fixture",
"pytest.skip",
"json.dumps",
"time.sleep",
"jupyter_client.KernelManager",
"os.path.join",
"traitlets.config.loader.Config"
] | [((2517, 2554), 'pytest.fixture', 'pytest.fixture', ([], {'params': "['tcp', 'ipc']"}), "(params=['tcp', 'ipc'])\n", (2531, 2554), False, 'import pytest\n'), ((2097, 2117), 'tempfile.TemporaryDirectory', 'TemporaryDirectory', ([], {}), '()\n', (2115, 2117), False, 'from tempfile import TemporaryDirectory\n'), ((3391, 3... |
#!/usr/bin/env python3
###############################################################################
# #
# RMG - Reaction Mechanism Generator #
# ... | [
"rmgpy.molecule.group.GroupAtom",
"rmgpy.molecule.molecule.Atom",
"logging.error",
"rmgpy.exceptions.InvalidAdjacencyListError",
"logging.debug",
"rmgpy.molecule.element.get_element",
"logging.warning",
"re.match",
"rmgpy.molecule.molecule.Bond",
"rmgpy.molecule.atomtype.get_atomtype",
"rmgpy.mo... | [((21251, 21503), 're.compile', 're.compile', (["('^\\\\s*(\\\\d*)\\\\s+' + '(?P<label>\\\\*\\\\d*\\\\s+)?' +\n '(?P<atomtype>\\\\{?[A-Z]\\\\S*)\\\\s+' +\n '(?P<radicals>X|\\\\d[STDQV]?|\\\\{?\\\\d[^}]*\\\\})\\\\s+' +\n '(?P<lonepairs>\\\\d)' +\n '(?P<bonds>(\\\\s+\\\\{\\\\d+\\\\,(?:[SDTB]|\\\\{.+?\\\\})\\\... |
#!/usr/bin/env python3
# Copyright 2019 <NAME>(<EMAIL>)
#
# 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, ... | [
"sklearn.preprocessing.StandardScaler",
"os.makedirs",
"argparse.ArgumentParser",
"keras.layers.Dropout",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.r2_score",
"os.uname",
"sklearn.metrics.mean_absolute_error",
"time.sleep",
"gc.collect",
"sklearn.metrics.median_absolute_error"... | [((2216, 2241), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2239, 2241), False, 'import argparse\n'), ((2749, 2761), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (2759, 2761), False, 'from keras.models import Sequential\n'), ((3266, 3291), 'tensorflow.test.gpu_device_name', 't... |
import copy
import json
import pkgutil
import networkx as nx
from IPython import embed
import bddl
DEFAULT_HIERARCHY_FILE = pkgutil.get_data(
bddl.__package__, 'hierarchy_owned.json')
class ObjectTaxonomy(object):
def __init__(self, hierarchy_type="owned"):
hierarchy_file = pkgutil.get_data(bddl.__p... | [
"networkx.algorithms.dag.ancestors",
"pkgutil.get_data",
"copy.deepcopy",
"json.loads",
"IPython.embed",
"networkx.algorithms.dag.descendants",
"networkx.DiGraph"
] | [((126, 184), 'pkgutil.get_data', 'pkgutil.get_data', (['bddl.__package__', '"""hierarchy_owned.json"""'], {}), "(bddl.__package__, 'hierarchy_owned.json')\n", (142, 184), False, 'import pkgutil\n'), ((8682, 8689), 'IPython.embed', 'embed', ([], {}), '()\n', (8687, 8689), False, 'from IPython import embed\n'), ((295, 3... |
#!/usr/bin/env python3
"""Generic stats wrapper deligating to sql and file based stats"""
from file_stats import save_stats_file, load_stats_file, save_stats_partially_file
from models.player import Player
from sql_stats import save_stats_sql, load_stats_sql, save_stats_partially_sql
import base.settings
def save_st... | [
"sql_stats.load_stats_sql",
"file_stats.save_stats_partially_file",
"sql_stats.save_stats_sql",
"file_stats.load_stats_file",
"file_stats.save_stats_file",
"sql_stats.save_stats_partially_sql"
] | [((510, 533), 'file_stats.save_stats_file', 'save_stats_file', (['player'], {}), '(player)\n', (525, 533), False, 'from file_stats import save_stats_file, load_stats_file, save_stats_partially_file\n'), ((708, 729), 'file_stats.load_stats_file', 'load_stats_file', (['name'], {}), '(name)\n', (723, 729), False, 'from fi... |
import json
import re
with open("data/qat_ori.json", "r", encoding="utf-8") as f:
data = json.load(f)["data"]
examples = []
for d in data:
for p in d["paragraphs"]:
title = p["casename"]
context = p["context"].replace(",", ",||||")
context = context.replace("“", "“")
co... | [
"json.dump",
"json.load"
] | [((1793, 1845), 'json.dump', 'json.dump', (['examples', 'f'], {'indent': '(4)', 'ensure_ascii': '(False)'}), '(examples, f, indent=4, ensure_ascii=False)\n', (1802, 1845), False, 'import json\n'), ((95, 107), 'json.load', 'json.load', (['f'], {}), '(f)\n', (104, 107), False, 'import json\n')] |
from src.yatzy import Yatzy
# These unit tests can be run using the py.test framework
# available from http://pytest.org/
def test_chance():
assert 15 == Yatzy.chance(2, 3, 4, 5, 1)
assert 16 == Yatzy.chance(3, 3, 4, 5, 1)
def test_yatzy():
assert 50 == Yatzy.yatzy(4, 4, 4, 4, 4)
assert 50 == Yatzy... | [
"src.yatzy.Yatzy.sixes",
"src.yatzy.Yatzy.four_of_a_kind",
"src.yatzy.Yatzy.yatzy",
"src.yatzy.Yatzy.chance",
"src.yatzy.Yatzy.fours",
"src.yatzy.Yatzy.two_pair",
"src.yatzy.Yatzy.three_of_a_kind",
"src.yatzy.Yatzy.fullHouse",
"src.yatzy.Yatzy.threes",
"src.yatzy.Yatzy.smallStraight",
"src.yatzy... | [((161, 188), 'src.yatzy.Yatzy.chance', 'Yatzy.chance', (['(2)', '(3)', '(4)', '(5)', '(1)'], {}), '(2, 3, 4, 5, 1)\n', (173, 188), False, 'from src.yatzy import Yatzy\n'), ((206, 233), 'src.yatzy.Yatzy.chance', 'Yatzy.chance', (['(3)', '(3)', '(4)', '(5)', '(1)'], {}), '(3, 3, 4, 5, 1)\n', (218, 233), False, 'from src... |
from distutils.core import setup
from textwrap import dedent
import uncommitted
description, long_description = uncommitted.__doc__.split('\n', 1)
setup(
name='uncommitted',
version=uncommitted.__version__,
description=description,
long_description=long_description.lstrip(),
author='<NAME>',
a... | [
"textwrap.dedent",
"uncommitted.__doc__.split"
] | [((113, 147), 'uncommitted.__doc__.split', 'uncommitted.__doc__.split', (['"""\n"""', '(1)'], {}), "('\\n', 1)\n", (138, 147), False, 'import uncommitted\n'), ((944, 1050), 'textwrap.dedent', 'dedent', (['"""\n [console_scripts]\n uncommitted = uncommitted.command:main\n """'], {}), '(\n """\n ... |
# Copyright 2020 The MediaPipe Authors.
#
# 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 ... | [
"mediapipe.calculators.core.constant_side_packet_calculator_pb2.ConstantSidePacketCalculatorOptions.ConstantSidePacket"
] | [((6731, 6860), 'mediapipe.calculators.core.constant_side_packet_calculator_pb2.ConstantSidePacketCalculatorOptions.ConstantSidePacket', 'constant_side_packet_calculator_pb2.ConstantSidePacketCalculatorOptions.ConstantSidePacket', ([], {'bool_value': '(not static_image_mode)'}), '(\n bool_value=not static_image_mode... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.