code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
# Generated by Django 3.1.7 on 2021-03-17 21:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('game', '0007_auto_20210317_1822'),
]
operations = [
migrations.AlterField(
model_name='week',
name='order_placed',
... | [
"django.db.models.IntegerField"
] | [((337, 368), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(-1)'}), '(default=-1)\n', (356, 368), False, 'from django.db import migrations, models\n')] |
import bz2
if __name__ == '__main__':
f = bz2.open("mag-data/02.Authors.nt.bz2", "rb")
data = f.read()
print(data[:1])
obj = bz2.BZ2DeCompressor()
decompressed = obj.decompress(data[:1])
print(decompressed) | [
"bz2.open",
"bz2.BZ2DeCompressor"
] | [((50, 94), 'bz2.open', 'bz2.open', (['"""mag-data/02.Authors.nt.bz2"""', '"""rb"""'], {}), "('mag-data/02.Authors.nt.bz2', 'rb')\n", (58, 94), False, 'import bz2\n'), ((148, 169), 'bz2.BZ2DeCompressor', 'bz2.BZ2DeCompressor', ([], {}), '()\n', (167, 169), False, 'import bz2\n')] |
import pytest
import os
from tests.base import BaseTest
class TestFileHelper(BaseTest):
@pytest.fixture(scope='class')
def path(self, app):
"""
Create a path to a file for testing.
"""
path = app.session_file_output('test_file', 'test_file')
yield path
os.remo... | [
"os.remove",
"pytest.fixture",
"os.path.basename"
] | [((97, 126), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (111, 126), False, 'import pytest\n'), ((313, 328), 'os.remove', 'os.remove', (['path'], {}), '(path)\n', (322, 328), False, 'import os\n'), ((447, 469), 'os.path.basename', 'os.path.basename', (['path'], {}), '(path)\... |
import numpy as np
def get_num_atoms_in_formula_unit(configuration):
"""Return the number ot atoms per formula unit.
For unaries, it's the number in the primitive cell: 1 for SC, BCC, FCC; 2 for diamond.
"""
mapping = {
'XO': 2,
'XO2': 3,
'X2O': 3,
'X2O3': 5,
'X... | [
"numpy.zeros_like",
"numpy.sqrt"
] | [((7267, 7284), 'numpy.zeros_like', 'np.zeros_like', (['Vi'], {}), '(Vi)\n', (7280, 7284), True, 'import numpy as np\n'), ((7294, 7311), 'numpy.zeros_like', 'np.zeros_like', (['Vf'], {}), '(Vf)\n', (7307, 7311), True, 'import numpy as np\n'), ((7322, 7339), 'numpy.zeros_like', 'np.zeros_like', (['Vi'], {}), '(Vi)\n', (... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Python Standard Library Imports
import argparse
import logging
# Locals Imports
from pdfgen import engine
def parse_arguments(args=None):
argument_parser = argparse.ArgumentParser(description='Tinkertanker PDF Generator')
argument_parser.add_argument('-t', '-... | [
"pdfgen.engine.PdfGenerator",
"logging.getLogger",
"argparse.ArgumentParser",
"logging.basicConfig"
] | [((213, 278), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Tinkertanker PDF Generator"""'}), "(description='Tinkertanker PDF Generator')\n", (236, 278), False, 'import argparse\n'), ((1735, 1790), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': 'log_format', 'level': 'log... |
import os
import time
import requests,ssl
import argparse
import sys
import json, re
import getpass
from pprint import pprint
import logging
logging.captureWarnings(True)
logger = logging.getLogger('ncc_app')
stream_handler = logging.StreamHandler()
stream_handler.setFormatter(logging.Formatter('%(asctime)s - %(leveln... | [
"urllib.request.execute",
"argparse.ArgumentParser",
"json.loads",
"google.cloud.storage.Client.from_service_account_json",
"google.oauth2.service_account.Credentials.from_service_account_file",
"logging.StreamHandler",
"os.path.exists",
"jwt.encode",
"sys.exit",
"time.sleep",
"logging.Formatter... | [((142, 171), 'logging.captureWarnings', 'logging.captureWarnings', (['(True)'], {}), '(True)\n', (165, 171), False, 'import logging\n'), ((181, 209), 'logging.getLogger', 'logging.getLogger', (['"""ncc_app"""'], {}), "('ncc_app')\n", (198, 209), False, 'import logging\n'), ((227, 250), 'logging.StreamHandler', 'loggin... |
#!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... | [
"unittest.main"
] | [((8192, 8207), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8205, 8207), False, 'import unittest\n')] |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from pex.... | [
"pex.fetcher.Fetcher",
"pex.platforms.Platform.current",
"pex.interpreter.PythonInterpreter.get",
"os.path.join",
"pex.resolver.resolve"
] | [((2244, 2290), 'os.path.join', 'os.path.join', (['python_setup.scratch_dir', '"""eggs"""'], {}), "(python_setup.scratch_dir, 'eggs')\n", (2256, 2290), False, 'import os\n'), ((2052, 2075), 'pex.interpreter.PythonInterpreter.get', 'PythonInterpreter.get', ([], {}), '()\n', (2073, 2075), False, 'from pex.interpreter imp... |
import pprint
import ee
import pytest
import openet.ssebop.interpolate as interpolate
import openet.ssebop.utils as utils
def scene_coll(variables, et_fraction=0.4, et=5, ndvi=0.6):
"""Return a generic scene collection to test scene interpolation functions
Parameters
----------
variables : list
... | [
"ee.Image",
"ee.Date.fromYMD",
"openet.ssebop.utils.point_coll_value"
] | [((2364, 2421), 'openet.ssebop.utils.point_coll_value', 'utils.point_coll_value', (['output_coll', 'TEST_POINT'], {'scale': '(10)'}), '(output_coll, TEST_POINT, scale=10)\n', (2386, 2421), True, 'import openet.ssebop.utils as utils\n'), ((3608, 3665), 'openet.ssebop.utils.point_coll_value', 'utils.point_coll_value', ([... |
import unittest
import json
from datetime import datetime
from tests.helper import TestHelper
def find_with_tag_key(tag_list, tag_key):
for item in tag_list:
if item['tag_key'] == tag_key:
return item
return None
class BaseTagTest(object):
def __init__(self, test_obj):
self... | [
"unittest.main",
"tests.helper.TestHelper"
] | [((6859, 6874), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6872, 6874), False, 'import unittest\n'), ((4731, 4743), 'tests.helper.TestHelper', 'TestHelper', ([], {}), '()\n', (4741, 4743), False, 'from tests.helper import TestHelper\n')] |
import numpy as np
import dfcbenchmarker
def calc_new_method(x,new_method,params_new_method=None,mi='alpha'):
if params_new_method['name'] == None:
params_new_method['name'] = new_method.__name__
mi = list(x.index.names)
if len(x.index.names)>1:
mi.remove('time')
elif len(x.index.nam... | [
"dfcbenchmarker.multiindex_preproc",
"numpy.hstack",
"numpy.array",
"numpy.lib.pad",
"numpy.concatenate"
] | [((578, 623), 'dfcbenchmarker.multiindex_preproc', 'dfcbenchmarker.multiindex_preproc', (['params', 'mi'], {}), '(params, mi)\n', (611, 623), False, 'import dfcbenchmarker\n'), ((1494, 1522), 'numpy.concatenate', 'np.concatenate', (['dfc_estimate'], {}), '(dfc_estimate)\n', (1508, 1522), True, 'import numpy as np\n'), ... |
"""
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import sox
def fi... | [
"sox.file_info.duration",
"os.path.dirname",
"os.walk",
"os.path.join"
] | [((394, 406), 'os.walk', 'os.walk', (['dir'], {}), '(dir)\n', (401, 406), False, 'import os\n'), ((906, 927), 'os.path.dirname', 'os.path.dirname', (['file'], {}), '(file)\n', (921, 927), False, 'import os\n'), ((1092, 1135), 'os.path.join', 'os.path.join', (['audio_path', "(file_id + '.flac')"], {}), "(audio_path, fil... |
# -*- coding: utf-8 -*-
import Email
import random
import string
import time
class EmailBomb:
def __init__(self, id, to_addr, from_addr, SMTP_addr="", port=25, timeout=10):
self.status_header = "No.{}: ".format(id)
self.status = []
self.to_addr = to_addr
self.from_addr = from_addr
... | [
"random.random",
"Email.Email",
"random.choice",
"time.sleep"
] | [((1245, 1375), 'Email.Email', 'Email.Email', ([], {'to_addr': 'self.to_addr', 'from_addr': 'self.from_addr', 'SMTP_addrs': 'self.SMTP_addrs', 'port': 'self.port', 'timeout': 'self.timeout'}), '(to_addr=self.to_addr, from_addr=self.from_addr, SMTP_addrs=self\n .SMTP_addrs, port=self.port, timeout=self.timeout)\n', (... |
"""Create superuser command API."""
# pylint: disable-all
import asyncclick as click
from complainer.db import database
from complainer.managers.user import UserManager
from complainer.models import RoleType
@click.command()
@click.option('-f', '--first-name', type=str, required=True)
@click.option('-l', '--last-nam... | [
"asyncclick.command",
"complainer.db.database.connect",
"complainer.managers.user.UserManager.register",
"asyncclick.option",
"complainer.db.database.disconnect"
] | [((212, 227), 'asyncclick.command', 'click.command', ([], {}), '()\n', (225, 227), True, 'import asyncclick as click\n'), ((229, 288), 'asyncclick.option', 'click.option', (['"""-f"""', '"""--first-name"""'], {'type': 'str', 'required': '(True)'}), "('-f', '--first-name', type=str, required=True)\n", (241, 288), True, ... |
import torch
import torch.nn as nn
class RRDNet(nn.Module):
def __init__(self):
super(RRDNet, self).__init__()
self.illumination_net = nn.Sequential(
nn.Conv2d(3, 16, 3, 1, 1),
nn.ReLU(),
nn.Conv2d(16, 32, 3, 1, 1),
nn.ReLU(),
nn.Conv2d(3... | [
"torch.nn.Conv2d",
"torch.nn.ReLU"
] | [((184, 209), 'torch.nn.Conv2d', 'nn.Conv2d', (['(3)', '(16)', '(3)', '(1)', '(1)'], {}), '(3, 16, 3, 1, 1)\n', (193, 209), True, 'import torch.nn as nn\n'), ((223, 232), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (230, 232), True, 'import torch.nn as nn\n'), ((246, 272), 'torch.nn.Conv2d', 'nn.Conv2d', (['(16)', '(... |
#!/usr/bin/env python2
""" The Open JSON Format Parser """
# upconvert.py - A universal hardware design file format converter using
# Format: upverter.com/resources/open-json-format/
# Development: github.com/upverter/schematic-file-converter
#
# Copyright 2011 Upverter, Inc.
#
# Licensed under the Apache Licen... | [
"core.design_attributes.DesignAttributes",
"core.shape.Circle",
"core.component_instance.ComponentInstance",
"core.shape.Label",
"core.components.Pin",
"core.net.Net",
"core.shape.Polygon",
"core.component_instance.SymbolAttribute",
"core.annotation.Annotation",
"core.shape.RoundedRectangle",
"c... | [((1513, 1521), 'core.design.Design', 'Design', ([], {}), '()\n', (1519, 1521), False, 'from core.design import Design\n'), ((3891, 3922), 'core.component_instance.SymbolAttribute', 'SymbolAttribute', (['x', 'y', 'rotation'], {}), '(x, y, rotation)\n', (3906, 3922), False, 'from core.component_instance import Component... |
import pathlib
import os
here = pathlib.Path(__file__).parent.absolute()
| [
"pathlib.Path"
] | [((34, 56), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (46, 56), False, 'import pathlib\n')] |
from pathlib import Path
import tempfile, os
from typing import Any, Dict, Optional
#
import jupytext, papermill
from nbconvert import HTMLExporter
"""
On the command line (bash), a Jupytext notebooks can be evaluated and converted into an
html page as below.
```bash
jupytext --to notebook --output - jupytext_nb.py... | [
"os.remove",
"jupytext.write",
"tempfile.mkstemp",
"jupytext.read",
"pathlib.Path",
"os.close",
"nbconvert.HTMLExporter",
"papermill.execute_notebook"
] | [((1385, 1660), 'papermill.execute_notebook', 'papermill.execute_notebook', ([], {'input_path': 'self.filepath', 'output_path': 'output.filepath', 'parameters': 'parameters', 'request_save_on_cell_execute': '(True)', 'kernel_name': '"""python"""', 'language': '"""python"""', 'progress_bar': '(True)', 'stdout_file': 'No... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': "Helper functions for pymarc",
'author': "<NAME>",
'author_email': "<EMAIL>",
'version': "0.2",
'install_requires': ['pytest', 'pymarc', 'texttable'],
'packages': ["pymarc_he... | [
"distutils.core.setup"
] | [((507, 522), 'distutils.core.setup', 'setup', ([], {}), '(**config)\n', (512, 522), False, 'from distutils.core import setup\n')] |
import pytest
from zerodb.afgh.encrypter import AFGHEncrypter, WrongKeyError, AFGHEncrypterRe, AFGHReEncryption
def test_utility():
utility1 = AFGHEncrypter(passphrase="<PASSWORD>")
utility2 = AFGHEncrypter(passphrase="<PASSWORD>")
utility3 = AFGHEncrypter(passphrase="<PASSWORD>")
utility3_ = AFGHEncr... | [
"zerodb.afgh.encrypter.AFGHEncrypter",
"pytest.raises",
"zerodb.afgh.encrypter.AFGHReEncryption",
"zerodb.afgh.encrypter.AFGHEncrypterRe"
] | [((149, 187), 'zerodb.afgh.encrypter.AFGHEncrypter', 'AFGHEncrypter', ([], {'passphrase': '"""<PASSWORD>"""'}), "(passphrase='<PASSWORD>')\n", (162, 187), False, 'from zerodb.afgh.encrypter import AFGHEncrypter, WrongKeyError, AFGHEncrypterRe, AFGHReEncryption\n'), ((203, 241), 'zerodb.afgh.encrypter.AFGHEncrypter', 'A... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import numpy as np
from sklearn.neighbors import NearestNeighbors
from PyDBOD.base import Base
class ODIN(Base):
def __init__(self, k=20, t=10):
self.k = k
self.t = t
def fit_predict(self, data):
nbrs = NearestNeighbors(n_n... | [
"numpy.array",
"sklearn.neighbors.NearestNeighbors",
"numpy.sum"
] | [((580, 610), 'numpy.sum', 'np.sum', (['graph_conexion'], {'axis': '(1)'}), '(graph_conexion, axis=1)\n', (586, 610), True, 'import numpy as np\n'), ((627, 669), 'numpy.array', 'np.array', (['(indegree <= self.t)'], {'dtype': 'np.int'}), '(indegree <= self.t, dtype=np.int)\n', (635, 669), True, 'import numpy as np\n'),... |
"""sistemaClientes URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Cla... | [
"rest_framework.documentation.include_docs_urls",
"django.conf.urls.static.static",
"django.urls.path",
"django.urls.include"
] | [((1509, 1570), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (1515, 1570), False, 'from django.conf.urls.static import static\n'), ((986, 1021), 'django.urls.path', 'path', (['"""api/admin/"""... |
#Faça um programa que leia o ano de nascimento de um jovem e informe, de acordo com a sua idade,
# se ele ainda vai se alistar ao serviço militar,
# se é a hora exata de se alistar ou se já passou do tempo do alistamento.
# Seu programa também deverá mostrar o tempo que falta ou que passou do prazo
from datetime import... | [
"datetime.date.today"
] | [((334, 346), 'datetime.date.today', 'date.today', ([], {}), '()\n', (344, 346), False, 'from datetime import date\n')] |
from unittest.mock import AsyncMock, MagicMock, PropertyMock
import pytest
import gidgethub
import abstracts
from aio.api import github
from aio.api import github as base_github
@abstracts.implementer(github.AGithubIssue)
class DummyGithubIssue:
pass
@abstracts.implementer(github.AGithubIssues)
class Dummy... | [
"unittest.mock.MagicMock",
"unittest.mock.AsyncMock",
"pytest.raises",
"abstracts.implementer",
"pytest.mark.parametrize"
] | [((186, 228), 'abstracts.implementer', 'abstracts.implementer', (['github.AGithubIssue'], {}), '(github.AGithubIssue)\n', (207, 228), False, 'import abstracts\n'), ((265, 308), 'abstracts.implementer', 'abstracts.implementer', (['github.AGithubIssues'], {}), '(github.AGithubIssues)\n', (286, 308), False, 'import abstra... |
# Copyright (c) 2016, The Bifrost Authors. All rights reserved.
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must r... | [
"numpy.dtype"
] | [((2178, 2208), 'numpy.dtype', 'np.dtype', (["[('re_im', np.int8)]"], {}), "([('re_im', np.int8)])\n", (2186, 2208), True, 'import numpy as np\n'), ((2215, 2259), 'numpy.dtype', 'np.dtype', (["[('re', np.int8), ('im', np.int8)]"], {}), "([('re', np.int8), ('im', np.int8)])\n", (2223, 2259), True, 'import numpy as np\n'... |
#!/usr/bin/env python3
import sys
import os
import zipfile
if len(sys.argv) < 3:
print('usage: mkzip <lstfile> <zipfile>')
sys.exit(1)
lst = []
with open(sys.argv[1], 'r') as f:
for line in f:
line = line.strip()
if line == '' or line[0] == '#':
continue
tok = line.spl... | [
"zipfile.ZipFile",
"sys.exit"
] | [((133, 144), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (141, 144), False, 'import sys\n'), ((368, 419), 'zipfile.ZipFile', 'zipfile.ZipFile', (['sys.argv[2]', '"""w"""'], {'allowZip64': '(False)'}), "(sys.argv[2], 'w', allowZip64=False)\n", (383, 419), False, 'import zipfile\n')] |
import asyncio
import time
import enum
import datetime
import logging
import functools
import random
from typing import Tuple, List
import aiohttp
from .types import (
Character,
AccessToken,
ABCSession,
RefreshTokenError,
CharacterNeedsUpdated,
Response,
)
from .data import forge_npc_station_i... | [
"logging.debug",
"asyncio.sleep",
"functools.partialmethod",
"aiohttp.UnixConnector",
"aiohttp.ClientSession",
"datetime.datetime.utcnow",
"aiohttp.BasicAuth",
"time.monotonic",
"logging.info",
"datetime.timedelta",
"random.randrange",
"logging.getLogger"
] | [((334, 361), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (351, 361), False, 'import logging\n'), ((7024, 7076), 'functools.partialmethod', 'functools.partialmethod', (['get_market_orders', '(10000002)'], {}), '(get_market_orders, 10000002)\n', (7047, 7076), False, 'import functools\n'... |
import pytest
from aiojobs import create_scheduler
from aiojobs._scheduler import Scheduler
PARAMS = dict(
close_timeout=1.0,
limit=100,
pending_limit=0,
exception_handler=None
)
@pytest.fixture
def scheduler(loop):
ret = Scheduler(loop=loop, **PARAMS)
yield ret
loop.run_until_complete(r... | [
"aiojobs.create_scheduler",
"aiojobs._scheduler.Scheduler"
] | [((246, 276), 'aiojobs._scheduler.Scheduler', 'Scheduler', ([], {'loop': 'loop'}), '(loop=loop, **PARAMS)\n', (255, 276), False, 'from aiojobs._scheduler import Scheduler\n'), ((448, 474), 'aiojobs.create_scheduler', 'create_scheduler', ([], {}), '(**kwargs)\n', (464, 474), False, 'from aiojobs import create_scheduler\... |
"""DLL file patching functions."""
import itertools
import os
import platform
import ctypes.util
import typing
import setuptools.msvc
import distutils.util
import pefile
import machomachomangler.pe
from . import dll_list
class PEContext:
"""Context manager for PE file."""
def __init__(self, name: str) -> Non... | [
"platform.architecture",
"os.path.basename",
"os.path.dirname",
"os.path.isfile",
"pefile.PE",
"os.path.join"
] | [((342, 357), 'pefile.PE', 'pefile.PE', (['name'], {}), '(name)\n', (351, 357), False, 'import pefile\n'), ((1362, 1388), 'os.path.dirname', 'os.path.dirname', (['vcruntime'], {}), '(vcruntime)\n', (1377, 1388), False, 'import os\n'), ((1464, 1484), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (1478,... |
from django.urls import path
from asteroids.views import get_fastest_asteroid, get_largest_asteroid, get_closest_approach, get_notable_encounters
urlpatterns = [
path('get_closest_approach/', get_closest_approach, name='get_closest_approach'),
path('get_largest_asteroid/', get_largest_asteroid, name='get_large... | [
"django.urls.path"
] | [((167, 252), 'django.urls.path', 'path', (['"""get_closest_approach/"""', 'get_closest_approach'], {'name': '"""get_closest_approach"""'}), "('get_closest_approach/', get_closest_approach, name='get_closest_approach'\n )\n", (171, 252), False, 'from django.urls import path\n'), ((253, 338), 'django.urls.path', 'pat... |
from django.db import models
from users.models import User
from departments.models import Department
# Create your models here.
class Publisher(models.Model):
account = models.OneToOneField(
User, on_delete=models.CASCADE, related_name="account")
first_name =models.CharField(verbose_name='first name',... | [
"django.db.models.CharField",
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.ForeignKey"
] | [((175, 251), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'on_delete': 'models.CASCADE', 'related_name': '"""account"""'}), "(User, on_delete=models.CASCADE, related_name='account')\n", (195, 251), False, 'from django.db import models\n'), ((277, 336), 'django.db.models.CharField', 'models.Cha... |
from dojo.utils import max_safe
from dojo.models import IMPORT_CLOSED_FINDING, IMPORT_CREATED_FINDING, IMPORT_REACTIVATED_FINDING, Test_Import, Test_Import_Finding_Action
import logging
logger = logging.getLogger(__name__)
def update_timestamps(test, scan_date, version, branch_tag, build_id, commit_hash, now, scan_d... | [
"dojo.models.Test_Import",
"dojo.models.Test_Import_Finding_Action",
"dojo.models.Test_Import_Finding_Action.objects.bulk_create",
"dojo.utils.max_safe",
"logging.getLogger"
] | [((196, 223), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (213, 223), False, 'import logging\n'), ((561, 604), 'dojo.utils.max_safe', 'max_safe', (['[scan_date_time, test.target_end]'], {}), '([scan_date_time, test.target_end])\n', (569, 604), False, 'from dojo.utils import max_safe\n'... |
#!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_adcpt_acfgm
@fid marine-integrations/mi/dataset/parser/test/test_adcpt_acfgm.py
@author <NAME>
@brief Test code for a Adcpt_Acfgm_Dcl data parser
"""
from nose.plugins.attrib import attr
import os
from mi.core.log import get_logger
from mi.dataset.parser... | [
"mi.dataset.driver.adcpt_acfgm.dcl.pd8.adcpt_acfgm_dcl_pd8_driver_common.AdcptAcfgmPd8Parser",
"mi.core.log.get_logger",
"mi.dataset.test.test_parser.ParserUnitTestCase.setUp",
"os.path.join",
"nose.plugins.attrib.attr"
] | [((361, 373), 'mi.core.log.get_logger', 'get_logger', ([], {}), '()\n', (371, 373), False, 'from mi.core.log import get_logger\n'), ((854, 878), 'nose.plugins.attrib.attr', 'attr', (['"""UNIT"""'], {'group': '"""mi"""'}), "('UNIT', group='mi')\n", (858, 878), False, 'from nose.plugins.attrib import attr\n'), ((1170, 13... |
# -*- coding: utf-8 -*-
"""
A thin wrapper of standard ``pickle`` with standard compression libraries
"""
import sys
import pickle
import io
from .utils import validate_compression, preprocess_path
__all__ = ["dump", "load", "dumps", "loads"]
def dump(
obj,
path,
compression="infer",
mode=None,
... | [
"io.BytesIO",
"pickle.load",
"pickle.dumps",
"pickle.dump"
] | [((6580, 6592), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (6590, 6592), False, 'import io\n'), ((4807, 4878), 'pickle.dump', 'pickle.dump', (['obj', 'io_stream'], {'protocol': 'protocol', 'fix_imports': 'fix_imports'}), '(obj, io_stream, protocol=protocol, fix_imports=fix_imports)\n', (4818, 4878), False, 'import p... |
import os
from subprocess import CalledProcessError
from unittest.mock import Mock, call, patch
import pytest
import tornado
from jupyterlab_git.git import Git
from .testutils import FakeContentManager
@pytest.mark.asyncio
async def test_changed_files_invalid_input():
with pytest.raises(tornado.web.HTTPError):... | [
"unittest.mock.patch",
"pytest.raises",
"tornado.gen.maybe_future",
"subprocess.CalledProcessError"
] | [((283, 319), 'pytest.raises', 'pytest.raises', (['tornado.web.HTTPError'], {}), '(tornado.web.HTTPError)\n', (296, 319), False, 'import pytest\n'), ((531, 566), 'unittest.mock.patch', 'patch', (['"""jupyterlab_git.git.execute"""'], {}), "('jupyterlab_git.git.execute')\n", (536, 566), False, 'from unittest.mock import ... |
import dgl.function as fn
import torch
from dgl import BatchedDGLGraph
from dgl.nn.pytorch import edge_softmax
from dgl.nn.pytorch.conv import GATConv
from torch import nn
from models.GNN.GNNModelBase import GNNModelBase
from models.utils import TypeConditionalLinear
class GAT(GNNModelBase):
"""
Graph Attent... | [
"torch.nn.Dropout",
"dgl.function.sum",
"torch.stack",
"torch.nn.ModuleList",
"torch.cat",
"torch.nn.Identity",
"dgl.nn.pytorch.edge_softmax",
"torch.nn.Linear",
"models.utils.TypeConditionalLinear",
"dgl.function.u_mul_e"
] | [((617, 632), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (630, 632), False, 'from torch import nn\n'), ((1901, 1916), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (1914, 1916), False, 'from torch import nn\n'), ((3427, 3480), 'torch.nn.Linear', 'nn.Linear', (['in_feats', '(out_feats * num_he... |
from typing import Any, List, Optional, cast
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import UserManager as BaseUserManager
from django.db import models
class UserManager(BaseUserManager):
def _create_user(self, email: str, password: Optional[str] = None, **extra_fields... | [
"typing.cast",
"django.db.models.BooleanField",
"django.db.models.EmailField"
] | [((1551, 1598), 'django.db.models.EmailField', 'models.EmailField', (['"""email address"""'], {'unique': '(True)'}), "('email address', unique=True)\n", (1568, 1598), False, 'from django.db import models\n'), ((1614, 1688), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'help_text':... |
"""Room Matcher to match the specific room"""
import re
from re import Pattern
import inspect
from typing import List
from wechaty import Wechaty # type: ignore
from wechaty_plugin_contrib.config import (
get_logger,
Room,
)
from .matcher import Matcher
logger = get_logger("RoomMatcher")
class RoomMatche... | [
"re.match",
"wechaty_plugin_contrib.config.get_logger"
] | [((276, 301), 'wechaty_plugin_contrib.config.get_logger', 'get_logger', (['"""RoomMatcher"""'], {}), "('RoomMatcher')\n", (286, 301), False, 'from wechaty_plugin_contrib.config import get_logger, Room\n'), ((735, 758), 're.match', 're.match', (['option', 'topic'], {}), '(option, topic)\n', (743, 758), False, 'import re... |
# -*- coding: utf-8 -*-
import dash_html_components as html
from app import app
from apps.commons import gen_header
# components of the app
# header text plus logo
header = gen_header('Statistics Webapps', logo='/assets/icons8-github-96.png',
href='https://github.com/gammaturn/statistics_apps')
l... | [
"dash_html_components.Div",
"dash_html_components.H3",
"apps.commons.gen_header",
"app.app.run_server"
] | [((175, 302), 'apps.commons.gen_header', 'gen_header', (['"""Statistics Webapps"""'], {'logo': '"""/assets/icons8-github-96.png"""', 'href': '"""https://github.com/gammaturn/statistics_apps"""'}), "('Statistics Webapps', logo='/assets/icons8-github-96.png', href=\n 'https://github.com/gammaturn/statistics_apps')\n",... |
import os
import pathlib
import shutil
import sys
import pytest
import mlrun
from tests.conftest import out_path
project_dir = f"{out_path}/project_dir"
class TestNewProject:
def setup_method(self, method):
self.assets_path = (
pathlib.Path(sys.modules[self.__module__].__file__).absolute().... | [
"mlrun.new_project",
"os.path.isfile",
"pytest.mark.skipif",
"pathlib.Path",
"shutil.rmtree",
"os.path.join"
] | [((1146, 1216), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(os.name == 'nt')"], {'reason': '"""Does not work on Windows"""'}), "(os.name == 'nt', reason='Does not work on Windows')\n", (1164, 1216), False, 'import pytest\n'), ((701, 747), 'shutil.rmtree', 'shutil.rmtree', (['project_dir'], {'ignore_errors': '(True)... |
import os
import glob
def cleanup(context):
os.chdir('../')
cwd = os.getcwd()
os.chdir('src')
thumbnail_path = fr'{cwd}\data\thumbnails\{context["video_id"]}.png'
video_path = fr'{cwd}\data\video\{context["video_id"]}.mp4'
post = context["post"]
subreddit = 'AskReddit'
description = f... | [
"os.mkdir",
"os.remove",
"os.getcwd",
"os.rename",
"glob.glob",
"os.chdir"
] | [((50, 65), 'os.chdir', 'os.chdir', (['"""../"""'], {}), "('../')\n", (58, 65), False, 'import os\n'), ((76, 87), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (85, 87), False, 'import os\n'), ((92, 107), 'os.chdir', 'os.chdir', (['"""src"""'], {}), "('src')\n", (100, 107), False, 'import os\n'), ((1662, 1711), 'os.mkdir... |
import S1_algotools as algo
import pytest
import numpy as np
import random
np_tab_zeros = np.zeros((200,200))
np_tab = np.zeros((200,200))
np_tab[70:90,45:55] = np.ones((20,10))
tab_red = [1,2,3]
tab = [1,9,3,4,5,6,7,8,2]
tab_under_zero = [0,-1,-3,-2]
def test_average():
assert algo.average_above_zero(tab) == 5
... | [
"S1_algotools.get_index_max_value",
"S1_algotools.max_value",
"numpy.zeros",
"numpy.ones",
"pytest.raises",
"S1_algotools.average_above_zero",
"S1_algotools.reverse_table",
"S1_algotools.bounding_box"
] | [((91, 111), 'numpy.zeros', 'np.zeros', (['(200, 200)'], {}), '((200, 200))\n', (99, 111), True, 'import numpy as np\n'), ((120, 140), 'numpy.zeros', 'np.zeros', (['(200, 200)'], {}), '((200, 200))\n', (128, 140), True, 'import numpy as np\n'), ((162, 179), 'numpy.ones', 'np.ones', (['(20, 10)'], {}), '((20, 10))\n', (... |
from typing import Union, Tuple
import math
from sfml import sf
from ..core.utils import to_Vector2
class LineShape(sf.Drawable):
def __init__(self, *args: Union[Tuple[float, float], sf.Vector2]):
super().__init__()
self._points = []
self._position = sf.Vector2(0, 0)
self._vertex... | [
"sfml.sf.Vertex",
"sfml.sf.Vector2",
"math.sin",
"math.cos",
"sfml.sf.VertexArray"
] | [((283, 299), 'sfml.sf.Vector2', 'sf.Vector2', (['(0)', '(0)'], {}), '(0, 0)\n', (293, 299), False, 'from sfml import sf\n'), ((328, 372), 'sfml.sf.VertexArray', 'sf.VertexArray', (['sf.PrimitiveType.LINES_STRIP'], {}), '(sf.PrimitiveType.LINES_STRIP)\n', (342, 372), False, 'from sfml import sf\n'), ((3079, 3129), 'sfm... |
import unittest
from project.card.trap_card import TrapCard
class TestTrapCard(unittest.TestCase):
def test_set_attr(self):
tc = TrapCard('card')
self.assertEqual(tc.name, 'card')
self.assertEqual(tc.damage_points, 120)
self.assertEqual(tc.health_points, 5)
self.assertEqua... | [
"project.card.trap_card.TrapCard"
] | [((144, 160), 'project.card.trap_card.TrapCard', 'TrapCard', (['"""card"""'], {}), "('card')\n", (152, 160), False, 'from project.card.trap_card import TrapCard\n'), ((646, 662), 'project.card.trap_card.TrapCard', 'TrapCard', (['"""test"""'], {}), "('test')\n", (654, 662), False, 'from project.card.trap_card import Tra... |
from pyramid.config import Configurator
from sqlalchemy import engine_from_config
from apex_example.models import initialize_sql
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
engine = engine_from_config(settings, 'sqlalchemy.')
initialize_sql(engine)
... | [
"pyramid.config.Configurator",
"sqlalchemy.engine_from_config",
"apex_example.models.initialize_sql"
] | [((247, 290), 'sqlalchemy.engine_from_config', 'engine_from_config', (['settings', '"""sqlalchemy."""'], {}), "(settings, 'sqlalchemy.')\n", (265, 290), False, 'from sqlalchemy import engine_from_config\n'), ((295, 317), 'apex_example.models.initialize_sql', 'initialize_sql', (['engine'], {}), '(engine)\n', (309, 317),... |
import random
from typing import *
import cv2 as cv
import numpy as np
from . import functional as F
from . import effects as E
from ..ops import math_ops, image_ops, boxes_ops
from skimage.util import noise, random_noise
class Compose(object):
def __init__(self, transforms):
self.transforms = transform... | [
"random.uniform",
"random.sample",
"skimage.util.random_noise",
"random.choice",
"cv2.split",
"cv2.merge",
"cv2.resize"
] | [((663, 703), 'random.sample', 'random.sample', (['self.transforms'], {'k': 'self.k'}), '(self.transforms, k=self.k)\n', (676, 703), False, 'import random\n'), ((790, 830), 'random.sample', 'random.sample', (['self.transforms'], {'k': 'self.k'}), '(self.transforms, k=self.k)\n', (803, 830), False, 'import random\n'), (... |
#-*- coding: utf-8 -*-
#
# This file belongs to Gyrid Server.
#
# Copyright (C) 2012 <NAME>
# All rights reserved.
"""
Module that provides a few simple tests and conversions. Can for instance be used to validate configuration file values.
All tests take at least the value to validate as an argument. When the test p... | [
"re.compile"
] | [((1532, 1877), 're.compile', 're.compile', (['"""(^[-!#$%&\'*+/=?^_`{}|~0-9A-Z]+(\\\\.[-!#$%&\'*+/=?^_`{}|~0-9A-Z]+)*|^"([\\\\001-\\\\010\\\\013\\\\014\\\\016-\\\\037!#-\\\\[\\\\]-\\\\177]|\\\\\\\\[\\\\001-\\\\011\\\\013\\\\014\\\\016-\\\\177])*")@((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\\\.)+[A-Z]{2,6}\\\\.?$)|\\\\[... |
from django import forms
from .models import Message
from django.shortcuts import get_object_or_404
from users.models import CustomUser
from django.forms import CharField, MultipleChoiceField, TextInput, SelectMultiple
class MessageForm(forms.ModelForm):
content = forms.CharField(
widget=forms.Textarea(
... | [
"django.forms.Textarea"
] | [((303, 416), 'django.forms.Textarea', 'forms.Textarea', ([], {'attrs': "{'rows': 5, 'cols': 20, 'id': 'summernote', 'class': 'form-control',\n 'placeholder': ''}"}), "(attrs={'rows': 5, 'cols': 20, 'id': 'summernote', 'class':\n 'form-control', 'placeholder': ''})\n", (317, 416), False, 'from django import forms... |
#!/usr/bin/env python
### Class to receive Sonar data ###
import Adafruit_BBIO.UART as UART
import serial
class SonarController(object):
def __init__(self, port="", baudrate=9600, UART=""):
UART.setup(UART)
self.sonarCom = serial.Serial(port=port, baudrate=baudrate)
self.sonarCom.close()... | [
"serial.Serial",
"Adafruit_BBIO.UART.setup"
] | [((206, 222), 'Adafruit_BBIO.UART.setup', 'UART.setup', (['UART'], {}), '(UART)\n', (216, 222), True, 'import Adafruit_BBIO.UART as UART\n'), ((247, 290), 'serial.Serial', 'serial.Serial', ([], {'port': 'port', 'baudrate': 'baudrate'}), '(port=port, baudrate=baudrate)\n', (260, 290), False, 'import serial\n')] |
import sys
import os
this = os.path.normpath(os.path.abspath(os.path.dirname(__file__)))
sys.path.insert(0, "/".join(this.split("/")[:-1]))
# sys.path.append("/".join(this.split("/")[:-1]))
| [
"os.path.dirname"
] | [((62, 87), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (77, 87), False, 'import os\n')] |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import aria2app.a2jsonrpc as a2jsonrpc
import aria2app.a2config as a2config
######################## Convenience Methods for Server#############################
class Aria2ServerWrapper(object):
def __init__(self, cfgfile, token=None):
self.tok... | [
"aria2app.a2jsonrpc.Aria2JsonRpcServer",
"aria2app.a2config.Aria2Config"
] | [((2370, 2405), 'aria2app.a2jsonrpc.Aria2JsonRpcServer', 'a2jsonrpc.Aria2JsonRpcServer', (['token'], {}), '(token)\n', (2398, 2405), True, 'import aria2app.a2jsonrpc as a2jsonrpc\n'), ((354, 389), 'aria2app.a2jsonrpc.Aria2JsonRpcServer', 'a2jsonrpc.Aria2JsonRpcServer', (['token'], {}), '(token)\n', (382, 389), True, 'i... |
import os
import click
from rich.console import Console
from rich.panel import Panel
console = Console()
style = "bold on black"
def _print(msg):
# panel = Panel(f"{msg}", style="bold white on red", expand=False)
return console.print(f"{msg}", style=style, justify="left")
| [
"rich.console.Console"
] | [((97, 106), 'rich.console.Console', 'Console', ([], {}), '()\n', (104, 106), False, 'from rich.console import Console\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0008_auto_20151211_1347'),
]
operations = [
migrations.AlterField(
model_name='actionlistitem',
... | [
"django.db.models.ForeignKey"
] | [((362, 459), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'default': 'None', 'null': '(True)', 'to': '"""projects.Project"""', 'related_name': '"""action_list"""'}), "(default=None, null=True, to='projects.Project',\n related_name='action_list')\n", (379, 459), False, 'from django.db import migrations,... |
try:
import os
import sys
import time
import threading
import json
import shutil
from tkinter import *
from tkinter import ttk
import subprocess
import zipfile
import logging
from typing import ClassVar, Dict, List
except ImportError as error_obj:
print(error_obj)
... | [
"os.remove",
"os.path.isfile",
"shutil.rmtree",
"os.path.join",
"os.chdir",
"shutil.copy",
"logging.error",
"tkinter.ttk.Button",
"threading.Thread",
"subprocess.Popen",
"json.dump",
"tkinter.ttk.Scrollbar",
"tkinter.ttk.Style",
"time.sleep",
"os.listdir",
"sys.exit",
"logging.basicC... | [((359, 370), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (368, 370), False, 'import os\n'), ((441, 464), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (459, 464), False, 'import os\n'), ((731, 742), 'tkinter.ttk.Style', 'ttk.Style', ([], {}), '()\n', (740, 742), False, 'from tkinter import ... |
from itertools import product
import h5py
import matplotlib.pyplot as plt
import numpy as np
import numpy.random
import tensorflow
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
import Tools
def main():
nan_test()
def nan_test():
tool = Tools.Tool()
data... | [
"matplotlib.pyplot.title",
"sklearn.preprocessing.StandardScaler",
"numpy.abs",
"matplotlib.pyplot.bar",
"sklearn.preprocessing.MinMaxScaler",
"numpy.ones",
"numpy.argsort",
"matplotlib.pyplot.tight_layout",
"numpy.linalg.matrix_rank",
"itertools.product",
"tensorflow.math.divide",
"h5py.File"... | [((299, 311), 'Tools.Tool', 'Tools.Tool', ([], {}), '()\n', (309, 311), False, 'import Tools\n'), ((772, 807), 'tensorflow.math.divide', 'tensorflow.math.divide', (['test', 'num_1'], {}), '(test, num_1)\n', (794, 807), False, 'import tensorflow\n'), ((824, 861), 'tensorflow.math.multiply', 'tensorflow.math.multiply', (... |
# Generated by Django 2.2.9 on 2020-02-04 00:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Ride_Share', '0024_auto_20200203_1929'),
]
operations = [
migrations.AlterField(
model_name='myuser',
name='email',
... | [
"django.db.models.EmailField"
] | [((338, 428), 'django.db.models.EmailField', 'models.EmailField', ([], {'help_text': '"""Required"""', 'max_length': '(254)', 'verbose_name': '"""Email address"""'}), "(help_text='Required', max_length=254, verbose_name=\n 'Email address')\n", (355, 428), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/env python
from setuptools import setup, find_packages
import mailchimp3
setup(
name='django-mailchimp3',
version=".".join(map(str, mailchimp3.__version__)),
author='<NAME>',
author_email='<EMAIL>',
url='http://github.com/metaforge/django-mailchimp3',
install_requires=[
'req... | [
"setuptools.find_packages"
] | [((417, 432), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (430, 432), False, 'from setuptools import setup, find_packages\n')] |
from django.conf import settings
from os import listdir
from os.path import isfile, join, splitext
from pathlib import Path
import signal
import logging
import datetime
import time
import os
import tarfile
import operator
logger = logging.getLogger(__name__)
RDF_DATA_ARCHIVE_DIR = getattr(settings, 'TARGET_DATA_DIR... | [
"os.path.basename",
"time.gmtime",
"os.path.isdir",
"os.path.isfile",
"os.path.getmtime",
"os.chdir",
"os.path.splitext",
"tarfile.open",
"os.listdir",
"logging.getLogger"
] | [((234, 261), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (251, 261), False, 'import logging\n'), ((970, 992), 'os.path.getmtime', 'os.path.getmtime', (['file'], {}), '(file)\n', (986, 992), False, 'import os\n'), ((1237, 1259), 'os.path.getmtime', 'os.path.getmtime', (['file'], {}), '... |
"""
Revision ID: 0305d_block_users
Revises: 0305c_login_events
Create Date: 2019-11-15 16:07:22.019759
"""
import sqlalchemy as sa
from alembic import op
revision = "0305d_block_users"
down_revision = "0305c_login_events"
def upgrade():
op.add_column(
"users",
sa.Column("blocked", sa.BOOLEAN(),... | [
"alembic.op.drop_column",
"sqlalchemy.BOOLEAN",
"sqlalchemy.false"
] | [((394, 428), 'alembic.op.drop_column', 'op.drop_column', (['"""users"""', '"""blocked"""'], {}), "('users', 'blocked')\n", (408, 428), False, 'from alembic import op\n'), ((307, 319), 'sqlalchemy.BOOLEAN', 'sa.BOOLEAN', ([], {}), '()\n', (317, 319), True, 'import sqlalchemy as sa\n'), ((352, 362), 'sqlalchemy.false', ... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import logging
import os
import sys
import argparse
import random
import numpy as np
import tqdm
import pickle
import pandas as pd
from matplotlib import pyplot as plt
from keras import backend as K
from keras.preprocessing.sequence import pad_sequences
from sklearn.... | [
"os.mkdir",
"numpy.sum",
"argparse.ArgumentParser",
"torch.utils.data.RandomSampler",
"numpy.argmax",
"pandas.read_csv",
"keras.preprocessing.sequence.pad_sequences",
"sklearn.model_selection.train_test_split",
"torch.cuda.device_count",
"torch.utils.data.TensorDataset",
"torch.no_grad",
"skle... | [((1160, 1185), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1183, 1185), False, 'import argparse\n'), ((2297, 2367), 'transformers.XLNetTokenizer.from_pretrained', 'XLNetTokenizer.from_pretrained', (['"""xlnet-base-cased"""'], {'do_lower_case': '(True)'}), "('xlnet-base-cased', do_lower_cas... |
# -*- coding: utf-8 -*-
"""
Модуль опеределения функции логгирования.
Можно в конфиге задать свою функццию логгирования
По умолчанию испоьзуется встроенная библиотека logging
"""
import logging
import sys
from sealant.config import SeaLantConfig
conf = SeaLantConfig
def log(*args, **kwargs):
"""
Функция лог... | [
"logging.Formatter",
"logging.StreamHandler",
"logging.getLogger"
] | [((605, 624), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (622, 624), False, 'import logging\n'), ((688, 728), 'logging.StreamHandler', 'logging.StreamHandler', ([], {'stream': 'sys.stdout'}), '(stream=sys.stdout)\n', (709, 728), False, 'import logging\n'), ((749, 793), 'logging.Formatter', 'logging.For... |
"""pyramid_subscribers_cookiexfer installation script.
"""
import os
import re
from setuptools import setup
from setuptools import find_packages
try:
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, "README.md")).read()
README = README.split("\n\n", 1)[0] + "\n"
except:
... | [
"os.path.dirname",
"os.path.join",
"setuptools.setup",
"re.compile"
] | [((741, 1527), 'setuptools.setup', 'setup', ([], {'name': '"""pyramid_subscribers_cookiexfer"""', 'version': 'VERSION', 'description': '"""transfers cookies from request to response on exceptions"""', 'long_description': 'README', 'classifiers': "['Intended Audience :: Developers', 'Framework :: Pyramid',\n 'Program... |
from rpython.rlib import jit
from rpython.rlib.rstring import StringBuilder
from pypy.interpreter.baseobjspace import W_Root
from pypy.interpreter.error import oefmt
from pypy.interpreter.gateway import interp2app
from pypy.interpreter.typedef import TypeDef, GetSetProperty
from pypy.module.micronumpy import constants... | [
"rpython.rlib.rstring.StringBuilder",
"pypy.interpreter.typedef.GetSetProperty",
"pypy.interpreter.gateway.interp2app",
"pypy.interpreter.error.oefmt"
] | [((2576, 2615), 'pypy.interpreter.error.oefmt', 'oefmt', (['space.w_KeyError', '"""Unknown flag"""'], {}), "(space.w_KeyError, 'Unknown flag')\n", (2581, 2615), False, 'from pypy.interpreter.error import oefmt\n'), ((2684, 2723), 'pypy.interpreter.error.oefmt', 'oefmt', (['space.w_KeyError', '"""Unknown flag"""'], {}),... |
from importlib import import_module
from indice_pollution.history.models.commune import Commune
import logging
def get_region(insee=None, region_name=None):
if not region_name and insee:
commune = Commune.get(insee)
if commune.departement and commune.departement.region:
region_name = co... | [
"indice_pollution.history.models.commune.Commune.get",
"logging.error",
"importlib.import_module"
] | [((210, 228), 'indice_pollution.history.models.commune.Commune.get', 'Commune.get', (['insee'], {}), '(insee)\n', (221, 228), False, 'from indice_pollution.history.models.commune import Commune\n'), ((474, 537), 'logging.error', 'logging.error', (['"""No region or insee given, couldn\'t find region"""'], {}), '("No reg... |
import unittest
from neo.rawio.axonrawio import AxonRawIO
from neo.test.rawiotest.common_rawio_test import BaseTestRawIO
class TestAxonRawIO(BaseTestRawIO, unittest.TestCase, ):
rawioclass = AxonRawIO
entities_to_test = [
'File_axon_1.abf', # V2.0
'File_axon_2.abf', # V1.8
'File_ax... | [
"unittest.main"
] | [((780, 795), 'unittest.main', 'unittest.main', ([], {}), '()\n', (793, 795), False, 'import unittest\n')] |
import pytest
from text2digits import text2digits
@pytest.mark.parametrize("input_text", [
('A random string'),
('Hello world. How are you?'),
])
def test_str_unchanged_if_no_numbers(input_text):
t2d_default = text2digits.Text2Digits()
result = t2d_default.convert(input_text)
assert result == inp... | [
"pytest.mark.parametrize",
"text2digits.text2digits.Text2Digits"
] | [((54, 145), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""input_text"""', "['A random string', 'Hello world. How are you?']"], {}), "('input_text', ['A random string',\n 'Hello world. How are you?'])\n", (77, 145), False, 'import pytest\n'), ((344, 941), 'pytest.mark.parametrize', 'pytest.mark.paramet... |
from django.contrib import admin
from .models import (
Kingdom, Type, SubType, Classification, Order, Family, FamilySpecie, Mammal)
@admin.register(Kingdom)
class KingdomAdmin(admin.ModelAdmin):
pass
class SubtypeInline(admin.TabularInline):
model = SubType
@admin.register(Type)
class TypeAdmin(admin... | [
"django.contrib.admin.register"
] | [((140, 163), 'django.contrib.admin.register', 'admin.register', (['Kingdom'], {}), '(Kingdom)\n', (154, 163), False, 'from django.contrib import admin\n'), ((278, 298), 'django.contrib.admin.register', 'admin.register', (['Type'], {}), '(Type)\n', (292, 298), False, 'from django.contrib import admin\n'), ((369, 399), ... |
import subprocess
import serial
import paho.mqtt.client as mqtt
import serial.tools.list_ports
import time
# proc = subprocess.Popen(["pgrep", "-f", __file__], stdout=subprocess.PIPE)
# std = proc.communicate()
# if len(std[0].decode().split()) > 1:
# exit('Already running')
OPEN_PREFIX_HEX = '550112000000'
CLOSE_... | [
"serial.Serial",
"paho.mqtt.client.Client",
"time.sleep"
] | [((3700, 3713), 'paho.mqtt.client.Client', 'mqtt.Client', ([], {}), '()\n', (3711, 3713), True, 'import paho.mqtt.client as mqtt\n'), ((1359, 1399), 'serial.Serial', 'serial.Serial', (['portx', 'bps'], {'timeout': 'timex'}), '(portx, bps, timeout=timex)\n', (1372, 1399), False, 'import serial\n'), ((2015, 2030), 'time.... |
"""
A PyTorch Re-implementation of PIPNet with all-in-one style, include
model definition, loss computation, training, inference, exporting
and evaluating processes in a one class.
Reference: https://github.com/jhb86253817/PIPNet/blob/master/lib/networks.py
"""
import warnings
import torch
import torch.nn as nn
from t... | [
"torchvision.models.resnet18",
"torch.hub.load_state_dict_from_url",
"torchvision.models.resnet101",
"torch.load",
"torch.nn.Conv2d",
"os.path.exists",
"torch.nn.BatchNorm2d",
"torch.nn.init.normal_",
"torch.cuda.is_available",
"torch.nn.init.constant_",
"torchvision.models.resnet50",
"torch.n... | [((3597, 3609), 'torch.nn.Sigmoid', 'nn.Sigmoid', ([], {}), '()\n', (3607, 3609), True, 'import torch.nn as nn\n'), ((7910, 7996), 'torch.nn.Conv2d', 'nn.Conv2d', (['plane', 'self.num_lms'], {'kernel_size': '(1, 1)', 'stride': '(1, 1)', 'padding': '(0, 0)'}), '(plane, self.num_lms, kernel_size=(1, 1), stride=(1, 1), pa... |
# -*- coding: utf-8 -*-
# Copyright 1999-2018 Alibaba Group Holding 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
#
# Unless require... | [
"subprocess.Popen",
"mars.compat.zip_longest",
"mars.serialize.ProtobufSerializeProvider",
"os.path.dirname",
"time.sleep",
"tempfile.mkdtemp",
"numpy.array_equal",
"shutil.rmtree",
"mars.serialize.JsonSerializeProvider",
"logging.getLogger"
] | [((6334, 6353), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (6351, 6353), False, 'import logging\n'), ((6500, 6519), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (6517, 6519), False, 'import logging\n'), ((6540, 6614), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {'dir': 'self.base_direct... |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 3 14:10:07 2019
@author: ncelik34
"""
# Importing the libraries
import os
import numpy
import time
import random
import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
from imblearn.over_sampling import SMOTE
from s... | [
"matplotlib.pyplot.title",
"numpy.argmax",
"pandas.read_csv",
"tensorflow.keras.layers.Dense",
"keras_metrics.binary_precision",
"sklearn.preprocessing.MinMaxScaler",
"tensorflow.keras.optimizers.SGD",
"matplotlib.pyplot.figure",
"tensorflow.keras.models.Sequential",
"tensorflow.keras.backend.epsi... | [((3060, 3097), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {'header': 'None'}), "('train.csv', header=None)\n", (3071, 3097), True, 'import pandas as pd\n'), ((3166, 3188), 'numpy.amax', 'np.amax', (['dataset[:, 2]'], {}), '(dataset[:, 2])\n', (3173, 3188), True, 'import numpy as np\n'), ((3285, 3319), 'sk... |
from CHECLabPy.plotting.setup import Plotter
from CHECLabPy.plotting.camera import CameraImage
from CHECLabPy.utils.mapping import get_ctapipe_camera_geometry
from CHECLabPy.core.io import TIOReader
from CHECLabPy.calib import TimeCalibrator
from CHECOnsky.calib import OnskyAmplitudeCalibrator, \
get_nudge_and_temp... | [
"numpy.full",
"CHECOnsky.calib.obtain_cleaning_mask",
"numpy.concatenate",
"pandas.read_csv",
"CHECOnsky.calib.get_nudge_and_temperature_from_reader",
"CHECOnsky.calib.OnskyAmplitudeCalibrator",
"CHECLabPy.calib.TimeCalibrator",
"numpy.min",
"numpy.max",
"numpy.arange",
"CHECOnsky.calib.OnskyExt... | [((778, 811), 'pandas.read_csv', 'pd.read_csv', (['input_path'], {'sep': '"""\t"""'}), "(input_path, sep='\\t')\n", (789, 811), True, 'import pandas as pd\n'), ((901, 922), 'CHECLabPy.core.io.TIOReader', 'TIOReader', (['first_path'], {}), '(first_path)\n', (910, 922), False, 'from CHECLabPy.core.io import TIOReader\n')... |
from retriever.lib.scripts import SCRIPT_LIST, get_script, get_dataset_names_upstream
from retriever.lib.defaults import RETRIEVER_REPOSITORY
def datasets(keywords=None, licenses=None):
"""Search all datasets by keywords and licenses."""
script_list = SCRIPT_LIST()
if not keywords and not licenses:
... | [
"retriever.lib.scripts.SCRIPT_LIST",
"retriever.lib.scripts.get_script",
"retriever.lib.scripts.get_dataset_names_upstream"
] | [((262, 275), 'retriever.lib.scripts.SCRIPT_LIST', 'SCRIPT_LIST', ([], {}), '()\n', (273, 275), False, 'from retriever.lib.scripts import SCRIPT_LIST, get_script, get_dataset_names_upstream\n'), ((2107, 2180), 'retriever.lib.scripts.get_dataset_names_upstream', 'get_dataset_names_upstream', (['keywords', 'licenses'], {... |
from setuptools import find_packages
from setuptools import setup
import os.path
def read(rel_path):
rel_path = rel_path.split('/')
base_path = os.path.dirname(__file__)
path = (base_path,) + tuple(rel_path)
with open(os.path.join(*path)) as f:
return f.read()
setup(
name='gocept.pagelet... | [
"setuptools.find_packages"
] | [((1731, 1751), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (1744, 1751), False, 'from setuptools import find_packages\n')] |
# ===============================================================================
# Copyright 2016 <NAME>
#
# 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/LI... | [
"pychron.envisage.resources.icon",
"traits.api.Int",
"pychron.experiment.utilities.conditionals.level_text",
"pychron.experiment.utilities.conditionals.level_color",
"traits.api.Str"
] | [((1197, 1215), 'pychron.envisage.resources.icon', 'icon', (['"""green_ball"""'], {}), "('green_ball')\n", (1201, 1215), False, 'from pychron.envisage.resources import icon\n'), ((1310, 1317), 'traits.api.Str', 'Str', (['""""""'], {}), "('')\n", (1313, 1317), False, 'from traits.api import Str, Int, Property\n'), ((190... |
from cosmosis.runtime import Inifile, register_new_parameter, LikelihoodPipeline, Parameter, Module
from cosmosis.datablock import DataBlock
from cosmosis.samplers.sampler import Sampler
from cosmosis.runtime.prior import TruncatedGaussianPrior, DeltaFunctionPrior
from cosmosis.output.in_memory_output import InMemoryOu... | [
"cosmosis.datablock.DataBlock",
"tempfile.NamedTemporaryFile",
"os.path.abspath",
"cosmosis.output.in_memory_output.InMemoryOutput",
"cosmosis.runtime.Inifile",
"numpy.isclose",
"cosmosis.runtime.Module",
"cosmosis.runtime.LikelihoodPipeline"
] | [((506, 538), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', (['"""w"""'], {}), "('w')\n", (533, 538), False, 'import tempfile\n'), ((1007, 1039), 'cosmosis.runtime.Inifile', 'Inifile', (['None'], {'override': 'override'}), '(None, override=override)\n', (1014, 1039), False, 'from cosmosis.runtime import... |
from django.db import models
class ListModel(models.Model):
openid = models.CharField(max_length=255, verbose_name="user appid")
appid = models.CharField(max_length=255, verbose_name="user appid")
shop_name = models.CharField(max_length=32, verbose_name="店铺名称")
shop_mode = models.CharField(max_length=3... | [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.JSONField",
"django.db.models.DateTimeField"
] | [((74, 133), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'verbose_name': '"""user appid"""'}), "(max_length=255, verbose_name='user appid')\n", (90, 133), False, 'from django.db import models\n'), ((146, 205), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255... |
from itertools import count
from struct import Struct
from typing import Union
D64 = Struct('<d')
U16 = Struct('<H')
U32 = Struct('<I')
class MemoryViewReader:
"""
Reads a memory view as a structured stream.
"""
def __init__(self, buffer: Union[memoryview, bytes]):
self.buffer = buffer if is... | [
"struct.Struct",
"itertools.count"
] | [((86, 98), 'struct.Struct', 'Struct', (['"""<d"""'], {}), "('<d')\n", (92, 98), False, 'from struct import Struct\n'), ((105, 117), 'struct.Struct', 'Struct', (['"""<H"""'], {}), "('<H')\n", (111, 117), False, 'from struct import Struct\n'), ((124, 136), 'struct.Struct', 'Struct', (['"""<I"""'], {}), "('<I')\n", (130,... |
#!/bin/python3
import re # Regular expression package in Python
T =int(input())
in_css = False
for _ in range(T):
s = input()
if '{' in s:
in_css = True
elif '}' in s:
in_css = False
elif in_css:
for color in re.findall('#[0-9a-fA-F]{3,6}',s):
print(color) | [
"re.findall"
] | [((252, 286), 're.findall', 're.findall', (['"""#[0-9a-fA-F]{3,6}"""', 's'], {}), "('#[0-9a-fA-F]{3,6}', s)\n", (262, 286), False, 'import re\n')] |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'design.ui'
#
# Created by: PyQt5 UI code generator 5.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow... | [
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QSizePolicy",
"PyQt5.QtWidgets.QFrame",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QMenu",
"PyQt5.QtWidgets.QStatusBar",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtGui.QFont... | [((530, 559), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', (['MainWindow'], {}), '(MainWindow)\n', (547, 559), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((656, 693), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', (['self.centralwidget'], {}), '(self.centralwidget)\n', (673, 693), False, 'from PyQt5 im... |
#!/usr/bin/env python3
"""
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
Pre-run ... | [
"logging.basicConfig",
"magma.configuration.service_configs.get_service_config_value",
"lte.protos.mconfig.mconfigs_pb2.MME",
"socket.gethostname",
"magma.common.misc_utils.get_ip_from_if_cidr",
"magma.common.misc_utils.get_ip_from_if",
"os.path.join"
] | [((1092, 1143), 'magma.configuration.service_configs.get_service_config_value', 'get_service_config_value', (['service', 'iface_config', '""""""'], {}), "(service, iface_config, '')\n", (1116, 1143), False, 'from magma.configuration.service_configs import get_service_config_value\n'), ((1155, 1186), 'magma.common.misc_... |
"""
Neucore API
Client library of Neucore API # noqa: E501
The version of the OpenAPI document: 1.26.0
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from neucore_api.api_client import ApiClient, Endpoint as _Endpoint
from neucore_api.model_utils ... | [
"neucore_api.api_client.ApiClient",
"neucore_api.api_client.Endpoint"
] | [((4060, 4747), 'neucore_api.api_client.Endpoint', '_Endpoint', ([], {'settings': "{'response_type': ([Alliance],), 'auth': ['BearerAuth'], 'endpoint_path':\n '/app/v1/alliance-groups', 'operation_id': 'alliance_groups_bulk_v1',\n 'http_method': 'POST', 'servers': None}", 'params_map': "{'all': ['request_body'], ... |
#Una profesora sabe por experiencias anteriores que las notas
#definitivas de los estudiantes de su curso tienen un valor medio de
#nota_media y una desviación estándar de std_media.
#Calcule la probabilidad con un método Monte Carlo de que la nota
#promedio de un curso de n_estudiantes se encuentre entre min_nota y
#... | [
"numpy.count_nonzero",
"numpy.sqrt"
] | [((1575, 1624), 'numpy.count_nonzero', 'np.count_nonzero', (['((x > min_nota) & (x < max_nota))'], {}), '((x > min_nota) & (x < max_nota))\n', (1591, 1624), True, 'import numpy as np\n'), ((1525, 1547), 'numpy.sqrt', 'np.sqrt', (['n_estudiantes'], {}), '(n_estudiantes)\n', (1532, 1547), True, 'import numpy as np\n')] |
# Generated by Django 2.0.5 on 2018-08-23 17:15
from django.db import migrations, models
import news.validators
class Migration(migrations.Migration):
dependencies = [
('news', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='document',
name='... | [
"django.db.models.FileField"
] | [((349, 448), 'django.db.models.FileField', 'models.FileField', ([], {'upload_to': '"""documents/"""', 'validators': '[news.validators.validate_file_extension]'}), "(upload_to='documents/', validators=[news.validators.\n validate_file_extension])\n", (365, 448), False, 'from django.db import migrations, models\n')] |
from django import forms
from Grundgeruest.models import ScholariumProfile
from Produkte.models import Spendenstufe
class Rechnung2PdfForm(forms.Form):
firm = forms.CharField(max_length=50, initial='scholarium')
author = forms.CharField(max_length=50, initial='<NAME>')
recipent = forms.CharField(initial='... | [
"Produkte.models.Spendenstufe.objects.all",
"django.forms.IntegerField",
"django.forms.FloatField",
"django.forms.MultipleChoiceField",
"django.forms.CharField"
] | [((165, 217), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(50)', 'initial': '"""scholarium"""'}), "(max_length=50, initial='scholarium')\n", (180, 217), False, 'from django import forms\n'), ((231, 279), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(50)', 'initial': '"""<NAME>... |
# Copyright 2015 <NAME>. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
"threading.Lock",
"threading.Thread",
"memcached_udp.Client",
"time.sleep"
] | [((766, 822), 'memcached_udp.Client', 'memcached_udp.Client', (["[('127.0.0.1', 11211)]"], {'debug': '(True)'}), "([('127.0.0.1', 11211)], debug=True)\n", (786, 822), False, 'import memcached_udp\n'), ((883, 938), 'memcached_udp.Client', 'memcached_udp.Client', (["[('127.0.0.1', 9999)]"], {'debug': '(True)'}), "([('127... |
import torch
import torch.nn as nn
import torch.nn.functional as func
from torch.distributions import Distribution, Normal
from torchsupport.modules.rezero import ReZero
from torchsupport.data.namedtuple import NamedTuple
class ResidualProjection(nn.Module):
def __init__(self, in_size, out_size, hidden_size=64,
... | [
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.ReLU",
"torchsupport.modules.rezero.ReZero",
"torch.nn.Conv2d",
"torch.cat",
"torch.arange",
"torch.nn.Linear",
"torchsupport.data.namedtuple.NamedTuple",
"torch.distributions.Normal",
"torch.nn.Flatten"
] | [((457, 491), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_size', 'hidden_size', '(1)'], {}), '(in_size, hidden_size, 1)\n', (466, 491), True, 'import torch.nn as nn\n'), ((515, 550), 'torch.nn.Conv2d', 'nn.Conv2d', (['hidden_size', 'out_size', '(1)'], {}), '(hidden_size, out_size, 1)\n', (524, 550), True, 'import torch.nn as... |
"""Test the UniFi Protect sensor platform."""
# pylint: disable=protected-access
from __future__ import annotations
from datetime import datetime
import pytest
from pyunifiprotect.data.base import WifiConnectionState, WiredConnectionState
from pyunifiprotect.data.devices import Camera, Sensor
from pyunifiprotect.data... | [
"homeassistant.helpers.entity_registry.async_get",
"pyunifiprotect.data.base.WifiConnectionState",
"pytest.fixture",
"pyunifiprotect.data.base.WiredConnectionState"
] | [((901, 930), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""sensor"""'}), "(name='sensor')\n", (915, 930), False, 'import pytest\n'), ((2042, 2071), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""camera"""'}), "(name='camera')\n", (2056, 2071), False, 'import pytest\n'), ((2689, 2724), 'pyunifiprotect.da... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
blockify.py: make sure input and output FDs are in blocking mode before running a command.
"""
import os
import sys
import fcntl
# Check input
if len(sys.argv) < 2:
raise RuntimeError("A program to execute is required")
# Fix up standard file descriptors (0, 1, ... | [
"fcntl.fcntl",
"os.execvp"
] | [((617, 653), 'os.execvp', 'os.execvp', (['sys.argv[1]', 'sys.argv[1:]'], {}), '(sys.argv[1], sys.argv[1:])\n', (626, 653), False, 'import os\n'), ((455, 485), 'fcntl.fcntl', 'fcntl.fcntl', (['fd', 'fcntl.F_GETFL'], {}), '(fd, fcntl.F_GETFL)\n', (466, 485), False, 'import fcntl\n')] |
# Webhooks for external integrations.
from __future__ import absolute_import
from django.conf import settings
from zerver.models import UserProfile, get_client, get_user_profile_by_email
from zerver.lib.actions import check_send_message
from zerver.lib.notifications import convert_html_to_markdown
from zerver.lib.re... | [
"zerver.models.get_client",
"pprint.pformat",
"base64.b64decode",
"zerver.views.messages.send_message_backend",
"zerver.decorator.REQ",
"zerver.models.get_user_profile_by_email",
"zerver.lib.response.json_error",
"zerver.lib.validator.check_dict",
"defusedxml.ElementTree.fromstring",
"logging.warn... | [((5600, 5615), 'zerver.decorator.REQ', 'REQ', ([], {'default': '""""""'}), "(default='')\n", (5603, 5615), False, 'from zerver.decorator import authenticated_api_view, REQ, has_request_variables, authenticated_rest_api_view, api_key_only_webhook_view, to_non_negative_int, flexible_boolean\n'), ((5647, 5662), 'zerver.d... |
from election_anomaly import db_routines as dbr
from election_anomaly import user_interface as ui
from sqlalchemy.orm import sessionmaker
import os
from pprint import pprint
import sys
import ntpath
from election_anomaly import analyze_via_pandas as avp
class DataLoader():
def __new__(self):
""" Checks if ... | [
"election_anomaly.user_interface.pick_juris_from_filesystem",
"election_anomaly.db_routines.sql_alchemy_connect",
"ntpath.basename",
"election_anomaly.db_routines.establish_connection",
"election_anomaly.db_routines.save_one_to_db",
"election_anomaly.user_interface.new_datafile",
"election_anomaly.db_ro... | [((8160, 8178), 'ntpath.split', 'ntpath.split', (['path'], {}), '(path)\n', (8172, 8178), False, 'import ntpath\n'), ((1158, 1299), 'election_anomaly.user_interface.get_runtime_parameters', 'ui.get_runtime_parameters', (["['project_root', 'juris_name', 'db_paramfile', 'db_name', 'munger_name',\n 'results_file', 'top... |
# -*-coding:utf-8-*-
import torch
import torch.nn.functional as F
from math import exp
import torch.nn as nn
import torchvision.models as models
import os
from math import pi
class PerceptualLoss(nn.Module):
def __init__(self):
super(PerceptualLoss, self).__init__()
self.add_module('vgg', VGG19_r... | [
"torch.mean",
"torch.nn.MSELoss",
"torchvision.models.vgg19",
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.L1Loss",
"torch.nn.functional.mse_loss",
"torch.nn.InstanceNorm2d",
"torch.nn.functional.binary_cross_entropy_with_logits",
"torch.nn.CosineSimilarity",
"torch.clamp",
"torch.cuda.is... | [((352, 370), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {}), '()\n', (368, 370), False, 'import torch\n'), ((452, 515), 'torch.nn.InstanceNorm2d', 'nn.InstanceNorm2d', (['(512)'], {'affine': '(False)', 'track_running_stats': '(False)'}), '(512, affine=False, track_running_stats=False)\n', (469, 515), True, 'import t... |
alignment_file = "../msa_2021-09-08.tar.xz"
import pandas as pd
import lzma
import json
import gzip
from Bio import SeqIO
"""
metadata_file = '../metadata_2021-09-20_06-30.tsv.gz'
handle = gzip.open(metadata_file, 'rt')
df = pd.read_csv(handle, delimiter='\t', index_col=0)
alias_file = "./data/alias_key.json"
alias_di... | [
"lzma.open",
"Bio.SeqIO.parse"
] | [((1074, 1105), 'lzma.open', 'lzma.open', (['alignment_file', '"""rt"""'], {}), "(alignment_file, 'rt')\n", (1083, 1105), False, 'import lzma\n'), ((1166, 1194), 'Bio.SeqIO.parse', 'SeqIO.parse', (['handle', '"""fasta"""'], {}), "(handle, 'fasta')\n", (1177, 1194), False, 'from Bio import SeqIO\n')] |
import pickle
import utils
import os
# import spikes.temp
def howards_end_as_pos_text():
with open( os.path.join( utils.POS_PATH, "POP_1910_Howards End.pickle" ), "rb" ) as file:
pos_text = ""
doc = pickle.load( file )
n = 0
for token in doc:
if not token.is_space:
... | [
"utils.get_file_names_by_extension",
"pickle.load",
"os.path.join",
"os.path.splitext"
] | [((836, 895), 'utils.get_file_names_by_extension', 'utils.get_file_names_by_extension', (['utils.POS_PATH', '"""pickle"""'], {}), "(utils.POS_PATH, 'pickle')\n", (869, 895), False, 'import utils\n'), ((220, 237), 'pickle.load', 'pickle.load', (['file'], {}), '(file)\n', (231, 237), False, 'import pickle\n'), ((105, 164... |
import requests
import urllib.request
import os
import subprocess
from bs4 import BeautifulSoup
import logging
import re
log = logging.getLogger(__name__)
logging.basicConfig(level='INFO')
part_map = {}
def create_dir(path):
if os.path.exists(path):
log.warning('Directory {} already exists!'.format(path))... | [
"os.mkdir",
"os.path.join",
"logging.basicConfig",
"os.getcwd",
"os.path.exists",
"subprocess.call",
"requests.get",
"bs4.BeautifulSoup",
"re.search",
"logging.getLogger"
] | [((128, 155), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (145, 155), False, 'import logging\n'), ((156, 189), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': '"""INFO"""'}), "(level='INFO')\n", (175, 189), False, 'import logging\n'), ((234, 254), 'os.path.exists', 'os.pat... |
#!/usr/bin/python
import unittest
from polys import*
class TestPolynomials(unittest.TestCase):
def setUp(self):
self.p1 = [5, 1, 2, 3]
self.p2 = [2, 1]
self.p3 = 3
def test_add_poly(self):
self.assertEqual(add_poly(self.p1, self.p2), [7, 2, 2, 3])
def test_sub_po... | [
"unittest.main"
] | [((1131, 1146), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1144, 1146), False, 'import unittest\n')] |
from PolynomialType import Polynomial
from math import sqrt, floor
from itertools import product as cart_product
from ModularArithmetic import gcd
# Flatten a list
def flatten(L):
flat = []
for sublist in L:
try:
iter(sublist)
except TypeError:
flat.append(sublist)
... | [
"PolynomialType.Polynomial",
"ModularArithmetic.gcd",
"itertools.product"
] | [((1789, 1816), 'PolynomialType.Polynomial', 'Polynomial', (['[-20, 6, 2, 12]'], {}), '([-20, 6, 2, 12])\n', (1799, 1816), False, 'from PolynomialType import Polynomial\n'), ((1822, 1833), 'ModularArithmetic.gcd', 'gcd', (['Q.coef'], {}), '(Q.coef)\n', (1825, 1833), False, 'from ModularArithmetic import gcd\n'), ((1003... |
# -*- coding: utf8 -*-
# Copyright (C) 2013 - <NAME> <<EMAIL>>
# This program is Free Software see LICENSE file for details
import re
import _ast
from linting import linter
import pyflakes.checker as pyflakes
pyflakes.messages.Message.__str__ = (
lambda self: self.message % self.message_args
)
class PyFlakes... | [
"pyflakes.checker.Checker",
"linting.linter.cmp_to_key",
"re.escape"
] | [((1918, 1958), 'pyflakes.checker.Checker', 'pyflakes.Checker', (['tree', 'filename', 'ignore'], {}), '(tree, filename, ignore)\n', (1934, 1958), True, 'import pyflakes.checker as pyflakes\n'), ((2219, 2270), 'linting.linter.cmp_to_key', 'linter.cmp_to_key', (['(lambda a, b: a.lineno < b.lineno)'], {}), '(lambda a, b: ... |
"""
1. copy dna-CDS to work directory
2. translate dna
3. plot sequence length histogram for dna, untranslated dna, protein
4. run cd-hit on protein
"""
import argparse
import os
import io
import stat
import subprocess
def pipeline():
args = get_args()
qsub_params = [
'-l', 'place=pack:shared... | [
"subprocess.run",
"io.StringIO",
"os.chmod",
"argparse.ArgumentParser",
"os.makedirs",
"os.getcwd",
"os.path.exists",
"os.path.split",
"os.path.join"
] | [((461, 499), 'os.path.join', 'os.path.join', (['args.work_dir', '"""scripts"""'], {}), "(args.work_dir, 'scripts')\n", (473, 499), False, 'import os\n'), ((617, 660), 'os.path.split', 'os.path.split', (['args.orig_dna_cds_known_path'], {}), '(args.orig_dna_cds_known_path)\n', (630, 660), False, 'import os\n'), ((691, ... |
from niveristand import nivs_rt_sequence, NivsParam, run_py_as_rtseq
from niveristand.clientapi import BooleanValue, ChannelReference, DoubleValue
from niveristand.library import multitask, nivs_yield, stop_task, task, wait_until_settled
""" This module adds multitasking, return values, and cleanup tasks to engine_dem... | [
"niveristand.library.nivs_yield",
"niveristand.clientapi.BooleanValue",
"niveristand.library.stop_task",
"niveristand.clientapi.DoubleValue",
"niveristand.library.task",
"niveristand.run_py_as_rtseq",
"niveristand.library.wait_until_settled",
"niveristand.library.multitask",
"niveristand.clientapi.C... | [((1018, 1037), 'niveristand.clientapi.BooleanValue', 'BooleanValue', (['(False)'], {}), '(False)\n', (1030, 1037), False, 'from niveristand.clientapi import BooleanValue, ChannelReference, DoubleValue\n'), ((1061, 1080), 'niveristand.clientapi.BooleanValue', 'BooleanValue', (['(False)'], {}), '(False)\n', (1073, 1080)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.