code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 01 15:21:46 2018
@author: <NAME>, <NAME>
"""
from __future__ import division, print_function, absolute_import, unicode_literals
from os import path, remove
import sys
import numpy as np
import h5py
from sidpy.sid import Translator
from sidpy.hdf.hdf_utils import write_s... | [
"pyUSID.io.write_utils.Dimension",
"os.path.exists",
"gwyfile.load",
"sidpy.hdf.hdf_utils.write_simple_attrs",
"os.path.join",
"h5py.File",
"os.path.split",
"os.remove",
"numpy.linspace",
"os.path.abspath",
"pyUSID.io.hdf_utils.create_indexed_group",
"pyUSID.io.hdf_utils.write_main_dataset"
] | [((1578, 1601), 'os.path.abspath', 'path.abspath', (['file_path'], {}), '(file_path)\n', (1590, 1601), False, 'from os import path, remove\n'), ((1635, 1656), 'os.path.split', 'path.split', (['file_path'], {}), '(file_path)\n', (1645, 1656), False, 'from os import path, remove\n'), ((1710, 1751), 'os.path.join', 'path.... |
# pylint: disable=missing-docstring
from jinja2 import Environment, FunctionLoader
from resolwe.flow.models import Data, DescriptorSchema, Collection, Process, Relation
from resolwe.flow.models.entity import RelationPartition, RelationType
from resolwe.test import TestCase
from resolwe_bio.expression_filters.relation... | [
"resolwe.flow.models.Process.objects.create",
"resolwe.flow.models.entity.RelationType.objects.get",
"resolwe_bio.expression_filters.relation.replicate_groups",
"jinja2.FunctionLoader",
"resolwe.flow.models.Relation.objects.create",
"resolwe.flow.models.DescriptorSchema.objects.create",
"resolwe.flow.mo... | [((452, 616), 'resolwe.flow.models.Process.objects.create', 'Process.objects.create', ([], {'type': '"""data:test:process"""', 'slug': '"""test-process"""', 'contributor': 'self.contributor', 'entity_type': '"""sample"""', 'entity_descriptor_schema': '"""sample"""'}), "(type='data:test:process', slug='test-process',\n ... |
from typing import Iterable, List, Set, Tuple
from graph import Graph, taxidistance, CostedPath
Pos = Tuple[int, int]
DATA = [
list(".....................XX......."),
list(".....................XX......."),
list(".....................XX......."),
list("...XX................XX......."),
list("...XX... | [
"graph.CostedPath"
] | [((2914, 2949), 'graph.CostedPath', 'CostedPath', (['(5)', "['C', 'E', 'F', 'H']"], {}), "(5, ['C', 'E', 'F', 'H'])\n", (2924, 2949), False, 'from graph import Graph, taxidistance, CostedPath\n'), ((3275, 3310), 'graph.CostedPath', 'CostedPath', (['(5)', "['C', 'E', 'F', 'H']"], {}), "(5, ['C', 'E', 'F', 'H'])\n", (328... |
"""This module is used to for EmmerseGeoMorph file operations"""
# ***** BEGIN LICENSE BLOCK *****
#
# Copyright © 2016, NIF File Format Library and Tools contributors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the followin... | [
"io_scene_niftools.utils.logging.NifError",
"io_scene_niftools.utils.logging.NifLog.info",
"pyffi.formats.egm.EgmFormat.Data"
] | [((2047, 2082), 'io_scene_niftools.utils.logging.NifLog.info', 'NifLog.info', (['f"""Loading {file_path}"""'], {}), "(f'Loading {file_path}')\n", (2058, 2082), False, 'from io_scene_niftools.utils.logging import NifLog, NifError\n'), ((2103, 2119), 'pyffi.formats.egm.EgmFormat.Data', 'EgmFormat.Data', ([], {}), '()\n',... |
import os
import math
def win(word):
print('')
print('Было загадано слово ' + word + ' и вы его отгадали!')
print('Добро пожаловать в игру по спасению острова!')
word = input('Введите загадываемое слово: ')
wordLength = len(word)
hiddenWord = list()
guessedLetters = []
for i in range(wordLength):
... | [
"os.system",
"math.ceil"
] | [((498, 523), 'math.ceil', 'math.ceil', (['(wordLength / 2)'], {}), '(wordLength / 2)\n', (507, 523), False, 'import math\n'), ((570, 618), 'os.system', 'os.system', (["('cls' if os.name == 'nt' else 'clear')"], {}), "('cls' if os.name == 'nt' else 'clear')\n", (579, 618), False, 'import os\n')] |
# ----------------------------------------------------------------------
# |
# | Error.py
# |
# | <NAME> <<EMAIL>>
# | 2021-09-22 15:42:41
# |
# ----------------------------------------------------------------------
# |
# | Copyright <NAME> 2021
# | Distributed under the Boost Software License, Versi... | [
"CommonEnvironment.ThisFullpath",
"dataclasses.dataclass",
"os.path.split"
] | [((746, 778), 'CommonEnvironment.ThisFullpath', 'CommonEnvironment.ThisFullpath', ([], {}), '()\n', (776, 778), False, 'import CommonEnvironment\n'), ((826, 857), 'os.path.split', 'os.path.split', (['_script_fullpath'], {}), '(_script_fullpath)\n', (839, 857), False, 'import os\n'), ((1012, 1034), 'dataclasses.dataclas... |
""" JobIHEPCommand
The JobIHEPCommand class is a command class to know about present jobs efficiency
"""
from DIRAC import S_OK, S_ERROR
from DIRAC.Core.DISET.RPCClient import RPCClient
from DIRAC.ResourceStatusSystem.Comman... | [
"DIRAC.Core.DISET.RPCClient.RPCClient",
"IHEPDIRAC.ResourceStatusSystem.Utilities.CSHelpers.getSites",
"IHEPDIRAC.ResourceStatusSystem.Client.ResourceManagementIHEPClient.ResourceManagementIHEPClient",
"DIRAC.Interfaces.API.DiracAdmin.DiracAdmin",
"DIRAC.S_OK",
"DIRAC.S_ERROR"
] | [((2140, 2146), 'DIRAC.S_OK', 'S_OK', ([], {}), '()\n', (2144, 2146), False, 'from DIRAC import S_OK, S_ERROR\n'), ((2393, 2403), 'DIRAC.S_OK', 'S_OK', (['name'], {}), '(name)\n', (2397, 2403), False, 'from DIRAC import S_OK, S_ERROR\n'), ((2965, 2977), 'DIRAC.Interfaces.API.DiracAdmin.DiracAdmin', 'DiracAdmin', ([], {... |
#!/usr/bin/env python
from time import time
import rospy
import mavros
import numpy as np
import matplotlib.pyplot as plt
from geometry_msgs.msg import PoseStamped, TwistStamped
import mavros_msgs.msg
class dieptran():
def __init__(self):
rospy.init_node('listener_results', anonymous=True)
self.ra... | [
"mavros.get_topic",
"matplotlib.pyplot.ylabel",
"rospy.is_shutdown",
"rospy.init_node",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"mavros.set_namespace",
"numpy.append",
"rospy.Rate",
"rospy.spin",
"time.time",
"rospy.loginfo",
"matplotlib.pyplot.legend"
] | [((253, 304), 'rospy.init_node', 'rospy.init_node', (['"""listener_results"""'], {'anonymous': '(True)'}), "('listener_results', anonymous=True)\n", (268, 304), False, 'import rospy\n'), ((325, 341), 'rospy.Rate', 'rospy.Rate', (['(20.0)'], {}), '(20.0)\n', (335, 341), False, 'import rospy\n'), ((375, 405), 'mavros.set... |
"""
categories: Modules,struct
description: Struct pack with too few args, not checked by uPy
cause: Unknown
workaround: Unknown
"""
import struct
try:
print(struct.pack("bb", 1))
print("Should not get here")
except:
print("struct.error")
| [
"struct.pack"
] | [((163, 183), 'struct.pack', 'struct.pack', (['"""bb"""', '(1)'], {}), "('bb', 1)\n", (174, 183), False, 'import struct\n')] |
import stats
def get_hwe_likelihood(obs_hom_ref, obs_het, obs_hom_alt, aaf):
"""
Compute the likelihood of deviation from HWE using X^2,
as well as the inbreeding coefficient.
"""
# Bail out if aaf is undefined. This occurs
# when there are multiple alternate alleles
if aaf is None:
... | [
"stats.lchisqprob"
] | [((1392, 1425), 'stats.lchisqprob', 'stats.lchisqprob', (['x2_statistic', '(1)'], {}), '(x2_statistic, 1)\n', (1408, 1425), False, 'import stats\n')] |
#!/usr/bin/python
import numpy as np
class GC:
'Gamma Correction'
def __init__(self, img, lut, mode):
self.img = img
self.lut = lut
self.mode = mode
def execute(self):
img_h = self.img.shape[0]
img_w = self.img.shape[1]
img_c = self.img.shape[2]
gc_... | [
"numpy.empty"
] | [((326, 368), 'numpy.empty', 'np.empty', (['(img_h, img_w, img_c)', 'np.uint16'], {}), '((img_h, img_w, img_c), np.uint16)\n', (334, 368), True, 'import numpy as np\n')] |
from __future__ import annotations
from typing import TYPE_CHECKING, Dict, List, Optional, Union
import datetime
from ..utils import Snowflake
from .embed import Embed
from .threads import Thread
from .attachments import Attachment
from .components import ActionRow
if TYPE_CHECKING:
from ..state import State
... | [
"datetime.datetime.fromisoformat"
] | [((6392, 6448), 'datetime.datetime.fromisoformat', 'datetime.datetime.fromisoformat', (["self._data['timestamp']"], {}), "(self._data['timestamp'])\n", (6423, 6448), False, 'import datetime\n')] |
#!/usr/bin/env python
# encoding: utf-8
"""
@version: python.3.6
@author: zhangjiaheng
@software: PyCharm
@time: 2017/9/26 14:31
"""
from test_case.page_obj import login_page,landlord_nav_page,landlord_read_page
from models import function,myunit
from time import sleep
import unittest
class TestLandlordRead(myunit.My... | [
"models.function.insert_img",
"test_case.page_obj.landlord_nav_page.LandlordNavPage",
"time.sleep",
"test_case.page_obj.landlord_read_page.LandlordReadPage",
"unittest.main",
"test_case.page_obj.login_page.LoginPage"
] | [((3919, 3934), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3932, 3934), False, 'import unittest\n'), ((455, 463), 'time.sleep', 'sleep', (['(3)'], {}), '(3)\n', (460, 463), False, 'from time import sleep\n'), ((541, 549), 'time.sleep', 'sleep', (['(3)'], {}), '(3)\n', (546, 549), False, 'from time import slee... |
"""add tasks table
Revision ID: <KEY>
Revises: <PASSWORD>
Create Date: 2021-11-04 11:23:54.834601
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "<PASSWORD>"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
... | [
"alembic.op.drop_table",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer",
"sqlalchemy.TIMESTAMP",
"sqlalchemy.String"
] | [((765, 787), 'alembic.op.drop_table', 'op.drop_table', (['"""tasks"""'], {}), "('tasks')\n", (778, 787), False, 'from alembic import op\n'), ((705, 734), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""id"""'], {}), "('id')\n", (728, 734), True, 'import sqlalchemy as sa\n'), ((359, 371), 'sqlalchem... |
from detectron2.structures import BoxMode
from pathlib import Path
import json
import cv2
SAL_THR = 0.5
def get_assr_dicts(root, mode):
root = Path(root)
json_file = root / f"obj_seg_data_{mode}.json"
list_file = root / f"{mode}_images.txt"
with open(json_file) as f:
imgs_anns = json.load(f)
... | [
"json.load",
"cv2.imread",
"pathlib.Path"
] | [((150, 160), 'pathlib.Path', 'Path', (['root'], {}), '(root)\n', (154, 160), False, 'from pathlib import Path\n'), ((307, 319), 'json.load', 'json.load', (['f'], {}), '(f)\n', (316, 319), False, 'import json\n'), ((504, 524), 'cv2.imread', 'cv2.imread', (['filename'], {}), '(filename)\n', (514, 524), False, 'import cv... |
# Correr el servidor python manage.py runserver
# Request: Para realizar peticiones al servidor.
# HttpResponse: Para enviar la respuesta usando el protocolo HTTP.
from typing import Text
from django.http import request
from Usuario_PostgreSQL.models import Agenda, Pacientes, Notamedica
from Usuario_PostgreSQL.models... | [
"django.shortcuts.render",
"Usuario_PostgreSQL.models.HistorialClinicaPacientes.objects.create",
"django.core.mail.send_mail",
"Usuario_PostgreSQL.models.Agenda.objects.create",
"Usuario_PostgreSQL.models.Medicamentos.objects.all",
"Usuario_PostgreSQL.models.Pacientes.objects.all",
"django.http.request.... | [((720, 749), 'django.shortcuts.render', 'render', (['request', '"""index.html"""'], {}), "(request, 'index.html')\n", (726, 749), False, 'from django.shortcuts import render, redirect\n'), ((792, 828), 'django.shortcuts.render', 'render', (['request', '"""iniciosesion.html"""'], {}), "(request, 'iniciosesion.html')\n"... |
from elasticsearch import Elasticsearch
class ElasticSearchFactory(object):
def __init__(self, host: str, port: int):
self.host = host
self.port = port
def create(self) -> Elasticsearch:
return Elasticsearch(
[{'host': self.host, 'port': self.port}], headers={'X-Api-Key': ... | [
"elasticsearch.Elasticsearch"
] | [((229, 321), 'elasticsearch.Elasticsearch', 'Elasticsearch', (["[{'host': self.host, 'port': self.port}]"], {'headers': "{'X-Api-Key': 'xxxxx'}"}), "([{'host': self.host, 'port': self.port}], headers={\n 'X-Api-Key': 'xxxxx'})\n", (242, 321), False, 'from elasticsearch import Elasticsearch\n')] |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.10.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# +
from proto.messages_... | [
"bokeh.io.show",
"python_tools.proto_log.ProtoLog",
"bokeh.plotting.figure",
"bokeh.io.output_notebook",
"bokeh.io.push_notebook",
"ipywidgets.interact",
"python_tools.plotting.plot_ssl_wrapper.SSLWrapperPlotter"
] | [((488, 559), 'python_tools.proto_log.ProtoLog', 'ProtoLog', (['"""test_data/SensorFusion_SSL_WrapperPacket"""', 'SSL_WrapperPacket'], {}), "('test_data/SensorFusion_SSL_WrapperPacket', SSL_WrapperPacket)\n", (496, 559), False, 'from python_tools.proto_log import ProtoLog\n'), ((735, 752), 'bokeh.io.output_notebook', '... |
from collections import OrderedDict
TEST_REPO_NAME = 'rbu-test-repo'
TEST_REPO_URL = 'https://github.com/antoinewdg/rbu-test-repo.git'
COMMITS = OrderedDict({
'1f4db65': 'Improves performance',
'21a29f0': 'Does not change anything',
'b201bbf': 'Does not compile',
})
ERRORED_COMMIT = 'b201bbf'
| [
"collections.OrderedDict"
] | [((147, 269), 'collections.OrderedDict', 'OrderedDict', (["{'1f4db65': 'Improves performance', '21a29f0': 'Does not change anything',\n 'b201bbf': 'Does not compile'}"], {}), "({'1f4db65': 'Improves performance', '21a29f0':\n 'Does not change anything', 'b201bbf': 'Does not compile'})\n", (158, 269), False, 'from... |
from datetime import date, datetime
from jsonschema import validate, FormatChecker
from flask_philo import utils
from .exceptions import SerializerError
import uuid
# uuid
uuid_schema = {
"type": "string",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" # noqa
}
c... | [
"flask_philo.utils.string_to_date",
"flask_philo.utils.datetime_to_string",
"flask_philo.utils.date_to_string",
"flask_philo.utils.string_to_datetime",
"jsonschema.FormatChecker"
] | [((1468, 1483), 'jsonschema.FormatChecker', 'FormatChecker', ([], {}), '()\n', (1481, 1483), False, 'from jsonschema import validate, FormatChecker\n'), ((3077, 3104), 'flask_philo.utils.datetime_to_string', 'utils.datetime_to_string', (['v'], {}), '(v)\n', (3101, 3104), False, 'from flask_philo import utils\n'), ((199... |
from sklearn.datasets import fetch_20newsgroups
newsgroups_train = fetch_20newsgroups(subset='train')
from pprint import pprint
pprint(list(newsgroups_train.target_names))
cats = ['alt.atheism', 'sci.space']
newsgroups_train = fetch_20newsgroups(subset='train', categories=cats)
list(newsgroups_train.target_... | [
"sklearn.datasets.fetch_20newsgroups"
] | [((68, 102), 'sklearn.datasets.fetch_20newsgroups', 'fetch_20newsgroups', ([], {'subset': '"""train"""'}), "(subset='train')\n", (86, 102), False, 'from sklearn.datasets import fetch_20newsgroups\n'), ((236, 287), 'sklearn.datasets.fetch_20newsgroups', 'fetch_20newsgroups', ([], {'subset': '"""train"""', 'categories': ... |
from euler.primes import prime_numbers
def compute(n: int, m: int = 1_000_000_007) -> int:
result = [0] + [1] * n
for prime in prime_numbers(n):
past_super, last_super, new_super = 0, 0, 0
last_hyper, new_hyper = 0, 0
inv_mod = pow(prime - 1, -1, m)
for i in range(prime, n + 1)... | [
"euler.primes.prime_numbers"
] | [((137, 153), 'euler.primes.prime_numbers', 'prime_numbers', (['n'], {}), '(n)\n', (150, 153), False, 'from euler.primes import prime_numbers\n')] |
""" This module helps out with generating text using templates """
import json
import random
import re
from functools import lru_cache
import tracery
from tracery.modifiers import base_english
from talkgenerator.sources import conceptnet
from talkgenerator.sources import phrasefinder
from talkgenerator.sources import... | [
"talkgenerator.util.os_util.read_lines",
"random.choice",
"talkgenerator.util.language_util.is_noun",
"talkgenerator.util.language_util.is_consonant",
"talkgenerator.sources.wikihow.get_related_wikihow_actions",
"talkgenerator.util.language_util.is_verb",
"talkgenerator.util.os_util.to_actual_file",
"... | [((4443, 4464), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(20)'}), '(maxsize=20)\n', (4452, 4464), False, 'from functools import lru_cache\n'), ((5273, 5319), 're.findall', 're.findall', (['"""{(\\\\w+)((?:[.]\\\\w+)*)}"""', 'template'], {}), "('{(\\\\w+)((?:[.]\\\\w+)*)}', template)\n", (5283, 5319), False... |
import os
import fnmatch
import shutil
import re
import datetime
path="U:/2016TigerFiles/2017Files/addrfn"
#path="U:/2016TigerFiles/2017Files/addr"
#path ="W:/2016TigerFiles/2018Files/addrfn/test"
#path="C:/Users/mattp/Desktop/WorkFiles/XML Files/ISO Files/2017Files/2017addrfeat"
#path="C:/Users/mattp/Deskto... | [
"os.path.exists",
"os.path.join",
"os.chdir",
"datetime.datetime.now",
"shutil.copyfile",
"os.remove",
"os.walk",
"re.search"
] | [((856, 879), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (877, 879), False, 'import datetime\n'), ((546, 570), 'os.path.join', 'os.path.join', (['dirpath', 'f'], {}), '(dirpath, f)\n', (558, 570), False, 'import os\n'), ((2686, 2719), 're.search', 're.search', (['""".shp"""', 'fileA'], {'flags'... |
#!/usr/bin/env python
#coding:utf-8
"""
doctest demonstration.
how to run:
$ python -m doctest -v try-doctest.py
"""
def multiply(a, b):
"""
Multiply a with b.
>>> multiply(1, 2)
2
>>> multiply('a', 3)
'aaa'
"""
return a * b
"""
main
"""
if __name__ == '__main__':
import docte... | [
"doctest.testmod"
] | [((327, 356), 'doctest.testmod', 'doctest.testmod', ([], {'verbose': '(True)'}), '(verbose=True)\n', (342, 356), False, 'import doctest\n')] |
# taken from https://github.com/torrvision/focal_calibration/blob/main/Losses/mmce.py
import torch
import torch.nn.functional as F
import torch.nn as nn
class MMCE_weighted(nn.Module):
"""
Computes MMCE_w loss.
"""
def __init__(self):
super(MMCE_weighted, self).__init__()
self.device = ... | [
"torch.abs",
"torch.ones",
"torch.mean",
"torch.topk",
"torch.max",
"torch.sqrt",
"torch.eq",
"torch.tensor",
"torch.sum",
"torch.zeros",
"torch.nn.functional.softmax",
"torch.device"
] | [((320, 340), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (332, 340), False, 'import torch\n'), ((1464, 1493), 'torch.mean', 'torch.mean', (['(tensor1 * tensor2)'], {}), '(tensor1 * tensor2)\n', (1474, 1493), False, 'import torch\n'), ((1917, 1940), 'torch.nn.functional.softmax', 'F.softmax', ([... |
from django import forms
from .utils import get_coins_list
class ChooseCoinToPayForm(forms.Form):
currency = forms.ChoiceField(choices=get_coins_list(),
widget=forms.RadioSelect(),
label='',
required=True)
| [
"django.forms.RadioSelect"
] | [((199, 218), 'django.forms.RadioSelect', 'forms.RadioSelect', ([], {}), '()\n', (216, 218), False, 'from django import forms\n')] |
#!/usr/bin/env python
from splunklib.searchcommands import dispatch, StreamingCommand, Configuration, Option, validators
import splunklib.results as results
import splunklib.client as client
import sys
import urllib.request, urllib.parse, urllib.error
import httplib2
from xml.dom import minidom
import logging
import c... | [
"logging.getLogger",
"json.loads",
"configparser.ConfigParser",
"logging.Formatter",
"splunklib.searchcommands.dispatch",
"splunklib.results.ResultsReader",
"splunklib.client.connect",
"splunk.appserver.mrsparkle.lib.util.make_splunkhome_path",
"splunklib.searchcommands.Configuration"
] | [((449, 464), 'splunklib.searchcommands.Configuration', 'Configuration', ([], {}), '()\n', (462, 464), False, 'from splunklib.searchcommands import dispatch, StreamingCommand, Configuration, Option, validators\n'), ((6928, 6997), 'splunklib.searchcommands.dispatch', 'dispatch', (['getanswerCommand', 'sys.argv', 'sys.st... |
from random import getrandbits
from src.genome.RandomPointsFinder import RandomPointsFinder
from src.randomExpression.RandomStringExpression import RandomStringExpression
class ExpressionCrossover:
"""
This class takes two Individuals and is able to create a new Individual by
selecting random parts of th... | [
"src.genome.RandomPointsFinder.RandomPointsFinder",
"src.randomExpression.RandomStringExpression.RandomStringExpression",
"random.getrandbits"
] | [((457, 477), 'src.genome.RandomPointsFinder.RandomPointsFinder', 'RandomPointsFinder', ([], {}), '()\n', (475, 477), False, 'from src.genome.RandomPointsFinder import RandomPointsFinder\n'), ((1475, 1521), 'src.randomExpression.RandomStringExpression.RandomStringExpression', 'RandomStringExpression', ([], {'child_expr... |
import json
from django.core.exceptions import ValidationError
from django.forms.fields import CharField, ChoiceField, HiddenInput, MultiValueField, Select
from django.forms.utils import ErrorList
from nameparser import HumanName
from six import iteritems, text_type
from formulaic.widgets import GroupedChoiceWidget
... | [
"nameparser.HumanName",
"json.dumps",
"django.core.exceptions.ValidationError",
"django.forms.utils.ErrorList",
"six.iteritems",
"django.forms.fields.HiddenInput"
] | [((467, 490), 'nameparser.HumanName', 'HumanName', (['cleaned_text'], {}), '(cleaned_text)\n', (476, 490), False, 'from nameparser import HumanName\n'), ((1408, 1425), 'six.iteritems', 'iteritems', (['groups'], {}), '(groups)\n', (1417, 1425), False, 'from six import iteritems, text_type\n'), ((2905, 2916), 'django.for... |
from __future__ import print_function
from props.default import *
import lib.obp as obp
import sys
import requests
import json
import os.path
import datetime
from functools import reduce
obp.setBaseUrl(BASE_URL)
obp.setApiVersion(API_VERSION)
obp.login(USERNAME, PASSWORD, CONSUMER_KEY)
def getAccounts(bank):
# Sa... | [
"lib.obp.setApiVersion",
"lib.obp.getTransactions",
"lib.obp.getAccountByIdCore",
"lib.obp.getAccountsAtBankIdOnly",
"datetime.datetime.strptime",
"lib.obp.setBaseUrl",
"lib.obp.login",
"json.load",
"json.dump"
] | [((188, 212), 'lib.obp.setBaseUrl', 'obp.setBaseUrl', (['BASE_URL'], {}), '(BASE_URL)\n', (202, 212), True, 'import lib.obp as obp\n'), ((213, 243), 'lib.obp.setApiVersion', 'obp.setApiVersion', (['API_VERSION'], {}), '(API_VERSION)\n', (230, 243), True, 'import lib.obp as obp\n'), ((244, 287), 'lib.obp.login', 'obp.lo... |
import pytest
from reason.util import ngrams, bigrams, trigrams
@pytest.fixture
def input_value():
input_value = 'Reason is easy to use'
return input_value
def test_bigrams(input_value):
output = [('Reason', 'is'), ('is', 'easy'), ('easy', 'to'), ('to', 'use')]
assert bigrams(input_value) == output... | [
"reason.util.trigrams",
"reason.util.bigrams",
"pytest.raises",
"reason.util.ngrams"
] | [((290, 310), 'reason.util.bigrams', 'bigrams', (['input_value'], {}), '(input_value)\n', (297, 310), False, 'from reason.util import ngrams, bigrams, trigrams\n'), ((464, 485), 'reason.util.trigrams', 'trigrams', (['input_value'], {}), '(input_value)\n', (472, 485), False, 'from reason.util import ngrams, bigrams, tri... |
from spyderlib.qt.QtGui import (QApplication, QMainWindow, QWidget, QLabel,
QLineEdit, QHBoxLayout, QDockWidget, QFont)
from spyderlib.qt.QtCore import Qt
from spyderlib.widgets.internalshell import InternalShell
class MyWidget(QWidget):
def __init__(self):
QWid... | [
"spyderlib.qt.QtGui.QWidget.__init__",
"spyderlib.widgets.internalshell.InternalShell",
"spyderlib.qt.QtGui.QLabel",
"spyderlib.qt.QtGui.QFont",
"spyderlib.qt.QtGui.QLineEdit",
"spyderlib.qt.QtGui.QApplication",
"spyderlib.qt.QtGui.QDockWidget",
"spyderlib.qt.QtGui.QHBoxLayout",
"spyderlib.qt.QtGui.... | [((2310, 2326), 'spyderlib.qt.QtGui.QApplication', 'QApplication', (['[]'], {}), '([])\n', (2322, 2326), False, 'from spyderlib.qt.QtGui import QApplication, QMainWindow, QWidget, QLabel, QLineEdit, QHBoxLayout, QDockWidget, QFont\n'), ((316, 338), 'spyderlib.qt.QtGui.QWidget.__init__', 'QWidget.__init__', (['self'], {... |
from __future__ import print_function, absolute_import
import posixpath
import pickle
import numpy as np
import numpy.testing as npt
from utils import *
def test_bytes(hdfs, request):
testname = request.node.name
fname = posixpath.join(TEST_DIR, testname)
data = b'a' * 10 * 2**20
data += b'b' * 10... | [
"numpy.random.normal",
"posixpath.join",
"numpy.testing.assert_equal",
"pickle.dumps",
"pickle.loads"
] | [((234, 268), 'posixpath.join', 'posixpath.join', (['TEST_DIR', 'testname'], {}), '(TEST_DIR, testname)\n', (248, 268), False, 'import posixpath\n'), ((650, 684), 'posixpath.join', 'posixpath.join', (['TEST_DIR', 'testname'], {}), '(TEST_DIR, testname)\n', (664, 684), False, 'import posixpath\n'), ((696, 736), 'numpy.r... |
# Copyright (C) 2008-today The SG++ project
# This file is part of the SG++ project. For conditions of distribution and
# use, please see the copyright notice provided with SG++ or at
# sgpp.sparsegrids.org
from Learner import Learner, LearnerEvents
from pysgpp import DataVector, SurplusRefinementFunctor
from math... | [
"pysgpp.DataVector"
] | [((1381, 1397), 'pysgpp.DataVector', 'DataVector', (['size'], {}), '(size)\n', (1391, 1397), False, 'from pysgpp import DataVector, SurplusRefinementFunctor\n')] |
import mock
from mock import ANY
import requests
from werckercli.metrics import track_application_startup, default_command_name
from werckercli.tests import TestCase
track_command_usage_path = "werckercli.metrics.track_command_usage"
class MetricsTests(TestCase):
def test_track_application_startup_fails_silent... | [
"requests.ConnectionError",
"mock.patch",
"mock.Mock",
"werckercli.metrics.track_application_startup"
] | [((920, 955), 'mock.patch', 'mock.patch', (['"""sys.argv"""', "['main.py']"], {}), "('sys.argv', ['main.py'])\n", (930, 955), False, 'import mock\n'), ((1256, 1303), 'mock.patch', 'mock.patch', (['"""sys.argv"""', "['main.py', 'validate']"], {}), "('sys.argv', ['main.py', 'validate'])\n", (1266, 1303), False, 'import m... |
import ccxt
import copy
from trading.exchanges.exchange_manager import ExchangeManager
from config.cst import *
from tests.test_utils.config import load_test_config
from trading.trader.order import *
from trading.trader.order_notifier import OrderNotifier
from trading.trader.trader import Trader
from trading.trader.tr... | [
"trading.trader.trader.Trader",
"trading.trader.trader_simulator.TraderSimulator",
"trading.exchanges.exchange_manager.ExchangeManager",
"trading.trader.trader.Trader.enabled",
"trading.trader.order_notifier.OrderNotifier",
"copy.deepcopy",
"tests.test_utils.config.load_test_config"
] | [((517, 535), 'tests.test_utils.config.load_test_config', 'load_test_config', ([], {}), '()\n', (533, 535), False, 'from tests.test_utils.config import load_test_config\n'), ((563, 619), 'trading.exchanges.exchange_manager.ExchangeManager', 'ExchangeManager', (['config', 'ccxt.binance'], {'is_simulated': '(True)'}), '(... |
import gettext
from typing import Optional
class Localizer:
def __init__(self, storage, languages: tuple):
self.storage = storage
self.languages = {lang: gettext.translation('base', localedir='locale', languages=[lang]).gettext
for lang in languages}
self.languag... | [
"gettext.translation"
] | [((177, 242), 'gettext.translation', 'gettext.translation', (['"""base"""'], {'localedir': '"""locale"""', 'languages': '[lang]'}), "('base', localedir='locale', languages=[lang])\n", (196, 242), False, 'import gettext\n')] |
# -*- coding:utf-8 -*-
"""Sample training code
"""
import numpy as np
import pandas as pd
import argparse
import torch as th
import torch.nn as nn
from sch_qm import SchNetModel
# from mgcn import MGCNModel
# from mpnn import MPNNModel
from torch.utils.data import DataLoader
from Alchemy_dataset_qm import TencentAlchem... | [
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"argparse.ArgumentParser",
"torch.nn.L1Loss",
"Alchemy_dataset_qm.TencentAlchemyDataset",
"torch.nn.MSELoss",
"torch.cuda.is_available",
"sch_qm.SchNetModel",
"torch.no_grad",
"Alchemy_dataset_qm.batcher",
"torch.device"
] | [((673, 689), 'torch.device', 'th.device', (['"""cpu"""'], {}), "('cpu')\n", (682, 689), True, 'import torch as th\n'), ((834, 857), 'Alchemy_dataset_qm.TencentAlchemyDataset', 'TencentAlchemyDataset', ([], {}), '()\n', (855, 857), False, 'from Alchemy_dataset_qm import TencentAlchemyDataset, batcher\n'), ((1021, 1044)... |
from typing import Any, Dict, Set, cast
from functools import cached_property
from opensanctions.core.dataset import Dataset
from opensanctions.core.source import Source
class Collection(Dataset):
"""A grouping of individual data sources. Data sources are bundled in order
to be more useful for list use."""
... | [
"opensanctions.core.dataset.Dataset.all",
"typing.cast"
] | [((572, 585), 'opensanctions.core.dataset.Dataset.all', 'Dataset.all', ([], {}), '()\n', (583, 585), False, 'from opensanctions.core.dataset import Dataset\n'), ((790, 805), 'typing.cast', 'cast', (['Source', 't'], {}), '(Source, t)\n', (794, 805), False, 'from typing import Any, Dict, Set, cast\n')] |
from net.earthcomputer.multiconnect.api import Protocols
from net.earthcomputer.multiconnect.integrationtest import IntegrationTest
ip = IntegrationTest.setupServer(Protocols.V1_16_5)
Client.connect(ip)
Client.waitTick(100)
| [
"net.earthcomputer.multiconnect.integrationtest.IntegrationTest.setupServer"
] | [((138, 184), 'net.earthcomputer.multiconnect.integrationtest.IntegrationTest.setupServer', 'IntegrationTest.setupServer', (['Protocols.V1_16_5'], {}), '(Protocols.V1_16_5)\n', (165, 184), False, 'from net.earthcomputer.multiconnect.integrationtest import IntegrationTest\n')] |
# SetupProject DaVinci v36r2
import sys
from GaudiConf import IOHelper
from Configurables import LHCbApp, ApplicationMgr, DataOnDemandSvc
from Configurables import SimConf, DigiConf, DecodeRawEvent
from Configurables import ConfigTarFileAccessSvc
from Configurables import CondDB, DaVinci
from Configurables import LoKi... | [
"Configurables.DaVinci",
"Configurables.CombineParticles",
"Configurables.TupleToolMCTruth",
"Configurables.LHCbApp",
"Configurables.FilterDesktop",
"PhysSelPython.Wrappers.SelectionSequence",
"Configurables.LoKiSvc",
"Configurables.ChargedPP2MC",
"PhysSelPython.Wrappers.AutomaticData",
"Configura... | [((1093, 1109), 'Configurables.ApplicationMgr', 'ApplicationMgr', ([], {}), '()\n', (1107, 1109), False, 'from Configurables import LHCbApp, ApplicationMgr, DataOnDemandSvc\n'), ((1183, 1192), 'Configurables.DaVinci', 'DaVinci', ([], {}), '()\n', (1190, 1192), False, 'from Configurables import CondDB, DaVinci\n'), ((12... |
import streamlit as st
from PIL import Image
from pages import page_public_dataset, page_tournesol_scores
st.session_state.data = None
PAGES = {
"Comparisons Public Dataset": page_public_dataset,
"Tournesol Scores": page_tournesol_scores,
}
# === Side bar ==================================
image = Image.op... | [
"streamlit.sidebar.title",
"streamlit.sidebar.markdown",
"PIL.Image.open",
"streamlit.sidebar.image"
] | [((312, 369), 'PIL.Image.open', 'Image.open', (['"""../frontend/public/logos/Tournesol_Logo.png"""'], {}), "('../frontend/public/logos/Tournesol_Logo.png')\n", (322, 369), False, 'from PIL import Image\n'), ((370, 404), 'streamlit.sidebar.image', 'st.sidebar.image', (['image'], {'width': '(256)'}), '(image, width=256)\... |
from .. import config
config.setup_examples()
import infermedica_api
if __name__ == "__main__":
api: infermedica_api.APIv3Connector = infermedica_api.get_api()
# Prepare the diagnosis request object
request = config.get_example_request_data()
# call triage method
response = api.suggest(**request... | [
"infermedica_api.get_api"
] | [((140, 165), 'infermedica_api.get_api', 'infermedica_api.get_api', ([], {}), '()\n', (163, 165), False, 'import infermedica_api\n')] |
from flask import Flask, jsonify
app = Flask(__name__)
app.config['DEBUG'] = True
list = [
{
'id': 0,
'Company': 'Microsoft azure',
'What is azure': 'Azure es conjunto en constante expansión de servicios en la nube para ayudar a su organización a satisfacer sus necesidades comer... | [
"flask.jsonify",
"flask.Flask"
] | [((42, 57), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (47, 57), False, 'from flask import Flask, jsonify\n'), ((1732, 1745), 'flask.jsonify', 'jsonify', (['list'], {}), '(list)\n', (1739, 1745), False, 'from flask import Flask, jsonify\n')] |
# adapted from yolor/test.py
import argparse
import glob
import json
import os
from pathlib import Path
import numpy as np
import torch
import yaml
from tqdm import tqdm
from yolor.utils.google_utils import attempt_load
from yolor.utils.datasets import create_dataloader
from yolor.utils.general import coco80_to_coco9... | [
"yolor.utils.general.scale_coords",
"yolor.utils.general.coco80_to_coco91_class",
"yolor.utils.general.check_file",
"yolor.utils.general.set_logging",
"yaml.load",
"objseeker.defense.YOLO_wrapper",
"yolor.utils.general.check_img_size",
"os.path.exists",
"argparse.ArgumentParser",
"pathlib.Path",
... | [((1713, 1721), 'pathlib.Path', 'Path', (['""""""'], {}), "('')\n", (1717, 1721), False, 'from pathlib import Path\n'), ((3492, 3511), 'yolor.utils.general.check_dataset', 'check_dataset', (['data'], {}), '(data)\n', (3505, 3511), False, 'from yolor.utils.general import coco80_to_coco91_class, check_dataset, check_file... |
from SimpleHTTPServer import SimpleHTTPRequestHandler
from logging import getLogger
import BaseHTTPServer
import logging
import os
import posixpath
import sys
import threading
import time
import urllib
LOG = getLogger(__name__)
class BetterHTTPRequestHandler(SimpleHTTPRequestHandler):
working_dir = None
def... | [
"logging.getLogger",
"logging.basicConfig",
"os.path.exists",
"os.path.splitdrive",
"urllib.unquote",
"os.path.join",
"time.sleep",
"os.getcwd",
"os.path.split",
"os.path.isdir",
"threading.Thread"
] | [((209, 228), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (218, 228), False, 'from logging import getLogger\n'), ((4252, 4286), 'os.path.join', 'os.path.join', (['case.root', 'directory'], {}), '(case.root, directory)\n', (4264, 4286), False, 'import os\n'), ((4367, 4402), 'threading.Thread', ... |
"""********************************************************************************************************************
|
| Name : export_hostfindings.py
| Description : Exports and downloads a csv file containing hostfindings from the RiskSense platform via the REST API.
| Copyright : (c) RiskSense, Inc... | [
"os.path.exists",
"json.loads",
"zipfile.ZipFile",
"os.makedirs",
"json.dumps",
"os.path.join",
"time.sleep",
"requests.get",
"os.getcwd",
"os.replace",
"toml.loads",
"os.path.dirname",
"datetime.date.today",
"os.remove"
] | [((25491, 25524), 'requests.get', 'requests.get', (['url'], {'headers': 'header'}), '(url, headers=header)\n', (25503, 25524), False, 'import requests\n'), ((26349, 26370), 'toml.loads', 'toml.loads', (['toml_data'], {}), '(toml_data)\n', (26359, 26370), False, 'import toml\n'), ((24069, 24094), 'json.loads', 'json.loa... |
#!/usr/bin/env python3
from pde import (DiffusionPDE, UnitGrid, ScalarField, MemoryStorage,
PlotTracker, PrintTracker, RealtimeIntervals)
eq = DiffusionPDE() # define the pde
grid = UnitGrid([16, 16]) # generate grid
state = ScalarField.random... | [
"pde.UnitGrid",
"pde.MemoryStorage",
"pde.DiffusionPDE",
"pde.RealtimeIntervals",
"pde.ScalarField.random_uniform",
"pde.PlotTracker"
] | [((162, 176), 'pde.DiffusionPDE', 'DiffusionPDE', ([], {}), '()\n', (174, 176), False, 'from pde import DiffusionPDE, UnitGrid, ScalarField, MemoryStorage, PlotTracker, PrintTracker, RealtimeIntervals\n'), ((233, 251), 'pde.UnitGrid', 'UnitGrid', (['[16, 16]'], {}), '([16, 16])\n', (241, 251), False, 'from pde import D... |
# Copyright 2014 Baidu, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | [
"mock.patch",
"baidubce.services.bmr.bmr_client.hive_step_properties",
"baidubce.services.bmr.bmr_client.streaming_step_properties",
"json.dumps",
"baidubce.services.bmr.bmr_client.BmrClient",
"baidubce.services.bmr.bmr_client.java_step_properties",
"os.path.dirname",
"baidubce.services.bmr.bmr_client... | [((710, 748), 'sys.path.append', 'sys.path.append', (["(file_path + '/../../')"], {}), "(file_path + '/../../')\n", (725, 748), False, 'import sys\n'), ((683, 708), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (698, 708), False, 'import os\n'), ((2055, 2117), 'mock.patch', 'mock.patch', (['... |
import clr
clr.AddReference('MinadNet')
from System import AppDomain
AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", "./app.config")
import time
import gc
from System import Console
from System.Net.Sockets import *
from System.Net import *
from MinadNet import *
from MinadNet.Pools import BufferPool
... | [
"gc.disable",
"clr.AddReference",
"MinadNet.Pools.BufferPool",
"System.AppDomain.CurrentDomain.SetData"
] | [((12, 40), 'clr.AddReference', 'clr.AddReference', (['"""MinadNet"""'], {}), "('MinadNet')\n", (28, 40), False, 'import clr\n'), ((72, 138), 'System.AppDomain.CurrentDomain.SetData', 'AppDomain.CurrentDomain.SetData', (['"""APP_CONFIG_FILE"""', '"""./app.config"""'], {}), "('APP_CONFIG_FILE', './app.config')\n", (103,... |
"""
============================
Typing (:mod:`numpy.typing`)
============================
.. warning::
Some of the types in this module rely on features only present in
the standard library in Python 3.8 and greater. If you want to use
these types in earlier versions of Python, you should install the
typing-... | [
"numpy._pytesttester.PytestTester"
] | [((5781, 5803), 'numpy._pytesttester.PytestTester', 'PytestTester', (['__name__'], {}), '(__name__)\n', (5793, 5803), False, 'from numpy._pytesttester import PytestTester\n')] |
from odoo import _, api, fields, models
class Quotations(models.Model):
_inherit = "sale.order"
note_on_customer = fields.Text("Note on Customer",
help="Add Notes on Customers!")
| [
"odoo.fields.Text"
] | [((126, 189), 'odoo.fields.Text', 'fields.Text', (['"""Note on Customer"""'], {'help': '"""Add Notes on Customers!"""'}), "('Note on Customer', help='Add Notes on Customers!')\n", (137, 189), False, 'from odoo import _, api, fields, models\n')] |
# from flask import render_template, redirect, url_for,abort,request
# from . import main
# from flask_login import login_required,current_user
# from ..models import User,Blog,Comment
# from .forms import UpdateProfile,BlogForm,CommentForm
# from .. import db,photos
# @main.route('/')
# def index():
# quote =Blog... | [
"flask.render_template",
"flask.request.args.get",
"secrets.token_hex",
"app.models.Comment",
"app.models.Subscriber.query.all",
"app.models.Blog.query.get",
"app.main.main.route",
"flask.flash",
"flask.request.form.get",
"app.models.Blog.query.filter_by",
"app.models.Blog",
"app.models.Blog.q... | [((4598, 4613), 'app.main.main.route', 'main.route', (['"""/"""'], {}), "('/')\n", (4608, 4613), False, 'from app.main import main\n'), ((5250, 5297), 'app.main.main.route', 'main.route', (['"""/profile"""'], {'methods': "['POST', 'GET']"}), "('/profile', methods=['POST', 'GET'])\n", (5260, 5297), False, 'from app.main... |
import os
import logging
class Report(object):
"""Report
A Report object generates a report in the form of a HTML-page of a list of
hypervisors and information about how certain migrations improve the
resource distribution.
"""
def __init__(self, inventory, template='template.html'):
... | [
"os.path.abspath",
"logging.error"
] | [((758, 809), 'logging.error', 'logging.error', (['"""Could not load %s: %s"""', 'filename', 'e'], {}), "('Could not load %s: %s', filename, e)\n", (771, 809), False, 'import logging\n'), ((1400, 1425), 'os.path.abspath', 'os.path.abspath', (['filename'], {}), '(filename)\n', (1415, 1425), False, 'import os\n')] |
from sortedcontainers import SortedSet
import math
EPSILON = 0.001
def cmp_to_key(mycmp):
'Convert a cmp= function into a key= function'
class K:
def __init__(self, obj, *args):
self.obj = obj
def __lt__(self, other):
return mycmp(self.obj, other.obj) < 0
def __g... | [
"math.hypot"
] | [((6179, 6270), 'math.hypot', 'math.hypot', (['(self._start.first - self._end.first)', '(self._start.second - self._end.second)'], {}), '(self._start.first - self._end.first, self._start.second - self.\n _end.second)\n', (6189, 6270), False, 'import math\n'), ((6296, 6374), 'math.hypot', 'math.hypot', (['(self._star... |
# Generated by Django 3.2.7 on 2021-12-09 11:49
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import simple_history.models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swa... | [
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.BigIntegerField",
"django.db.models.BigAutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((306, 363), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (337, 363), False, 'from django.db import migrations, models\n'), ((736, 827), 'django.db.models.BigIntegerField', 'models.BigIntegerField', ([], {'auto_creat... |
#
#
# The Multiverse Platform is made available under the MIT License.
#
# Copyright (c) 2012 The Multiverse Foundation
#
# 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 restri... | [
"subprocess.Popen",
"os.path.join",
"struct.unpack",
"tempfile.mkdtemp",
"os.path.basename",
"shutil.rmtree"
] | [((1941, 1959), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (1957, 1959), False, 'import tempfile\n'), ((1978, 1996), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (1994, 1996), False, 'import tempfile\n'), ((6835, 6888), 'subprocess.Popen', 'subprocess.Popen', (['createAtlasCmd'], {'cwd': 'At... |
import random
class BaseAugmenter:
def __init__(self):
self.augmentation = []
def add_augmentation(self, augmentation):
self.augmentation.append(augmentation)
def __call__(self, images):
aug = random.choice(self.augmentation)
return aug(images) | [
"random.choice"
] | [((236, 268), 'random.choice', 'random.choice', (['self.augmentation'], {}), '(self.augmentation)\n', (249, 268), False, 'import random\n')] |
from nsl.passes.ValidateVariableNames import (
ValidateVariableNamesVisitor
)
import nsl.ast, nsl.types
import nsl.Errors
class TestValidateVariableNames:
def testReusingArgumentNameForLocalVariableFails(self):
f = nsl.ast.Function("foo",
[nsl.ast.Argument(nsl.types.Integer (), "a")],
... | [
"nsl.passes.ValidateVariableNames.ValidateVariableNamesVisitor"
] | [((417, 447), 'nsl.passes.ValidateVariableNames.ValidateVariableNamesVisitor', 'ValidateVariableNamesVisitor', ([], {}), '()\n', (445, 447), False, 'from nsl.passes.ValidateVariableNames import ValidateVariableNamesVisitor\n')] |
from django.contrib import admin
from .models import BookModel
admin.site.register(BookModel) | [
"django.contrib.admin.site.register"
] | [((65, 95), 'django.contrib.admin.site.register', 'admin.site.register', (['BookModel'], {}), '(BookModel)\n', (84, 95), False, 'from django.contrib import admin\n')] |
"""Simple command line utility called `lumi`.
The cli is composed of subcommands that are able to handle different tasks
needed for training and using deep learning models.
It's base subcommands are:
train: For training locally.
cloud: For traning and monitoring in the cloud.
dataset: For modifying and tr... | [
"click.group"
] | [((760, 806), 'click.group', 'click.group', ([], {'context_settings': 'CONTEXT_SETTINGS'}), '(context_settings=CONTEXT_SETTINGS)\n', (771, 806), False, 'import click\n')] |
import copy
import errno
import os
import logging
import math
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.parallel import DistributedDataParallel
from .helper import TensorBoardWriter
from .linear_eval import iter_eval_epoch, linear_eval_online, linear_eval_offline
from data import... | [
"logging.getLogger",
"torch.nn.CrossEntropyLoss",
"data.get_loaders_for_trainer",
"math.cos",
"os.remove",
"os.path.exists",
"torch.cuda.amp.GradScaler",
"models.Backbone.init_from_config",
"optim.get_optimizer_and_scheduler",
"utils.unwrap_if_distributed",
"models.heads.TwoLayerLinearHead.init_... | [((507, 532), 'logging.getLogger', 'logging.getLogger', (['"""main"""'], {}), "('main')\n", (524, 532), False, 'import logging\n'), ((537, 561), 'utils.Colorer.instance', 'utils.Colorer.instance', ([], {}), '()\n', (559, 561), False, 'import utils\n'), ((857, 883), 'torch.nn.functional.normalize', 'F.normalize', (['x']... |
# -*- coding: UTF-8 -*-
import logging
import math
import os
import qgis
import qgis.core
import qgis.utils
from pyspatialopt import version
def generate_query(unique_ids, unique_field_name, wrap_values_in_quotes=False):
"""
Generates a select or definition query that can applied to the input layers
:para... | [
"logging.getLogger"
] | [((2567, 2586), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (2584, 2586), False, 'import logging\n'), ((3129, 3148), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (3146, 3148), False, 'import logging\n'), ((3441, 3460), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (3458, 346... |
#! /usr/bin/env python3
"""
separate folders and files into categories
"""
import os
def main():
cwd = os.getcwd()
print(cwd)
...
if __name__ == "__main__":
print()
msg = "START separate_torrent_types START"
print(msg)
main()
msg = "END separate_torrent_types END"
print(msg)
... | [
"os.getcwd"
] | [((109, 120), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (118, 120), False, 'import os\n')] |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 29 12:58:13 2016
@author: benny
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import (
assert_, TestCase, run_module_suite, assert_array_almost_equal,
assert_raises, assert_allclose, assert_array_equa... | [
"numpy.allclose",
"numpy.sqrt",
"scikits.odes.ode",
"numpy.array",
"numpy.zeros",
"numpy.dot",
"numpy.cos",
"numpy.sin"
] | [((682, 709), 'numpy.array', 'np.array', (['[1.0, 0.1]', 'float'], {}), '([1.0, 0.1], float)\n', (690, 709), True, 'import numpy as np\n'), ((810, 833), 'numpy.zeros', 'np.zeros', (['(2, 2)', 'float'], {}), '((2, 2), float)\n', (818, 833), True, 'import numpy as np\n'), ((975, 999), 'numpy.sqrt', 'np.sqrt', (['(self.k ... |
"""
Code inspired from: https://github.com/jchibane/if-net/blob/master/data_processing/voxelized_pointcloud_sampling.py
"""
import utils.implicit_waterproofing as iw
from scipy.spatial import cKDTree as KDTree
import numpy as np
import trimesh
import glob
import os
from os.path import join, split, exists
import argpar... | [
"os.path.exists",
"argparse.ArgumentParser",
"utils.voxelized_pointcloud_sampling.voxelize",
"os.path.split",
"trimesh.load",
"opendr.renderer.DepthRenderer",
"numpy.array",
"numpy.zeros",
"numpy.min"
] | [((805, 880), 'opendr.renderer.DepthRenderer', 'DepthRenderer', ([], {'camera': 'camera', 'frustum': 'frustum', 'f': 'mesh.faces', 'overdraw': '(False)'}), '(camera=camera, frustum=frustum, f=mesh.faces, overdraw=False)\n', (818, 880), False, 'from opendr.renderer import DepthRenderer\n'), ((1520, 1543), 'trimesh.load'... |
# -*- coding: utf-8 -*-
import re
from django.utils.translation import ugettext as _
def validate_password(password):
"""
Validate whether the password meets all validator requirements.
If the password is valid, return ``None``.
If the password is invalid, raise ValidationError with all error message... | [
"django.utils.translation.ugettext",
"re.search"
] | [((444, 472), 're.search', 're.search', (['"""[0-9]"""', 'password'], {}), "('[0-9]', password)\n", (453, 472), False, 'import re\n'), ((536, 564), 're.search', 're.search', (['"""[A-Z]"""', 'password'], {}), "('[A-Z]', password)\n", (545, 564), False, 'import re\n'), ((636, 671), 're.search', 're.search', (['"""[^a-zA... |
import numpy
import cupy
from cupy import elementwise
def arange(start, stop=None, step=1, dtype=None):
"""Rerurns an array with evenly spaced values within a given interval.
Values are generated within the half-open interval [start, stop). The first
three arguments are mapped like the ``range`` built-i... | [
"numpy.dtype",
"cupy.empty",
"numpy.ceil",
"cupy.elementwise.create_ufunc"
] | [((2940, 3130), 'cupy.elementwise.create_ufunc', 'elementwise.create_ufunc', (['"""cupy_arange"""', "('bb->b', 'BB->B', 'hh->h', 'HH->H', 'ii->i', 'II->I', 'll->l', 'LL->L',\n 'qq->q', 'QQ->Q', 'ee->e', 'ff->f', 'dd->d')", '"""out0 = in0 + i * in1"""'], {}), "('cupy_arange', ('bb->b', 'BB->B', 'hh->h', 'HH->H',\n ... |
import pandas as pd
import requests
import calendar
import datetime
import os
from datetime import datetime
from datetime import date
import petaldata
from petaldata import util
class Contact(object):
RESOURCE_URL = '/hubspot/contacts'
def __init__(self,pickle_filename="hubspot_contact.pkl"):
self.csv_filena... | [
"pandas.read_pickle",
"requests.get",
"os.path.isfile",
"datetime.datetime.now",
"os.path.realpath",
"petaldata.util.file_size_in_mb",
"pandas.concat"
] | [((832, 868), 'os.path.isfile', 'os.path.isfile', (['self.pickle_filename'], {}), '(self.pickle_filename)\n', (846, 868), False, 'import os\n'), ((1043, 1120), 'requests.get', 'requests.get', (["(self.api_url + '/metadata.pandas')"], {'headers': 'self.request_headers'}), "(self.api_url + '/metadata.pandas', headers=sel... |
__author__ = "<NAME>"
import matplotlib
from myHistEqLogic import *
# Do it to see a new window when calling plt.show, and not within PyCharm.
matplotlib.use('TkAgg')
def histogramEqualization(img):
img = np.float64(img)
pdf = myPDF(img)
if pdf is None:
return None
cdf = myCD... | [
"matplotlib.use"
] | [((151, 174), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (165, 174), False, 'import matplotlib\n')] |
import pickle
from builtins import open # Keep in context
from pathlib import Path
from config import DATA_FILE
@type.__call__
class PersistentData:
def __init__(self):
if Path(DATA_FILE).exists():
ns = pickle.load(open(Path(DATA_FILE), 'rb'))
self.__dict__.update(ns)
def __... | [
"pathlib.Path"
] | [((188, 203), 'pathlib.Path', 'Path', (['DATA_FILE'], {}), '(DATA_FILE)\n', (192, 203), False, 'from pathlib import Path\n'), ((389, 404), 'pathlib.Path', 'Path', (['DATA_FILE'], {}), '(DATA_FILE)\n', (393, 404), False, 'from pathlib import Path\n'), ((248, 263), 'pathlib.Path', 'Path', (['DATA_FILE'], {}), '(DATA_FILE... |
'''
Created by <NAME>
7/2/2018
orignize info in nodule_chara_list.csv and list3.2.csv
and save as malignancy.csv
'''
import os
import csvTools
basedir = 'D:/Data/LIDC-IDRI/DOI/'
csvdir= 'files/'
def caseid_to_scanid(caseid):
returnstr = ''
if caseid < 10:
returnstr = '000' + str(caseid)
elif ca... | [
"csvTools.readCSV",
"csvTools.writeCSV"
] | [((758, 808), 'csvTools.readCSV', 'csvTools.readCSV', (["(csvdir + 'nodule_chara_list.csv')"], {}), "(csvdir + 'nodule_chara_list.csv')\n", (774, 808), False, 'import csvTools\n'), ((818, 858), 'csvTools.readCSV', 'csvTools.readCSV', (["(csvdir + 'list3.2.csv')"], {}), "(csvdir + 'list3.2.csv')\n", (834, 858), False, '... |
import time
from ProgressBar import ProgressBar
max_value = 50
progress_bar = ProgressBar(max_value)
for i in progress_bar():
progress_bar.progress(i, "already download {}%".format(int((i + 1) / max_value * 100)))
time.sleep(0.2)
progress_bar.end()
| [
"ProgressBar.ProgressBar",
"time.sleep"
] | [((79, 101), 'ProgressBar.ProgressBar', 'ProgressBar', (['max_value'], {}), '(max_value)\n', (90, 101), False, 'from ProgressBar import ProgressBar\n'), ((223, 238), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (233, 238), False, 'import time\n')] |
from gyomu.status_code import StatusCode, static_init
@static_init
class CommonStatusCode(StatusCode):
APP_ID = 0x1
@classmethod
def static_initialize(cls):
cls.EMAIL_SEND_ERROR = StatusCode._code_gen(cls.APP_ID, StatusCode.ERROR_DEVELOPER, 0x10,
... | [
"gyomu.status_code.StatusCode._code_gen"
] | [((203, 296), 'gyomu.status_code.StatusCode._code_gen', 'StatusCode._code_gen', (['cls.APP_ID', 'StatusCode.ERROR_DEVELOPER', '(16)', '"""Email Sent Failed"""', '""""""'], {}), "(cls.APP_ID, StatusCode.ERROR_DEVELOPER, 16,\n 'Email Sent Failed', '')\n", (223, 296), False, 'from gyomu.status_code import StatusCode, s... |
from django.http import HttpResponse
from django.utils.encoding import smart_str
def sendfile(request, filename, **kwargs):
response = HttpResponse()
response['X-Sendfile'] = smart_str(filename)
return response
| [
"django.http.HttpResponse",
"django.utils.encoding.smart_str"
] | [((141, 155), 'django.http.HttpResponse', 'HttpResponse', ([], {}), '()\n', (153, 155), False, 'from django.http import HttpResponse\n'), ((185, 204), 'django.utils.encoding.smart_str', 'smart_str', (['filename'], {}), '(filename)\n', (194, 204), False, 'from django.utils.encoding import smart_str\n')] |
from abc import ABCMeta, abstractmethod
from threading import Event, Thread
from six.moves import queue
from six import with_metaclass
from traits.api import HasTraits, Any, Instance
class AsyncLoader(HasTraits):
""" A class which executes generic 'request' objects off of the main thread
"""
def start(... | [
"threading.Event",
"traits.api.Instance",
"six.moves.queue.Queue",
"six.with_metaclass"
] | [((892, 923), 'six.with_metaclass', 'with_metaclass', (['ABCMeta', 'object'], {}), '(ABCMeta, object)\n', (906, 923), False, 'from six import with_metaclass\n'), ((630, 651), 'traits.api.Instance', 'Instance', (['queue.Queue'], {}), '(queue.Queue)\n', (638, 651), False, 'from traits.api import HasTraits, Any, Instance\... |
# Generated by Django 3.2.5 on 2021-07-29 13:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('book', '0003_readinghistory_counter'),
]
operations = [
migrations.CreateModel(
... | [
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.BigAutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((382, 478), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (401, 478), False, 'from django.db import migrations, m... |
# CPLEX model for the choice-based facility location
# and pricing problem with discrete prices (compact formulation)
# Alternatives are duplicated to account for different possible price levels.
# General
import time
import numpy as np
# CPLEX
import cplex
from cplex.exceptions import CplexSolverError
#... | [
"data_N08_I10.printCustomers",
"data_N08_I10.getData",
"cplex.Cplex",
"numpy.empty",
"data_N08_I10.preprocessUtilities",
"functions.calcDuplicatedUtilities",
"functions.discretePriceAlternativeDuplication",
"time.time"
] | [((493, 504), 'time.time', 'time.time', ([], {}), '()\n', (502, 504), False, 'import time\n'), ((518, 531), 'cplex.Cplex', 'cplex.Cplex', ([], {}), '()\n', (529, 531), False, 'import cplex\n'), ((9536, 9549), 'cplex.Cplex', 'cplex.Cplex', ([], {}), '()\n', (9547, 9549), False, 'import cplex\n'), ((15631, 15644), 'cplex... |
"""
This is an example of the application of DeepESN model for multivariate time-series prediction task
on Piano-midi.de (see http://www-etud.iro.umontreal.ca/~boulanni/icml2012) dataset.
The dataset is a polyphonic music task characterized by 88-dimensional sequences representing musical compositions.
Starting from p... | [
"numpy.mean",
"pathlib.Path",
"time.perf_counter",
"utils.select_indexes",
"numpy.random.seed",
"DeepESN.DeepESN",
"utils.load_pianomidi"
] | [((1454, 1473), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (1471, 1473), False, 'import time\n'), ((1535, 1552), 'numpy.random.seed', 'np.random.seed', (['(7)'], {}), '(7)\n', (1549, 1552), True, 'import numpy as np\n'), ((1588, 1600), 'pathlib.Path', 'Path', (['"""data"""'], {}), "('data')\n", (1592, ... |
from typing import Optional, List
from seedwork.domain.entities import Aggregate
from seedwork.domain.value_objects import UUID
from modules.iam.domain.value_objects import Session
ANONYMOUS_ID = UUID("00000000-0000-0000-0000-000000000000")
class User(Aggregate):
id: UUID
username: str
email: str = ""
... | [
"seedwork.domain.value_objects.UUID"
] | [((198, 242), 'seedwork.domain.value_objects.UUID', 'UUID', (['"""00000000-0000-0000-0000-000000000000"""'], {}), "('00000000-0000-0000-0000-000000000000')\n", (202, 242), False, 'from seedwork.domain.value_objects import UUID\n')] |
#!/usr/bin/env python
"""Serves .webapp/.json manifest files from the working directory."""
import logging
import optparse
import os
from wsgiref import simple_server
log = logging.getLogger(__name__)
document_root = os.getcwd()
def fileapp(environ, start_response):
path_info = environ['PATH_INFO']
if path_... | [
"logging.getLogger",
"logging.basicConfig",
"wsgiref.simple_server.WSGIServer",
"os.listdir",
"os.path.join",
"optparse.OptionParser",
"os.getcwd",
"os.path.isdir"
] | [((175, 202), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (192, 202), False, 'import logging\n'), ((219, 230), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (228, 230), False, 'import os\n'), ((409, 447), 'os.path.join', 'os.path.join', (['document_root', 'path_info'], {}), '(document_ro... |
import numpy as np
import pandas as pd
import util
from othello import Othello
from constants import COLUMN_NAMES
class StartTables:
_start_tables = []
def _init_start_tables(self):
"""
read start tables from csv file 'start_moves.csv'
and store them in _start_tables
"""
... | [
"util.translate_move_to_pair",
"numpy.array",
"pandas.read_csv"
] | [((329, 359), 'pandas.read_csv', 'pd.read_csv', (['"""start_moves.csv"""'], {}), "('start_moves.csv')\n", (340, 359), True, 'import pandas as pd\n'), ((389, 415), 'numpy.array', 'np.array', (['csv'], {'dtype': '"""str"""'}), "(csv, dtype='str')\n", (397, 415), True, 'import numpy as np\n'), ((4459, 4492), 'util.transla... |
from django.dispatch import Signal
handler_add = Signal(providing_args=["user"])
view_init = Signal(providing_args=["user"]) | [
"django.dispatch.Signal"
] | [((50, 81), 'django.dispatch.Signal', 'Signal', ([], {'providing_args': "['user']"}), "(providing_args=['user'])\n", (56, 81), False, 'from django.dispatch import Signal\n'), ((94, 125), 'django.dispatch.Signal', 'Signal', ([], {'providing_args': "['user']"}), "(providing_args=['user'])\n", (100, 125), False, 'from dja... |
from torchtext.data.datasets_utils import (
_RawTextIterableDataset,
_wrap_split_argument,
_add_docstring_header,
_download_extract_validate,
_create_dataset_directory,
_create_data_from_iob,
)
import os
import logging
URL = {
'train': "https://www.clips.uantwerpen.be/conll2000/chunking/tra... | [
"torchtext.data.datasets_utils._wrap_split_argument",
"os.path.join",
"torchtext.data.datasets_utils._add_docstring_header",
"torchtext.data.datasets_utils._create_dataset_directory",
"torchtext.data.datasets_utils._create_data_from_iob"
] | [((811, 853), 'torchtext.data.datasets_utils._add_docstring_header', '_add_docstring_header', ([], {'num_lines': 'NUM_LINES'}), '(num_lines=NUM_LINES)\n', (832, 853), False, 'from torchtext.data.datasets_utils import _RawTextIterableDataset, _wrap_split_argument, _add_docstring_header, _download_extract_validate, _crea... |
#!/usr/bin/env python3
# Copyright (c) 2017 <NAME>. All rights reserved
# coding=utf-8
# -*- coding: utf8 -*-
# my_colWriter is a module to write a column type file with file path, fpath, and
# file name, fname. xList is a list of list corresponding to the input values.
# dataList is the corresponding results. x... | [
"os.path.join",
"os.path.isdir",
"doctest.testmod",
"os.makedirs"
] | [((3621, 3638), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (3636, 3638), False, 'import doctest\n'), ((1676, 1696), 'os.path.isdir', 'os.path.isdir', (['fpath'], {}), '(fpath)\n', (1689, 1696), False, 'import os\n'), ((1710, 1728), 'os.makedirs', 'os.makedirs', (['fpath'], {}), '(fpath)\n', (1721, 1728), F... |
# coding=utf-8
import numpy as np
import pytest
from matplotlib import pyplot as plt
from ..algorithms import density_profiles
from ..classes import Species, Simulation
from pythonpic.classes import PeriodicTestGrid
from pythonpic.classes import TestSpecies as Species
from ..visualization.time_snapshots import Spatial... | [
"numpy.allclose",
"pythonpic.classes.TestSpecies",
"pytest.mark.parametrize",
"numpy.linspace",
"numpy.random.seed",
"matplotlib.pyplot.subplots",
"pytest.fixture",
"pythonpic.classes.PeriodicTestGrid",
"matplotlib.pyplot.show"
] | [((815, 831), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (829, 831), False, 'import pytest\n'), ((1358, 1397), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""std"""', '[1e-05]'], {}), "('std', [1e-05])\n", (1381, 1397), False, 'import pytest\n'), ((919, 948), 'pythonpic.classes.PeriodicTestGrid'... |
import os
import glob
import pandas as pd
# Get latest file
list_of_files = glob.glob('../../data-truth/JHU/raw/*')
latest_file = max(list_of_files, key=os.path.getctime)
df = pd.read_csv(latest_file)
# Transform to standard format
df = df[df['Country/Region'] == 'Germany']
df.drop(columns=['Province/State', 'Country... | [
"pandas.to_datetime",
"glob.glob",
"pandas.read_csv"
] | [((77, 116), 'glob.glob', 'glob.glob', (['"""../../data-truth/JHU/raw/*"""'], {}), "('../../data-truth/JHU/raw/*')\n", (86, 116), False, 'import glob\n'), ((177, 201), 'pandas.read_csv', 'pd.read_csv', (['latest_file'], {}), '(latest_file)\n', (188, 201), True, 'import pandas as pd\n'), ((423, 446), 'pandas.to_datetime... |
#
# Autogenerated by Thrift Compiler (0.14.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive impo... | [
"thrift.TRecursive.fix_spec"
] | [((3923, 3944), 'thrift.TRecursive.fix_spec', 'fix_spec', (['all_structs'], {}), '(all_structs)\n', (3931, 3944), False, 'from thrift.TRecursive import fix_spec\n')] |
"""Utility file for CUDA and GPU-specific functions."""
import torch
import torch.backends.cudnn as cudnn
def setup_gpus(gpu_ids):
"""Set up the GPUs and return the device to be used.
Args:
gpu_ids (list): list of GPU IDs
Returns:
device (str): the device, either 'cuda' or 'cpu'
"... | [
"torch.cuda.is_available",
"torch.cuda.set_device"
] | [((369, 394), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (392, 394), False, 'import torch\n'), ((404, 437), 'torch.cuda.set_device', 'torch.cuda.set_device', (['gpu_ids[0]'], {}), '(gpu_ids[0])\n', (425, 437), False, 'import torch\n')] |
#!/usr/bin/python3
import operator
import sys
import json
import os
sys.path.append("..")
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../lbdiemsdk/src"))
import requests
import typing
from diem import (
diem_types,
jsonrpc,
utils,
chain_ids,
bcs,
stdlib,
... | [
"requests.Session",
"diem.utils.account_address",
"diem.jsonrpc.Retry",
"os.path.abspath",
"sys.path.append"
] | [((68, 89), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (83, 89), False, 'import sys\n'), ((564, 621), 'diem.utils.account_address', 'utils.account_address', (['"""000000000000000000000000000000dd"""'], {}), "('000000000000000000000000000000dd')\n", (585, 621), False, 'from diem import diem_ty... |
# --------------------------------------------------------------------------------------------------
# Copyright (c) 2021 Microsoft Corporation
#
# 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 Softw... | [
"pandas.read_csv",
"os.scandir",
"seaborn.lineplot",
"os.path.normpath",
"os.path.abspath",
"pandas.concat",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1498, 1518), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (1513, 1518), False, 'import os\n'), ((2044, 2094), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {'figsize': '(20, 10)', 'sharey': '(False)'}), '(2, 2, figsize=(20, 10), sharey=False)\n', (2056, 2094), True, 'import ma... |
###############################################
#### LOGGING CLASS SETTINGS (py25+, py30+) ####
###############################################
#### also will work with py23, py24 without 'encoding' arg
import logging
import logging.handlers
f = logging.Formatter(fmt='%(levelname)s:%(name)s: %(message)s '
'(%(ascti... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"logging.config.dictConfig",
"logging.handlers.RotatingFileHandler",
"logging.config.fileConfig"
] | [((246, 384), 'logging.Formatter', 'logging.Formatter', ([], {'fmt': '"""%(levelname)s:%(name)s: %(message)s (%(asctime)s; %(filename)s:%(lineno)d)"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(fmt=\n '%(levelname)s:%(name)s: %(message)s (%(asctime)s; %(filename)s:%(lineno)d)'\n , datefmt='%Y-%m-%d %H:%M:%S')\n"... |
# -*- coding: utf-8 -*-
import helics as h
import time
import struct
fed = h.helicsCreateCombinationFederateFromConfig("receiver.json")
sub = h.helicsFederateGetSubscription(fed, "data")
h.helicsFederateEnterExecutingMode(fed)
granted_time = -1
request_time = 1000
while granted_time < 10:
granted_time = h.helicsFe... | [
"helics.helicsCloseLibrary",
"helics.helicsFederateRequestTime",
"helics.helicsCreateCombinationFederateFromConfig",
"helics.helicsFederateFree",
"helics.helicsFederateFinalize",
"helics.helicsFederateEnterExecutingMode",
"helics.helicsInputGetDouble",
"helics.helicsFederateGetSubscription"
] | [((76, 136), 'helics.helicsCreateCombinationFederateFromConfig', 'h.helicsCreateCombinationFederateFromConfig', (['"""receiver.json"""'], {}), "('receiver.json')\n", (119, 136), True, 'import helics as h\n'), ((143, 187), 'helics.helicsFederateGetSubscription', 'h.helicsFederateGetSubscription', (['fed', '"""data"""'],... |
from distutils.core import setup
setup(
name = 'dstk',
packages = ['dstk'], # this must be the same as the name above
version = '0.1',
description = 'A toolkit for data scientists.',
author = '<NAME>',
author_email = '<EMAIL>',
url = 'https://github.com/savourylie/dstk.git', # use the URL to the github r... | [
"distutils.core.setup"
] | [((34, 410), 'distutils.core.setup', 'setup', ([], {'name': '"""dstk"""', 'packages': "['dstk']", 'version': '"""0.1"""', 'description': '"""A toolkit for data scientists."""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/savourylie/dstk.git"""', 'download_url': '"""https://g... |
# -*- coding: utf-8 -*-
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
import pytest
from goodplay.ansible_support import is_test_playbook_file
class CollectOnlyTestPlaybooks(object):
def pytest_ignore_collect(self, path, config):
# do not ignore direc... | [
"goodplay.ansible_support.is_test_playbook_file",
"pytest.main"
] | [((584, 623), 'pytest.main', 'pytest.main', ([], {'plugins': 'additional_plugins'}), '(plugins=additional_plugins)\n', (595, 623), False, 'import pytest\n'), ((466, 493), 'goodplay.ansible_support.is_test_playbook_file', 'is_test_playbook_file', (['path'], {}), '(path)\n', (487, 493), False, 'from goodplay.ansible_supp... |
### Script designed to generate a pickle file from forward kinematics object FK
### in Forward_Kinematics.py
from time import time
import pickle
start_time = time()
from Forward_Kinematics import FK
# Pickle FK
pickle_out = open("FK.pickle", "wb")
pickle.dump(FK, pickle_out)
pickle_out.close()
# Unpickle FK
pickle... | [
"pickle.dump",
"pickle.load",
"time.time"
] | [((160, 166), 'time.time', 'time', ([], {}), '()\n', (164, 166), False, 'from time import time\n'), ((252, 279), 'pickle.dump', 'pickle.dump', (['FK', 'pickle_out'], {}), '(FK, pickle_out)\n', (263, 279), False, 'import pickle\n'), ((355, 377), 'pickle.load', 'pickle.load', (['pickle_in'], {}), '(pickle_in)\n', (366, 3... |
from .models import Node
from django.shortcuts import render
from django.http import JsonResponse, Http404
from django.core.exceptions import PermissionDenied
#from pprint import pprint
import re
import os
from django.conf import settings
from django.db.models import Q, Case, When
from django.shortcuts import redirect
... | [
"django.db.models.When",
"django.db.models.Q",
"django.shortcuts.redirect",
"django.http.Http404"
] | [((3696, 3714), 'django.http.Http404', 'Http404', (['exception'], {}), '(exception)\n', (3703, 3714), False, 'from django.http import JsonResponse, Http404\n'), ((5042, 5056), 'django.shortcuts.redirect', 'redirect', (['node'], {}), '(node)\n', (5050, 5056), False, 'from django.shortcuts import redirect\n'), ((5237, 52... |
from pathlib import Path
import plistlib
import yaml
from jinja2 import Template
IN_PATH = Path(__file__).parent.joinpath("../template/myst.tmLanguage.j2.yaml")
LANGUAGE_PATH = Path(__file__).parent.joinpath("../template/languages.yaml")
DIRECTIVE_PATH = Path(__file__).parent.joinpath("../template/directives.yaml")
O... | [
"yaml.safe_load",
"plistlib.dumps",
"jinja2.Template",
"pathlib.Path"
] | [((639, 662), 'jinja2.Template', 'Template', (['template_yaml'], {}), '(template_yaml)\n', (647, 662), False, 'from jinja2 import Template\n'), ((874, 900), 'yaml.safe_load', 'yaml.safe_load', (['input_yaml'], {}), '(input_yaml)\n', (888, 900), False, 'import yaml\n'), ((920, 957), 'plistlib.dumps', 'plistlib.dumps', (... |
"""
获取实时盘口数据
"""
import tushare as ts
from pymongo import MongoClient
import json
import time
stockList = ['600196','601933','600703']
# 根据stock列表获得实时数据,
df = ts.get_realtime_quotes(stockList) #Single stock symbol
# print(df)
# conn = MongoClient('172.16.17.32', 27017)
while True:
# 每隔3秒执行一次数据
time.sleep(3... | [
"time.sleep",
"tushare.get_realtime_quotes"
] | [((161, 194), 'tushare.get_realtime_quotes', 'ts.get_realtime_quotes', (['stockList'], {}), '(stockList)\n', (183, 194), True, 'import tushare as ts\n'), ((308, 321), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (318, 321), False, 'import time\n'), ((331, 364), 'tushare.get_realtime_quotes', 'ts.get_realtime_quo... |