code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP.
#!/usr/bin/python3
import schedule
from datetime import date, datetime, time, timedelta
import time
from cleanupclasses import cleanupTrackers as cleanupTrackers
from cleanupclasses import cleanupafcAudit as cleanupafcAudit
from cleanupclasses imp... | [
"schedule.run_pending",
"schedule.every",
"time.sleep"
] | [((633, 655), 'schedule.run_pending', 'schedule.run_pending', ([], {}), '()\n', (653, 655), False, 'import schedule\n'), ((661, 674), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (671, 674), False, 'import time\n'), ((427, 444), 'schedule.every', 'schedule.every', (['(5)'], {}), '(5)\n', (441, 444), False, 'impo... |
"""
Getting started with The Cannon and APOGEE
"""
import os
import numpy as np
from astropy.table import Table
import AnniesLasso as tc
# Load in the data.
PATH, CATALOG, FILE_FORMAT = ("/Users/arc/research/apogee/", "apogee-rg.fits",
"apogee-rg-custom-normalization-{}.memmap")
labelled_set = Table.read(os.pa... | [
"numpy.abs",
"numpy.mean",
"AnniesLasso.vectorizer.polynomial.terminator",
"os.path.join",
"AnniesLasso.L1RegularizedCannonModel",
"numpy.random.seed"
] | [((840, 859), 'numpy.random.seed', 'np.random.seed', (['(888)'], {}), '(888)\n', (854, 859), True, 'import numpy as np\n'), ((1055, 1203), 'AnniesLasso.L1RegularizedCannonModel', 'tc.L1RegularizedCannonModel', (['labelled_set[train_set]', 'normalized_flux[train_set]', 'normalized_ivar[train_set]'], {'dispersion': 'disp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`fit`
==================
.. module:: fit
:synopsis:
.. moduleauthor:: hbldh <<EMAIL>>
Created on 2015-09-24, 07:18:22
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import a... | [
"b2ac.eigenmethods.inverse_iteration.inverse_iteration_for_eigenvector_double",
"b2ac.matrix.matrix_operations.inverse_symmetric_3by3_double",
"numpy.array",
"numpy.dot",
"b2ac.eigenmethods.qr_algorithm.QR_algorithm_shift_Givens_double"
] | [((1195, 1220), 'numpy.array', 'np.array', (['points', '"""float"""'], {}), "(points, 'float')\n", (1203, 1220), True, 'import numpy as np\n'), ((2502, 2566), 'numpy.array', 'np.array', (['[S[3, 3], S[3, 4], S[3, 5], S[4, 4], S[4, 5], S[5, 5]]'], {}), '([S[3, 3], S[3, 4], S[3, 5], S[4, 4], S[4, 5], S[5, 5]])\n', (2510,... |
import logging
from contextlib import contextmanager
import AIPS
import AIPSDir
import ObitTalkUtil
import OErr
import OSystem
import katacomb.configuration as kc
log = logging.getLogger('katacomb')
# Single obit context class
__obit_context = None
class ObitContext(object):
"""
Small wrapper class enca... | [
"logging.getLogger",
"ObitTalkUtil.SetEnviron",
"katacomb.configuration.get_config",
"OErr.printErr",
"OSystem.Shutdown",
"OSystem.OSystem",
"OErr.printErrMsg",
"OErr.OErr"
] | [((174, 203), 'logging.getLogger', 'logging.getLogger', (['"""katacomb"""'], {}), "('katacomb')\n", (191, 203), False, 'import logging\n'), ((632, 647), 'katacomb.configuration.get_config', 'kc.get_config', ([], {}), '()\n', (645, 647), True, 'import katacomb.configuration as kc\n'), ((674, 685), 'OErr.OErr', 'OErr.OEr... |
from app.models import User,Post, Comment,Clap
from app import db
# def setUp(self):
# self.user_Jack = User(username = 'Jack',password = '<PASSWORD>', email = '<EMAIL>')
def tearDown(self):
Post.query.delete()
User.query.delete()
Comment.query.delete()
Clap.query.delete() | [
"app.models.User.query.delete",
"app.models.Comment.query.delete",
"app.models.Clap.query.delete",
"app.models.Post.query.delete"
] | [((209, 228), 'app.models.Post.query.delete', 'Post.query.delete', ([], {}), '()\n', (226, 228), False, 'from app.models import User, Post, Comment, Clap\n'), ((237, 256), 'app.models.User.query.delete', 'User.query.delete', ([], {}), '()\n', (254, 256), False, 'from app.models import User, Post, Comment, Clap\n'), ((2... |
"""
Copyright (c) 2020 <NAME> <EMAIL>
zlib License, see LICENSE file.
"""
import json
import pygame
from draw import draw_polygon
from export import generate_shape_groups, write_frames, generate_horizontal_line_sets, generate_shapes, \
generate_horizontal_line_groups, optimize_screen_buffer_colors
... | [
"export.write_frames",
"pygame.init",
"pygame.draw.line",
"pygame.event.get",
"pygame.Color",
"pygame.display.set_mode",
"pygame.display.flip",
"export.optimize_screen_buffer_colors",
"export.generate_shape_groups",
"export.generate_horizontal_line_groups",
"export.generate_horizontal_line_sets"... | [((1865, 1878), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1876, 1878), False, 'import pygame\n'), ((1889, 1924), 'pygame.display.set_mode', 'pygame.display.set_mode', (['[240, 160]'], {}), '([240, 160])\n', (1912, 1924), False, 'import pygame\n'), ((1934, 1953), 'pygame.time.Clock', 'pygame.time.Clock', ([], {})... |
import logging
import multiprocessing
import os
import pickle as pkl
import numpy as np
import tensorflow as tf
from gensim.models import word2vec
from gensim.models.word2vec import PathLineSentences
logger = logging.getLogger('Word2Vec')
logger.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(nam... | [
"logging.getLogger",
"numpy.random.normal",
"logging.StreamHandler",
"pickle.dump",
"tensorflow.app.flags.DEFINE_integer",
"logging.Formatter",
"os.path.join",
"numpy.asarray",
"tensorflow.app.flags.DEFINE_string",
"multiprocessing.cpu_count",
"numpy.stack",
"numpy.concatenate",
"gensim.mode... | [((210, 239), 'logging.getLogger', 'logging.getLogger', (['"""Word2Vec"""'], {}), "('Word2Vec')\n", (227, 239), False, 'import logging\n'), ((282, 355), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'], {}), "('%(asctime)s - %(name)s - %(levelname)s - %(message)s... |
#!/usr/bin/python3.8
import time
import copy
import random
import numpy as np
import clustering as clt
class HyperParams:
def __init__(self, population_size : int, crossover_rate : float, mutation_rate : float):
self._population_size = population_size
self._crossover_rate = crossover_rate
... | [
"random.random",
"random.choices",
"random.randint",
"clustering.Clusters"
] | [((1342, 1403), 'clustering.Clusters', 'clt.Clusters', (['self._instances[a].k', 'self._instances[a].points'], {}), '(self._instances[a].k, self._instances[a].points)\n', (1354, 1403), True, 'import clustering as clt\n'), ((1470, 1500), 'random.randint', 'random.randint', (['(1)', '(self._k - 2)'], {}), '(1, self._k - ... |
"""
Utilities related to matplotlib.
"""
import logging
from matplotlib.ticker import Formatter
from pytools.api import AllTracker
from pytools.meta import SingletonMeta
log = logging.getLogger(__name__)
#
# Exported names
#
__all__ = ["PercentageFormatter"]
#
# Ensure all symbols introduced below are included... | [
"logging.getLogger"
] | [((180, 207), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (197, 207), False, 'import logging\n')] |
from django.db import models
class BadQuery(models.Model):
date = models.DateTimeField(auto_now=True)
query = models.TextField() | [
"django.db.models.DateTimeField",
"django.db.models.TextField"
] | [((72, 107), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)'}), '(auto_now=True)\n', (92, 107), False, 'from django.db import models\n'), ((120, 138), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (136, 138), False, 'from django.db import models\n')] |
import random
from .base import *
try:
from .private import *
except ImportError:
raise ImportError("""
Please create private.py file
with contain configuration for
====================================
SECRET_KEY = '{}'
DEBUG = False
ALLOWED_HOSTS = []
SSHUB_API = 'api-key'
==... | [
"random.SystemRandom"
] | [((379, 400), 'random.SystemRandom', 'random.SystemRandom', ([], {}), '()\n', (398, 400), False, 'import random\n')] |
import sublime, sublime_plugin
from os.path import join as join_path, isdir
from os import mkdir
IS_WINDOWS = sublime.platform() == 'windows'
PATH_SEPARATOR = '\\' if IS_WINDOWS else '/'
EXTENSION = '.exe' if IS_WINDOWS else ''
class VlangBuilderCommand(sublime_plugin.WindowCommand):
def run(self, **kwargs):
... | [
"os.path.join",
"os.path.isdir",
"os.mkdir",
"sublime.platform",
"sublime.load_settings"
] | [((112, 130), 'sublime.platform', 'sublime.platform', ([], {}), '()\n', (128, 130), False, 'import sublime, sublime_plugin\n'), ((1043, 1086), 'sublime.load_settings', 'sublime.load_settings', (['"""V.sublime-settings"""'], {}), "('V.sublime-settings')\n", (1064, 1086), False, 'import sublime, sublime_plugin\n'), ((130... |
# Generated by Django 2.1.5 on 2020-07-24 07:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('logs_manager', '0005_auto_20200724_0647'),
]
operations = [
migrations.RemoveField(
model_name='analyticlog',
name='logobjec... | [
"django.db.migrations.AlterModelOptions",
"django.db.migrations.DeleteModel",
"django.db.migrations.RemoveField",
"django.db.migrations.RenameField"
] | [((232, 302), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""analyticlog"""', 'name': '"""logobject_ptr"""'}), "(model_name='analyticlog', name='logobject_ptr')\n", (254, 302), False, 'from django.db import migrations\n'), ((347, 451), 'django.db.migrations.AlterModelOptions', 'mi... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os, zlib, pickle, base64, string, hashlib, random, functools
# for 2/3 compatibility
try:
unicode
except NameError:
# this happens in python3
unicode = ()
def smart_str(obj):
"smart version of str(), works in both python2/3, regardless of whether obj... | [
"os.path.exists",
"os.makedirs",
"base64.urlsafe_b64encode",
"pickle.dumps",
"os.rename",
"os.path.join",
"functools.wraps",
"zlib.compress",
"os.path.isdir",
"random.random"
] | [((1671, 1699), 'base64.urlsafe_b64encode', 'base64.urlsafe_b64encode', (['hd'], {}), '(hd)\n', (1695, 1699), False, 'import os, zlib, pickle, base64, string, hashlib, random, functools\n'), ((1788, 1822), 'os.path.join', 'os.path.join', (['self.cachedir', 'fname'], {}), '(self.cachedir, fname)\n', (1800, 1822), False,... |
import sublime, sublime_plugin
import os
from ...libs import util
from ...libs import JavascriptEnhancementsExecuteOnTerminalCommand
class JavascriptEnhancementsGenerateJsdocCommand(JavascriptEnhancementsExecuteOnTerminalCommand, sublime_plugin.WindowCommand):
is_node = True
is_bin_path = True
def prepare_comm... | [
"os.path.isfile",
"os.path.join",
"sublime.error_message"
] | [((354, 463), 'os.path.join', 'os.path.join', (["self.settings['project_dir_name']", "self.settings['project_settings']['jsdoc']['conf_file']"], {}), "(self.settings['project_dir_name'], self.settings[\n 'project_settings']['jsdoc']['conf_file'])\n", (366, 463), False, 'import os\n'), ((466, 497), 'os.path.isfile', ... |
"""
crash_geocoding
Normalizes CRASH data into collision _events_ and collision _involved persons_, then matches
collision events to the centreline conflation target that was created by
`centreline_conflation_target`.
Our legacy schema in Oracle stores both event-related and involved-person-related information
in a s... | [
"datetime.datetime",
"airflow_utils.create_bash_task_nested",
"airflow_utils.create_dag"
] | [((1359, 1380), 'datetime.datetime', 'datetime', (['(2019)', '(7)', '(17)'], {}), '(2019, 7, 17)\n', (1367, 1380), False, 'from datetime import datetime\n'), ((1423, 1483), 'airflow_utils.create_dag', 'create_dag', (['__file__', '__doc__', 'START_DATE', 'SCHEDULE_INTERVAL'], {}), '(__file__, __doc__, START_DATE, SCHEDU... |
from collections import Counter
adapters = []
for line in open('input.txt', 'r').readlines():
adapters.append(int(line.strip()))
adapters = sorted(adapters)
device_joltage = adapters[-1] + 3
adapters.append(device_joltage)
dp = Counter()
dp[0] = 1
for adapter in adapters:
dp[adapter] = dp[adapter - 3] + dp[adapte... | [
"collections.Counter"
] | [((232, 241), 'collections.Counter', 'Counter', ([], {}), '()\n', (239, 241), False, 'from collections import Counter\n')] |
import torch.nn as nn
from architectures.position_wise_feed_forward_net import PositionWiseFeedForwardNet
from architectures.multi_head_attention import MultiHeadAttention
from architectures.add_and_norm import AddAndNorm
class TransformerEncoderBlock(nn.Module):
def __init__(self, d_model, n_heads, d_ff, dropout... | [
"torch.nn.Dropout",
"architectures.add_and_norm.AddAndNorm",
"architectures.position_wise_feed_forward_net.PositionWiseFeedForwardNet",
"torch.nn.Linear",
"architectures.multi_head_attention.MultiHeadAttention"
] | [((405, 432), 'torch.nn.Linear', 'nn.Linear', (['d_model', 'd_model'], {}), '(d_model, d_model)\n', (414, 432), True, 'import torch.nn as nn\n'), ((453, 480), 'torch.nn.Linear', 'nn.Linear', (['d_model', 'd_model'], {}), '(d_model, d_model)\n', (462, 480), True, 'import torch.nn as nn\n'), ((500, 527), 'torch.nn.Linear... |
import struct
import numpy
from math import floor
class HeightMap:
def __init__(self, width, length, heightData=None, max_val=0):
self.heightData = (
heightData if heightData != None else [0 for n in range(width * length)]
)
self.width = width
self.length = length
... | [
"numpy.mean",
"numpy.median",
"numpy.average",
"struct.pack",
"struct.unpack"
] | [((4669, 4706), 'numpy.average', 'numpy.average', (['hdata'], {'weights': 'weights'}), '(hdata, weights=weights)\n', (4682, 4706), False, 'import numpy\n'), ((4318, 4355), 'numpy.average', 'numpy.average', (['hdata'], {'weights': 'weights'}), '(hdata, weights=weights)\n', (4331, 4355), False, 'import numpy\n'), ((4357,... |
#!/usr/bin/env python3
import zipfile
# The file to USE inside the zip, before compression
filein = "index.php"
print("[i] FileIn: %s\n" % filein)
# How deep are we going?
depth = ""
# Loop 11 times (00-10)
for i in range(11):
# The .zip file to use
zipname = "depth-%02d.zip" % i
print("[i] ZipName: %s" % zip... | [
"zipfile.ZipFile"
] | [((365, 394), 'zipfile.ZipFile', 'zipfile.ZipFile', (['zipname', '"""w"""'], {}), "(zipname, 'w')\n", (380, 394), False, 'import zipfile\n')] |
from ctypes import *
from typing import *
from pathlib import Path
from numpy import array, cos, ndarray, pi, random, sin, zeros, tan
try:
lib = cdll.LoadLibrary(str(Path(__file__).with_name("libkmeans.so")))
except Exception as E:
print(f"Cannot load DLL")
print(E)
class observation_2d(Structure):
... | [
"numpy.tan",
"pathlib.Path",
"numpy.random.random",
"numpy.array",
"numpy.zeros",
"numpy.cos",
"numpy.random.seed",
"numpy.sin"
] | [((2541, 2580), 'numpy.zeros', 'zeros', (['[k, 2]'], {'dtype': 'observations.dtype'}), '([k, 2], dtype=observations.dtype)\n', (2546, 2580), False, 'from numpy import array, cos, ndarray, pi, random, sin, zeros, tan\n'), ((2593, 2612), 'numpy.zeros', 'zeros', (['k'], {'dtype': 'int'}), '(k, dtype=int)\n', (2598, 2612),... |
"""https://projecteuler.net/problem=4"""
from euler.main import largest_palindrome
def test_004() -> None:
"""Expected: 906609"""
assert largest_palindrome(3) == 906609
| [
"euler.main.largest_palindrome"
] | [((148, 169), 'euler.main.largest_palindrome', 'largest_palindrome', (['(3)'], {}), '(3)\n', (166, 169), False, 'from euler.main import largest_palindrome\n')] |
from collections import Counter, defaultdict
import matplotlib as mpl
import networkx as nx
import numba
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import seaborn as sns
from fa2 import ForceAtlas2
from scipy import sparse
def to_adjacency_matrix(net):
if sparse.issparse(net):
... | [
"numpy.argsort",
"networkx.draw_networkx_nodes",
"networkx.draw_networkx_labels",
"numpy.arange",
"seaborn.color_palette",
"networkx.spring_layout",
"networkx.from_scipy_sparse_matrix",
"numpy.linspace",
"networkx.from_numpy_array",
"pandas.DataFrame",
"scipy.sparse.csr_matrix",
"networkx.adja... | [((293, 313), 'scipy.sparse.issparse', 'sparse.issparse', (['net'], {}), '(net)\n', (308, 313), False, 'from scipy import sparse\n'), ((792, 812), 'scipy.sparse.issparse', 'sparse.issparse', (['net'], {}), '(net)\n', (807, 812), False, 'from scipy import sparse\n'), ((1070, 1102), 'collections.defaultdict', 'defaultdic... |
from time import gmtime, strftime
def app(environ, start_response):
data = strftime("minimal gunicorn demo: %Y-%m-%d %H:%M:%S", gmtime()).encode('UTF-8')
start_response("200 OK", [
("Content-Type", "text/plain"),
("Content-Length", str(len(data)))
])
return iter([data])
| [
"time.gmtime"
] | [((133, 141), 'time.gmtime', 'gmtime', ([], {}), '()\n', (139, 141), False, 'from time import gmtime, strftime\n')] |
"""Transducers for RxPY.
There are several different implementations of transducers in Python.
This implementation is currently targeted for:
- http://code.sixty-north.com/python-transducers
You should also read the excellent article series "Understanding
Transducers through Python" at:
- http://sixty-north.com/bl... | [
"rx.internal.extensionmethod",
"rx.core.AnonymousObservable"
] | [((974, 1001), 'rx.internal.extensionmethod', 'extensionmethod', (['Observable'], {}), '(Observable)\n', (989, 1001), False, 'from rx.internal import extensionmethod\n'), ((1707, 1737), 'rx.core.AnonymousObservable', 'AnonymousObservable', (['subscribe'], {}), '(subscribe)\n', (1726, 1737), False, 'from rx.core import ... |
from django.contrib.auth import get_user_model
from rest_framework import authentication, permissions, viewsets, filters
from .forms import TaskFilter, SprintFilter
from .models import Sprint, Task
from .serializers import SprintSerializer, TaskSerializer, UserSerializer
#from django.shortcuts import render
User = ge... | [
"django.contrib.auth.get_user_model"
] | [((318, 334), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (332, 334), False, 'from django.contrib.auth import get_user_model\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_cdigraphlayout
----------------------------------
Tests for `cdigraphlayout` module.
"""
import os
import sys
import unittest
import io
import tempfile
import shutil
import json
import ndex2
from cdigraphlayout import cdigraphlayoutcmd
class TestCdIgraphLayout... | [
"cdigraphlayout.cdigraphlayoutcmd._get_bounding_box_from_user_str",
"ndex2.create_nice_cx_from_file",
"os.path.join",
"cdigraphlayout.cdigraphlayoutcmd.run_layout",
"os.path.dirname",
"cdigraphlayout.cdigraphlayoutcmd._parse_arguments",
"cdigraphlayout.cdigraphlayoutcmd._get_node_size_from_cyvisual_prop... | [((357, 382), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (372, 382), False, 'import os\n'), ((407, 456), 'os.path.join', 'os.path.join', (['TEST_DIR', '"""data"""', '"""100node_example"""'], {}), "(TEST_DIR, 'data', '100node_example')\n", (419, 456), False, 'import os\n'), ((655, 705), 'c... |
"""
Deep Residual Learning for Image Recognition
https://arxiv.org/abs/1512.03385
"""
from typing import Type
import torch.nn as nn
from uninas.modules.networks.stackedcells import StackedCellsNetworkBody
from uninas.modules.stems.cnn import ConvStem
from uninas.modules.layers.cnn import PoolingLayer
from uninas.modul... | [
"uninas.utils.generate.networks.manually.abstract.get_stem_instance",
"uninas.builder.Builder",
"uninas.utils.generate.networks.manually.abstract.get_network",
"uninas.utils.generate.networks.manually.abstract.get_passthrough_partials",
"uninas.utils.torch.misc.count_parameters",
"uninas.utils.shape.Shape... | [((770, 790), 'uninas.utils.shape.Shape', 'Shape', (['[3, 224, 224]'], {}), '([3, 224, 224])\n', (775, 790), False, 'from uninas.utils.shape import Shape\n'), ((798, 811), 'uninas.utils.shape.Shape', 'Shape', (['[1000]'], {}), '([1000])\n', (803, 811), False, 'from uninas.utils.shape import Shape\n'), ((838, 933), 'uni... |
#!/usr/bin/env python
import requests
from datetime import datetime
from config_parser.config_parser import get_config_value
from db.models import AccountBalance, Account, Session
from sqlalchemy.orm import eagerload
def update_accounts_balances(tgbot):
config_json_rpc_api_url = get_config_value('BLOCKCHAINPOLLER'... | [
"db.models.AccountBalance",
"datetime.datetime.utcnow",
"db.models.AccountBalance.id.desc",
"requests.get",
"config_parser.config_parser.get_config_value",
"sqlalchemy.orm.eagerload",
"db.models.Session"
] | [((285, 341), 'config_parser.config_parser.get_config_value', 'get_config_value', (['"""BLOCKCHAINPOLLER"""', '"""json_rpc_api_url"""'], {}), "('BLOCKCHAINPOLLER', 'json_rpc_api_url')\n", (301, 341), False, 'from config_parser.config_parser import get_config_value\n'), ((1037, 1046), 'db.models.Session', 'Session', ([]... |
import logging
import os
import pytest
import shakedown # required by sdk_utils version checks
import sdk_cmd
import sdk_plan
import sdk_tasks
import sdk_upgrade
import sdk_utils
from tests import config
log = logging.getLogger(__name__)
FRAMEWORK_NAME = "secrets/hello-world"
NUM_HELLO = 2
NUM_WORLD = 3
# check en... | [
"logging.getLogger",
"sdk_cmd.run_cli",
"sdk_tasks.check_tasks_updated",
"sdk_upgrade.soak_upgrade_downgrade",
"sdk_tasks.get_task_ids",
"sdk_cmd.svc_cli",
"sdk_plan.wait_for_completed_deployment",
"sdk_tasks.check_running"
] | [((213, 240), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (230, 240), False, 'import logging\n'), ((641, 748), 'sdk_upgrade.soak_upgrade_downgrade', 'sdk_upgrade.soak_upgrade_downgrade', (['config.PACKAGE_NAME', 'config.SERVICE_NAME', 'config.DEFAULT_TASK_COUNT'], {}), '(config.PACKAGE... |
"""
A sampler defines a method to sample random data from certain distribution.
"""
from typing import List
import numpy as np
class BaseSampler(object):
def __init__(self):
pass
def sample(self, shape, *args):
raise NotImplementedError
class IntSampler(BaseSampler):
def __init__(self... | [
"numpy.random.normal",
"numpy.array",
"numpy.random.randint",
"numpy.sum",
"numpy.random.uniform",
"numpy.random.randn"
] | [((582, 657), 'numpy.random.randint', 'np.random.randint', ([], {'low': 'self.low', 'high': 'self.high', 'size': 'shape', 'dtype': 'np.int64'}), '(low=self.low, high=self.high, size=shape, dtype=np.int64)\n', (599, 657), True, 'import numpy as np\n'), ((796, 809), 'numpy.array', 'np.array', (['low'], {}), '(low)\n', (8... |
import json
import logging
from django.urls import reverse
from seahub.test_utils import BaseTestCase
from tests.common.utils import randstring
from seahub.institutions.models import Institution, InstitutionAdmin
from seahub.profile.models import Profile
logger = logging.getLogger(__name__)
class AdminInstitutionUs... | [
"logging.getLogger",
"seahub.profile.models.Profile.objects.get_profile_by_user",
"json.loads",
"seahub.institutions.models.Institution.objects.create",
"seahub.institutions.models.Institution.objects.get",
"django.urls.reverse",
"seahub.profile.models.Profile.objects.add_or_update"
] | [((266, 293), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (283, 293), False, 'import logging\n'), ((435, 472), 'seahub.institutions.models.Institution.objects.create', 'Institution.objects.create', ([], {'name': 'name'}), '(name=name)\n', (461, 472), False, 'from seahub.institutions.mo... |
'''
A warehouse has one loading dock that workers use to load and unload goods.
Warehouse workers carrying the goods arrive at the loading dock at different times. They form two queues, a "loading" queue and an "unloading" queue. Within each queue, the workers are ordered by the time they arrive at the dock.
The arri... | [
"collections.deque"
] | [((1991, 1998), 'collections.deque', 'deque', ([], {}), '()\n', (1996, 1998), False, 'from collections import deque\n'), ((2049, 2056), 'collections.deque', 'deque', ([], {}), '()\n', (2054, 2056), False, 'from collections import deque\n')] |
import numpy as np
class StandardDeviation():
@staticmethod
def standardDeviation(data):
return np.std(data) | [
"numpy.std"
] | [((113, 125), 'numpy.std', 'np.std', (['data'], {}), '(data)\n', (119, 125), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#refer:http://www.wooyun.org/bugs/wooyun-2014-081469
'''
Created on 2015-12-19
@author: 真个程序员不太冷
'''
import re
import urlparse
def assign(service, arg):
if service == "zte":
arr = urlparse.urlparse(arg)
return True, '%s://%s/' % (arr.sche... | [
"urlparse.urlparse"
] | [((253, 275), 'urlparse.urlparse', 'urlparse.urlparse', (['arg'], {}), '(arg)\n', (270, 275), False, 'import urlparse\n')] |
from multiprocessing.pool import Pool
from script.util.Logger import Logger
from script.util.misc_util import dump_pickle, load_pickle, dump_json, load_json
class LoggerMixIn:
def __init__(self, verbose=0):
self.verbose = verbose
@property
def log(self):
level = Logger.verbose_... | [
"multiprocessing.pool.Pool",
"script.util.Logger.Logger.verbose_to_level",
"script.util.misc_util.load_pickle",
"script.util.misc_util.dump_pickle",
"script.util.Logger.Logger",
"script.util.misc_util.dump_json",
"script.util.misc_util.load_json"
] | [((305, 342), 'script.util.Logger.Logger.verbose_to_level', 'Logger.verbose_to_level', (['self.verbose'], {}), '(self.verbose)\n', (328, 342), False, 'from script.util.Logger import Logger\n'), ((359, 403), 'script.util.Logger.Logger', 'Logger', (['self.__class__.__name__'], {'level': 'level'}), '(self.__class__.__name... |
import numpy as np
def bowl(vs, v_ref=1.0, scale=.1):
def normal(v, loc, scale):
return 1 / np.sqrt(2 * np.pi * scale**2) * np.exp( - 0.5 * np.square(v - loc) / scale**2 )
def _bowl(v):
if np.abs(v-v_ref) > 0.05:
return 2 * np.abs(v-v_ref) - 0.095
else:
return ... | [
"numpy.abs",
"numpy.sqrt",
"numpy.square"
] | [((216, 233), 'numpy.abs', 'np.abs', (['(v - v_ref)'], {}), '(v - v_ref)\n', (222, 233), True, 'import numpy as np\n'), ((107, 138), 'numpy.sqrt', 'np.sqrt', (['(2 * np.pi * scale ** 2)'], {}), '(2 * np.pi * scale ** 2)\n', (114, 138), True, 'import numpy as np\n'), ((263, 280), 'numpy.abs', 'np.abs', (['(v - v_ref)'],... |
#!/usr/bin/env python3
import sys
sys.path.append('_model')
from model import *
import korali
k = korali.Engine()
e = korali.Experiment()
e["Problem"]["Type"] = "Optimization"
e["Problem"]["Objective Function"] = model
e["Solver"]["Type"] = "Optimizer/CMAES"
e["Solver"]["Population Size"] = 5
e["Solver"]["Terminati... | [
"korali.Experiment",
"sys.path.append",
"korali.Engine"
] | [((35, 60), 'sys.path.append', 'sys.path.append', (['"""_model"""'], {}), "('_model')\n", (50, 60), False, 'import sys\n'), ((100, 115), 'korali.Engine', 'korali.Engine', ([], {}), '()\n', (113, 115), False, 'import korali\n'), ((120, 139), 'korali.Experiment', 'korali.Experiment', ([], {}), '()\n', (137, 139), False, ... |
import os
from datetime import timedelta
class Config(object):
SECRET_KEY = os.environ.get('SECRET_KEY') or 'YOUR_SECRET_KEY'
SESSION_TYPE = 'filesystem'
PERMANENT_SESSION_LIFETIME = timedelta(minutes=30)
UPVOTE_ACCOUNT = os.environ.get('UPVOTE_ACCOUNT') or 'YOUR_USERNAME'
UPVOTE_KEY = os.environ.... | [
"datetime.timedelta",
"os.environ.get"
] | [((197, 218), 'datetime.timedelta', 'timedelta', ([], {'minutes': '(30)'}), '(minutes=30)\n', (206, 218), False, 'from datetime import timedelta\n'), ((82, 110), 'os.environ.get', 'os.environ.get', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (96, 110), False, 'import os\n'), ((240, 272), 'os.environ.get', 'os.envir... |
import datetime
from django.core.cache import cache
from django.test import TestCase, override_settings
from django.utils import timezone
from wagtail.core.models import Page, Site
from wagtail.tests.utils import WagtailTestUtils
from tests.app.models import NewsIndex, NewsItem
def dt(*args):
return datetime.da... | [
"tests.app.models.NewsIndex",
"django.core.cache.cache.delete",
"wagtail.core.models.Page",
"django.utils.timezone.get_current_timezone",
"django.test.override_settings",
"wagtail.core.models.Page.objects.get",
"wagtail.core.models.Site.objects.get",
"wagtail.core.models.Site.objects.create"
] | [((3911, 3985), 'django.test.override_settings', 'override_settings', ([], {'ALLOWED_HOSTS': "['localhost', 'site-a.com', 'site-b.org']"}), "(ALLOWED_HOSTS=['localhost', 'site-a.com', 'site-b.org'])\n", (3928, 3985), False, 'from django.test import TestCase, override_settings\n'), ((531, 569), 'wagtail.core.models.Site... |
#!/usr/bin/env python
# encoding: utf-8
'''
#-------------------------------------------------------------------
# CONFIDENTIAL --- CUSTOM STUDIOS
#-------------------------------------------------------------------
# ... | [
"selenium.webdriver.Chrome",
"selenium.webdriver.ChromeOptions",
"random.choices",
"time.sleep"
] | [((2420, 2445), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (2443, 2445), False, 'from selenium import webdriver\n'), ((2921, 2961), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'options': 'chrome_options'}), '(options=chrome_options)\n', (2937, 2961), False, 'from seleniu... |
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 7 13:43:01 2016
@author: fergal
A series of metrics to quantify the noise in a lightcurve:
Includes:
x sgCdpp
x Marshall's noise estimate
o An FT based estimate of 6 hour artifact strength.
o A per thruster firing estimate of 6 hour artifact strength.
$Id$
$URL$
"""
... | [
"numpy.convolve",
"matplotlib.pyplot.hist",
"numpy.sqrt",
"scipy.signal.savgol_filter",
"numpy.nanmean",
"numpy.isfinite",
"fft.computeFft",
"numpy.mean",
"matplotlib.pyplot.plot",
"numpy.diff",
"numpy.linspace",
"numpy.nanstd",
"numpy.ones",
"numpy.std",
"matplotlib.pyplot.xlim",
"num... | [((1197, 1228), 'fft.computeFft', 'fft.computeFft', (['y', 'expTime_days'], {}), '(y, expTime_days)\n', (1211, 1228), False, 'import fft\n'), ((3608, 3667), 'scipy.signal.savgol_filter', 'savgol_filter', (['y'], {'window_length': 'window', 'polyorder': 'polyorder'}), '(y, window_length=window, polyorder=polyorder)\n', ... |
#!/usr/bin/env python
#
# test_parse_data.py -
#
# Author: <NAME> <<EMAIL>>
#
import argparse
from fsl.utils import parse_data, tempdir, path
import os.path as op
from fsl.data.vtk import VTKMesh
from fsl.data.gifti import GiftiMesh
from fsl.data.image import Image
from fsl.data.atlases import Atlas
from pytest import... | [
"fsl.utils.tempdir.tempdir",
"fsl.utils.path.hasExt",
"argparse.ArgumentParser",
"os.path.join",
"os.path.dirname",
"pytest.raises"
] | [((407, 427), 'os.path.dirname', 'op.dirname', (['__file__'], {}), '(__file__)\n', (417, 427), True, 'import os.path as op\n'), ((478, 521), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Reads a VTK file"""'], {}), "('Reads a VTK file')\n", (501, 521), False, 'import argparse\n'), ((602, 635), 'os.path.jo... |
# Copyright 2020 ASL19 Organization
#
# 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 wr... | [
"django.db.models.CharField"
] | [((729, 761), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (745, 761), False, 'from django.db import models\n')] |
#!/usr/bin/env python
import base64, json, pika
from xml.etree.ElementTree import Element, tostring, fromstring
# RabbitMQ Connection Information
RABBIT_HOST = 'vcd-cell1.lab.orange.sk'
RABBIT_HOST = 'oblak.orange.sk'
RABBIT_PORT = '5672'
RABBIT_USER = 'vcdext'
RABBIT_PASSWORD = '<PASSWORD>.'
# Exchange and Queue we ... | [
"json.loads",
"xml.etree.ElementTree.tostring",
"base64.b64encode",
"json.dumps",
"pika.PlainCredentials",
"base64.b64decode",
"xml.etree.ElementTree.Element",
"pika.BasicProperties",
"xml.etree.ElementTree.fromstring"
] | [((1661, 1673), 'xml.etree.ElementTree.Element', 'Element', (['tag'], {}), '(tag)\n', (1668, 1673), False, 'from xml.etree.ElementTree import Element, tostring, fromstring\n'), ((1808, 1822), 'xml.etree.ElementTree.tostring', 'tostring', (['elem'], {}), '(elem)\n', (1816, 1822), False, 'from xml.etree.ElementTree impor... |
from datetime import datetime
from uuid import uuid4
from typing import (
ClassVar,
TypeVar,
Union
)
from sqlalchemy import update as sa_update
from sqlalchemy.future import select as sa_select
from sqlalchemy.sql.elements import BinaryExpression
from .base import BaseRepository
from .types_ import ModelT... | [
"datetime.datetime.utcnow",
"sqlalchemy.future.select",
"uuid.uuid4",
"sqlalchemy.update",
"typing.TypeVar"
] | [((694, 756), 'typing.TypeVar', 'TypeVar', (['"""WhereStatement"""'], {'bound': 'Union[BinaryExpression, bool]'}), "('WhereStatement', bound=Union[BinaryExpression, bool])\n", (701, 756), False, 'from typing import ClassVar, TypeVar, Union\n'), ((1705, 1712), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (1710, 1712), False... |
from scipy import optimize
# Generate noisy data from NCSTR system with tau=10 and n=2
a = rtdpy.Ncstr(tau=10, n=2, dt=1, time_end=50)
xdata = a.time
noisefactor = 0.01
ydata = a.exitage \
+ (noisefactor * (np.random.rand(a.time.size) - 0.5))
def f(xdata, tau, n):
a = rtdpy.Ncstr(tau=tau, n=n, dt=1, time_end=... | [
"scipy.optimize.curve_fit"
] | [((397, 463), 'scipy.optimize.curve_fit', 'optimize.curve_fit', (['f', 'xdata', 'ydata'], {'p0': '[5, 4]', 'bounds': '(0, np.inf)'}), '(f, xdata, ydata, p0=[5, 4], bounds=(0, np.inf))\n', (415, 463), False, 'from scipy import optimize\n')] |
import os
from flask import Flask, flash, request, redirect, url_for, session, render_template
from werkzeug.utils import secure_filename
from common import utility, config
from repositories import db, cos
def admin():
try:
player_id = session.get("mobileno")
if player_id is None:
flash... | [
"flask.render_template",
"common.config.get",
"flask.session.get",
"flask.flash",
"repositories.cos.saveCSVFile",
"os.path.join",
"repositories.db.import_csv_data",
"flask.request.form.get",
"flask.redirect",
"common.utility.allowed_file",
"werkzeug.utils.secure_filename"
] | [((249, 272), 'flask.session.get', 'session.get', (['"""mobileno"""'], {}), "('mobileno')\n", (260, 272), False, 'from flask import Flask, flash, request, redirect, url_for, session, render_template\n'), ((315, 346), 'flask.flash', 'flash', (['"""Please Login as admin."""'], {}), "('Please Login as admin.')\n", (320, 3... |
# Authors: <NAME> <<EMAIL>>
# License: BSD 3 clause
from typing import List, Optional, Union
import pandas as pd
from feature_engine.dataframe_checks import _is_dataframe
from feature_engine.imputation.base_imputer import BaseImputer
from feature_engine.variable_manipulation import _check_input_parameter_variables
... | [
"feature_engine.variable_manipulation._check_input_parameter_variables",
"feature_engine.dataframe_checks._is_dataframe",
"pandas.isnull"
] | [((3587, 3630), 'feature_engine.variable_manipulation._check_input_parameter_variables', '_check_input_parameter_variables', (['variables'], {}), '(variables)\n', (3619, 3630), False, 'from feature_engine.variable_manipulation import _check_input_parameter_variables\n'), ((4209, 4225), 'feature_engine.dataframe_checks.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Simple webexteamssdk demonstration script.
Very simple script to create a demo room, post a message, and post a file.
If one or more rooms with the name of the demo room already exist, it will
delete the previously existing rooms.
The package natively retrieves your W... | [
"webexteamssdk.WebexTeamsAPI"
] | [((1944, 1959), 'webexteamssdk.WebexTeamsAPI', 'WebexTeamsAPI', ([], {}), '()\n', (1957, 1959), False, 'from webexteamssdk import WebexTeamsAPI\n')] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
import warnings
from natsort.natsort import (
as_ascii,
as_utf8,
decoder,
humansorted,
index_humansorted,
index_natsorted,
index_realsorted,
index_versorted,
natsor... | [
"warnings.simplefilter",
"natsort.natsort.ns._asdict",
"warnings.catch_warnings"
] | [((1123, 1148), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (1146, 1148), False, 'import warnings\n'), ((1154, 1185), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (1175, 1185), False, 'import warnings\n'), ((1207, 1219), 'natsort.natsort.ns._asdic... |
# Generated by Django 2.2.6 on 2020-01-24 00:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('books', '0006_auto_20200124_0048'),
]
operations = [
migrations.AddField(
model_name='doubleent... | [
"django.db.models.ForeignKey"
] | [((371, 468), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'default': '(1)', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""books.Account"""'}), "(default=1, on_delete=django.db.models.deletion.CASCADE,\n to='books.Account')\n", (388, 468), False, 'from django.db import migrations, models\n... |
"""
This file will stored all dynamic class and methods.
These methods will be used throughout the whole program.
"""
import sys
import concurrent.futures as cf
import threading
from functools import wraps
from ..utils.request import Session
from ..errors import BuildError
def Threader(f):
@wraps(f)... | [
"concurrent.futures.ThreadPoolExecutor",
"functools.wraps"
] | [((312, 320), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (317, 320), False, 'from functools import wraps\n'), ((930, 953), 'concurrent.futures.ThreadPoolExecutor', 'cf.ThreadPoolExecutor', ([], {}), '()\n', (951, 953), True, 'import concurrent.futures as cf\n')] |
import requests
import os
import sys # provide option
import argparse # parse options
import json
PATH = os.path.abspath(os.path.dirname(sys.argv[0]))
token_url = "https://api.weixin.qq.com/cgi-bin/token" # Change to control server
create_interface = "https://api.weixin.qq.com/cgi-bin/menu/create"
get_Allinterface = "... | [
"os.path.dirname",
"json.dumps",
"argparse.ArgumentParser",
"requests.get"
] | [((122, 150), 'os.path.dirname', 'os.path.dirname', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (137, 150), False, 'import os\n'), ((2923, 3025), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Provide access to modify/view wechat customized usermanual"""'}), "(description=\n 'Provide ac... |
# TODO: update or remove this file
from pytest import raises
from pypkg import cli
def test_main(capsys):
cli.main([])
captured = capsys.readouterr()
assert "write me" in captured.err
def test_usage(capsys):
with raises(SystemExit):
cli.main(["-h"])
captured = capsys.readouterr()
... | [
"pypkg.cli.main",
"pytest.raises"
] | [((113, 125), 'pypkg.cli.main', 'cli.main', (['[]'], {}), '([])\n', (121, 125), False, 'from pypkg import cli\n'), ((234, 252), 'pytest.raises', 'raises', (['SystemExit'], {}), '(SystemExit)\n', (240, 252), False, 'from pytest import raises\n'), ((262, 278), 'pypkg.cli.main', 'cli.main', (["['-h']"], {}), "(['-h'])\n",... |
# coding=utf-8
# Copyright 2014, <NAME> http://github.com/rafi
# vim: set ts=8 sw=4 tw=80 et :
import logging
import requests
from beets.plugins import BeetsPlugin
from beets import ui
from beets import dbcore
from beets import config
log = logging.getLogger('beets')
api_url = 'http://ws.audioscrobbler.com/2.0/?meth... | [
"logging.getLogger",
"beets.ui.UserError",
"beets.dbcore.query.SubstringQuery",
"requests.get",
"beets.ui.Subcommand"
] | [((244, 270), 'logging.getLogger', 'logging.getLogger', (['"""beets"""'], {}), "('beets')\n", (261, 270), False, 'import logging\n'), ((734, 795), 'beets.ui.Subcommand', 'ui.Subcommand', (['"""lastimport"""'], {'help': '"""import last.fm play-count"""'}), "('lastimport', help='import last.fm play-count')\n", (747, 795)... |
import test_util.linkage.run_full_linkage_test as flt
def run_test():
print("Starting test...")
flt.run_full_linkage_test("test-data/envs/small-no-households-with-matches-single-schema/config.json")
print("Done with test")
if __name__ == "__main__":
run_test()
| [
"test_util.linkage.run_full_linkage_test.run_full_linkage_test"
] | [((106, 218), 'test_util.linkage.run_full_linkage_test.run_full_linkage_test', 'flt.run_full_linkage_test', (['"""test-data/envs/small-no-households-with-matches-single-schema/config.json"""'], {}), "(\n 'test-data/envs/small-no-households-with-matches-single-schema/config.json'\n )\n", (131, 218), True, 'import ... |
# Notes from this experiment:
# 1. adapt() is way slower than np.unique -- takes forever for 1M, hangs for 10M
# 2. TF returns error if adapt is inside tf.function. adapt uses graph inside anyway
# 3. OOM in batch mode during sparse_to_dense despite of seting sparse in keras
# 4. Mini-batch works but 15x(g)/20x slower ... | [
"tensorflow.keras.layers.Concatenate",
"pandas.read_csv",
"tensorflow.keras.layers.StringLookup",
"numpy.array",
"tensorflow.keras.Input",
"tensorflow.keras.Model",
"time.time",
"warnings.filterwarnings",
"tensorflow.stack",
"numpy.set_printoptions"
] | [((1020, 1067), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)', 'suppress': '(True)'}), '(precision=3, suppress=True)\n', (1039, 1067), True, 'import numpy as np\n'), ((1068, 1101), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1091, 1101), Fal... |
# Copyright (c) 2010 OpenStack Foundation.
#
# 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... | [
"os.path.abspath"
] | [((919, 943), 'os.path.abspath', 'os.path.abspath', (['"""../.."""'], {}), "('../..')\n", (934, 943), False, 'import os\n'), ((964, 992), 'os.path.abspath', 'os.path.abspath', (['"""../../bin"""'], {}), "('../../bin')\n", (979, 992), False, 'import os\n')] |
import warnings
import numpy as np
import scipy.sparse as sp
from joblib import Parallel, delayed
from scipy.special import expit
from sklearn.exceptions import ConvergenceWarning
from sklearn.utils import check_array, check_random_state
from sklearn.linear_model import LogisticRegression
from tqdm import tqdm
from ... | [
"numpy.tile",
"numpy.eye",
"sklearn.utils.check_random_state",
"numpy.ones",
"numpy.add",
"numpy.asarray",
"numpy.iinfo",
"joblib.Parallel",
"numpy.zeros",
"numpy.dot",
"sklearn.utils.check_array",
"warnings.warn",
"joblib.delayed"
] | [((1275, 1307), 'sklearn.utils.check_random_state', 'check_random_state', (['random_state'], {}), '(random_state)\n', (1293, 1307), False, 'from sklearn.utils import check_array, check_random_state\n'), ((1415, 1457), 'numpy.zeros', 'np.zeros', (['(n_time_steps, n_nodes, n_nodes)'], {}), '((n_time_steps, n_nodes, n_nod... |
#!/usr/bin/env python
__author__ = "<NAME>"
__license__ = "MIT"
__email__ = "<EMAIL>"
__credits__ = "<NAME> -- An amazing Linear Algebra Professor"
import cvxopt
import numpy as np
class SupportVectorClassification:
"""
Support Vector Machine classification model
"""
def __init__(self):
"""
... | [
"numpy.ones",
"numpy.array",
"numpy.zeros",
"numpy.outer",
"numpy.dot",
"cvxopt.matrix",
"numpy.ravel",
"cvxopt.solvers.qp"
] | [((407, 419), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (415, 419), True, 'import numpy as np\n'), ((444, 456), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (452, 456), True, 'import numpy as np\n'), ((1843, 1881), 'cvxopt.matrix', 'cvxopt.matrix', (['expected_values', '(1, m)'], {}), '(expected_values, ... |
import os
import requests
import json
import time
import random
import math
baseUrl = "https://www.edeka.de/rezepte/rezept/suche"
external_baseUrl = "https://www.edeka.de"
resultsPerPage = 50
pageQuery = f"?size={resultsPerPage}&page="
def getJson(url):
jsonText = requests.get(url).json()
retur... | [
"os.path.exists",
"json.dumps",
"os.makedirs",
"requests.get"
] | [((2782, 2807), 'os.path.exists', 'os.path.exists', (['"""recipes"""'], {}), "('recipes')\n", (2796, 2807), False, 'import os\n'), ((2818, 2840), 'os.makedirs', 'os.makedirs', (['"""recipes"""'], {}), "('recipes')\n", (2829, 2840), False, 'import os\n'), ((2985, 3014), 'os.path.exists', 'os.path.exists', (['"""ingredie... |
# Generated by Django 3.1.8 on 2021-10-31 02:47
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('dogs', '0003_auto_202109... | [
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((227, 284), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (258, 284), False, 'from django.db import migrations, models\n'), ((459, 552), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
"""
Copyright 2016 adpoliak
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,... | [
"tkinter.ttk.Checkbutton",
"tkinter.ttk.Button",
"tkinter.BooleanVar",
"tkinter.Toplevel.__init__",
"tkinter.ttk.Combobox"
] | [((3392, 3443), 'tkinter.Toplevel.__init__', 'tk.Toplevel.__init__', (['self', 'master', '*args'], {}), '(self, master, *args, **kwargs)\n', (3412, 3443), True, 'import tkinter as tk\n'), ((4009, 4024), 'tkinter.BooleanVar', 'tk.BooleanVar', ([], {}), '()\n', (4022, 4024), True, 'import tkinter as tk\n'), ((4091, 4106)... |
# stdlib imports
import subprocess
import sys
# local imports
from errors import AppliedAlterError
# TODO: Move connection management to schema.py. Instantiate a connection
# before each run() method and close it at the end, using the DB.conn() method.
class Db(object):
"""
Do not instantiate directly.
C... | [
"subprocess.Popen",
"errors.AppliedAlterError",
"sys.stderr.write",
"sys.stdout.write"
] | [((820, 868), 'sys.stdout.write', 'sys.stdout.write', (['"""Creating revision database\n"""'], {}), "('Creating revision database\\n')\n", (836, 868), False, 'import sys\n'), ((907, 951), 'sys.stdout.write', 'sys.stdout.write', (['"""Creating history table\n"""'], {}), "('Creating history table\\n')\n", (923, 951), Fal... |
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth import authenticate, login
from django.views.generic import View
from django.contrib.auth.models import User
from .forms import UserForm
from .models import UserProfile, Project, Tag
from .search import get_query
def Leaderboard... | [
"django.shortcuts.render",
"django.contrib.auth.authenticate",
"django.shortcuts.get_object_or_404",
"django.contrib.auth.login",
"django.shortcuts.redirect",
"django.contrib.auth.models.User.objects.all"
] | [((407, 464), 'django.shortcuts.render', 'render', (['request', '"""volunteerapp/leaderboard.html"""', 'context'], {}), "(request, 'volunteerapp/leaderboard.html', context)\n", (413, 464), False, 'from django.shortcuts import render, redirect, get_object_or_404\n'), ((520, 561), 'django.shortcuts.get_object_or_404', 'g... |
# -*- coding: utf-8 -*-
## \package dbr.log
# MIT licensing
# See: docs/LICENSE.txt
import os, sys
from fileio.fileio import AppendFile
from globals.dateinfo import GetDate
from globals.dateinfo import GetTime
from globals.dateinfo import dtfmt
from globals.paths import PATH_logs
from globals.strings import GetM... | [
"os.makedirs",
"globals.dateinfo.GetDate",
"os.path.isfile",
"globals.strings.IsString",
"fileio.fileio.AppendFile",
"os.path.isdir",
"globals.strings.GetModuleString",
"globals.dateinfo.GetTime"
] | [((1968, 2019), 'fileio.fileio.AppendFile', 'AppendFile', (['self.LogFile', 'log_header'], {'noStrip': 'u"""\n"""'}), "(self.LogFile, log_header, noStrip=u'\\n')\n", (1978, 2019), False, 'from fileio.fileio import AppendFile\n'), ((2132, 2160), 'os.path.isfile', 'os.path.isfile', (['self.LogFile'], {}), '(self.LogFile)... |
import torch
import torch.utils.data as data
import random
import math
import os
import logging
from utils import config
import pickle
from tqdm import tqdm
import numpy as np
import pprint
pp = pprint.PrettyPrinter(indent=1)
import re
import time
import nltk
class Lang:
def __init__(self, init_index2word):
... | [
"pickle.dump",
"os.path.exists",
"pickle.load",
"pprint.PrettyPrinter"
] | [((196, 226), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(1)'}), '(indent=1)\n', (216, 226), False, 'import pprint\n'), ((2640, 2687), 'os.path.exists', 'os.path.exists', (['"""data/cnn_dm/dataset_preproc.p"""'], {}), "('data/cnn_dm/dataset_preproc.p')\n", (2654, 2687), False, 'import os\n'), ((28... |
from tkinter import *
from tkinter import messagebox
import sys
import os
import signal
import time
from subprocess import *
from tkinter.scrolledtext import ScrolledText
import sqlite3
def file_previous_close():
try:
with open('home_id.txt', 'r') as f:
lines = f.read().splitlines()
... | [
"tkinter.messagebox.showerror",
"smtplib.SMTP",
"sqlite3.connect",
"os.getpid",
"tkinter.messagebox.showinfo"
] | [((640, 651), 'os.getpid', 'os.getpid', ([], {}), '()\n', (649, 651), False, 'import os\n'), ((9831, 9981), 'tkinter.messagebox.showerror', 'messagebox.showerror', (['"""Contact Us"""', '"""You can contact us at <EMAIL> in case software dosen\'t respond or for any suggestions for improvements."""'], {}), '(\'Contact Us... |
import argparse
from yaml import load
from utils import print_dic
from io import open
from toolz.dicttoolz import merge
from runner import Runner
from evaluator import Evaluator
parser = argparse.ArgumentParser(description='Bezos')
parser.add_argument('--config', default='test.yaml',
help='Configur... | [
"toolz.dicttoolz.merge",
"argparse.ArgumentParser",
"utils.print_dic",
"evaluator.Evaluator",
"yaml.load",
"io.open",
"runner.Runner"
] | [((188, 232), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Bezos"""'}), "(description='Bezos')\n", (211, 232), False, 'import argparse\n'), ((1263, 1285), 'io.open', 'open', (['args.config', '"""r"""'], {}), "(args.config, 'r')\n", (1267, 1285), False, 'from io import open\n'), ((1300,... |
from _revkit import netlist, gate
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
def _to_qiskit(self, circuit=None, with_classical_register=False):
"""
Convert RevKit quantum circuit into Qiskit quantum circuit
:param qiskit.QuantumCircuit circuit: If not `None`, add gates to this circui... | [
"qiskit.QuantumCircuit",
"qiskit.QuantumRegister",
"qiskit.ClassicalRegister"
] | [((686, 724), 'qiskit.QuantumRegister', 'QuantumRegister', (['self.num_qubits', '"""qr"""'], {}), "(self.num_qubits, 'qr')\n", (701, 724), False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'), ((769, 809), 'qiskit.ClassicalRegister', 'ClassicalRegister', (['self.num_qubits', '"""cr"""'], {}... |
"""
MIT License
Copyright 2021 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute... | [
"hans.tools.abort",
"numpy.array",
"numpy.sin",
"numpy.arange",
"os.path.exists",
"os.listdir",
"netCDF4.Dataset",
"numpy.linspace",
"numpy.meshgrid",
"pkg_resources.get_distribution",
"os.path.relpath",
"os.path.splitext",
"shutil.copy",
"hans.plottools.adaptiveLimits",
"hans.material.M... | [((3950, 4078), 'hans.integrate.ConservedField', 'ConservedField', (['self.disc', 'self.bc', 'self.geometry', 'self.material', 'self.numerics', 'self.surface'], {'q_init': 'q_init', 't_init': 't_init'}), '(self.disc, self.bc, self.geometry, self.material, self.\n numerics, self.surface, q_init=q_init, t_init=t_init)... |
"""
Script to make nucleosome occupancy track!
@author: <NAME>
"""
##### IMPORT MODULES #####
# import necessary python modules
#import matplotlib as mpl
#mpl.use('PS')
import matplotlib.pyplot as plt
import multiprocessing as mp
import numpy as np
import traceback
import itertools
import pysam
from pyatac.utils impo... | [
"pysam.tabix_compress",
"multiprocessing.JoinableQueue",
"nucleoatac.Occupancy.OccChunk",
"matplotlib.pyplot.ylabel",
"multiprocessing.Process",
"itertools.repeat",
"pyatac.utils.read_chrom_sizes_from_fasta",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.close",
"pysam.tabix_index",
"traceback.... | [((2492, 2510), 'pyatac.bias.PWM.open', 'PWM.open', (['args.pwm'], {}), '(args.pwm)\n', (2500, 2510), False, 'from pyatac.bias import PWM\n'), ((2789, 2833), 'nucleoatac.Occupancy.FragmentMixDistribution', 'FragmentMixDistribution', (['(0)'], {'upper': 'args.upper'}), '(0, upper=args.upper)\n', (2812, 2833), False, 'fr... |
#!/usr/bin/env python
# coding: utf-8
import os
import unittest
from yalign.wordpairscore import WordPairScore
class TestWordPairScore(unittest.TestCase):
def setUp(self):
self.word_pair_score = self._create_word_pair_score('test_word_scores.csv')
def _create_word_pair_score(self, filename):
... | [
"unittest.main",
"yalign.wordpairscore.WordPairScore",
"os.path.join",
"os.path.abspath"
] | [((1320, 1335), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1333, 1335), False, 'import unittest\n'), ((400, 441), 'os.path.join', 'os.path.join', (['base_path', '"""data"""', 'filename'], {}), "(base_path, 'data', filename)\n", (412, 441), False, 'import os\n'), ((457, 484), 'yalign.wordpairscore.WordPairScor... |
#!/usr/bin/env python3
"""Extended tools for datetime"""
import datetime
def how_many_seconds_to_time(now, hour, minute):
"""Return amount seconds from now to given hour and minute"""
target_time = now.replace(hour=hour, minute=minute, second=0)
if now >= target_time:
target_time += datetime.timed... | [
"datetime.datetime.now",
"datetime.timedelta"
] | [((306, 332), 'datetime.timedelta', 'datetime.timedelta', ([], {'days': '(1)'}), '(days=1)\n', (324, 332), False, 'import datetime\n'), ((467, 511), 'datetime.datetime.now', 'datetime.datetime.now', (['datetime.timezone.utc'], {}), '(datetime.timezone.utc)\n', (488, 511), False, 'import datetime\n')] |
from datetime import date
from unittest import TestCase
from workalendar.registry import IsoRegistry
from workalendar.core import Calendar
class RegionCalendar(Calendar):
'Region'
def holidays(self, year=None):
return tuple((
(date(year, 12, 25), 'Christmas'),
(date(year, 1, ... | [
"workalendar.registry.IsoRegistry",
"datetime.date"
] | [((912, 952), 'workalendar.registry.IsoRegistry', 'IsoRegistry', ([], {'load_standard_modules': '(False)'}), '(load_standard_modules=False)\n', (923, 952), False, 'from workalendar.registry import IsoRegistry\n'), ((1264, 1304), 'workalendar.registry.IsoRegistry', 'IsoRegistry', ([], {'load_standard_modules': '(False)'... |
# coding:utf-8
from django.contrib import auth
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import models
from django.contrib.auth.models import User
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django import forms
from django.... | [
"staff.models.Staff.objects.all",
"django.shortcuts.render_to_response"
] | [((627, 646), 'staff.models.Staff.objects.all', 'Staff.objects.all', ([], {}), '()\n', (644, 646), False, 'from staff.models import Staff\n'), ((658, 721), 'django.shortcuts.render_to_response', 'render_to_response', (['"""staff/show_staff.html"""', "{'staffs': staffs}"], {}), "('staff/show_staff.html', {'staffs': staf... |
from connections import i2cAdafruitConnection
from observer import observe
import parameter
import datetime
class MassFlow(i2cAdafruitConnection.I2cAdafruitConnection, observe.Observer):
dataStr = "'NaN'"
headerStr = "'Gas Mass Flow [kg/h]'"
def __init__(self, observable):
# rs232Connection.Rs232... | [
"connections.i2cAdafruitConnection.I2cAdafruitConnection.__init__",
"datetime.datetime.now",
"observer.observe.Observer.__init__"
] | [((397, 455), 'connections.i2cAdafruitConnection.I2cAdafruitConnection.__init__', 'i2cAdafruitConnection.I2cAdafruitConnection.__init__', (['self'], {}), '(self)\n', (449, 455), False, 'from connections import i2cAdafruitConnection\n'), ((464, 507), 'observer.observe.Observer.__init__', 'observe.Observer.__init__', (['... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
import sys, os
from soma import aims, aimsalgo
import numpy
import optparse
parser = optparse.OptionParser( description='Voronoi diagram of the sulci ' \
'nodes regions, in the grey matter, an... | [
"soma.aims.write",
"soma.aims.FastMarching",
"optparse.OptionParser",
"numpy.array",
"soma.aims.RawConverter_BucketMap_VOID_rc_ptr_Volume_S16",
"soma.aims.read"
] | [((211, 357), 'optparse.OptionParser', 'optparse.OptionParser', ([], {'description': '"""Voronoi diagram of the sulci nodes regions, in the grey matter, and extending to the whole 3D space"""'}), "(description=\n 'Voronoi diagram of the sulci nodes regions, in the grey matter, and extending to the whole 3D space'\n ... |
"""
这个是用来测试,以redis为中间件,随意关闭代码会不会造成任务丢失的。
"""
import time
from funboost import boost,BrokerEnum
@boost('test_cost_long_time_fun_queue2', broker_kind=BrokerEnum.REDIS_ACK_ABLE, concurrent_num=5)
def cost_long_time_fun(x):
print(f'正在消费 {x} 中 。。。。')
time.sleep(3)
print(f'消费完成 {x} ')
if __name__ == '__main__'... | [
"funboost.boost",
"time.sleep"
] | [((98, 199), 'funboost.boost', 'boost', (['"""test_cost_long_time_fun_queue2"""'], {'broker_kind': 'BrokerEnum.REDIS_ACK_ABLE', 'concurrent_num': '(5)'}), "('test_cost_long_time_fun_queue2', broker_kind=BrokerEnum.\n REDIS_ACK_ABLE, concurrent_num=5)\n", (103, 199), False, 'from funboost import boost, BrokerEnum\n')... |
# coding: utf-8
from __future__ import division, print_function, unicode_literals, absolute_import
import os
import unittest
from fireworks.utilities.fw_serializers import load_object
from atomate.vasp.firetasks.write_inputs import WriteVaspFromIOSet, WriteVaspFromPMGObjects, \
ModifyPotcar, ModifyIncar
fro... | [
"pymatgen.util.testing.PymatgenTest.get_structure",
"pymatgen.io.vasp.Potcar",
"atomate.vasp.firetasks.write_inputs.ModifyIncar",
"os.path.join",
"pymatgen.io.vasp.Poscar.from_file",
"atomate.vasp.firetasks.write_inputs.ModifyPotcar",
"pymatgen.io.vasp.sets.MPRelaxSet",
"atomate.vasp.firetasks.write_i... | [((6026, 6041), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6039, 6041), False, 'import unittest\n'), ((621, 646), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (636, 646), False, 'import os\n'), ((751, 783), 'pymatgen.util.testing.PymatgenTest.get_structure', 'PymatgenTest.get_stru... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def edc_t(path):
"""EPICA Dome C Ice Core 800KYr Temperature Estimates
... | [
"observations.util.maybe_download_and_extract",
"os.path.join",
"os.path.expanduser"
] | [((1196, 1220), 'os.path.expanduser', 'os.path.expanduser', (['path'], {}), '(path)\n', (1214, 1220), False, 'import os\n'), ((1360, 1439), 'observations.util.maybe_download_and_extract', 'maybe_download_and_extract', (['path', 'url'], {'save_file_name': '"""edc_t.csv"""', 'resume': '(False)'}), "(path, url, save_file_... |
import datetime,pymysql
db=pymysql.connect("localhost", "flowerbot", "mycroft", "sensordata")
curs=db.cursor()
from arduinodata import getCurrentSensorData
sensordata = getCurrentSensorData()
select_stmt = "SELECT moisture,last_watered FROM history ORDER BY date DESC"
with db:
curs.execute(select_stmt)
moistu... | [
"datetime.datetime.now",
"pymysql.connect",
"arduinodata.getCurrentSensorData"
] | [((28, 94), 'pymysql.connect', 'pymysql.connect', (['"""localhost"""', '"""flowerbot"""', '"""mycroft"""', '"""sensordata"""'], {}), "('localhost', 'flowerbot', 'mycroft', 'sensordata')\n", (43, 94), False, 'import datetime, pymysql\n'), ((172, 194), 'arduinodata.getCurrentSensorData', 'getCurrentSensorData', ([], {}),... |
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from config import Config
def cuda_(var):
return var.cuda() if Config.use_gpu else var
class Net(nn.Module):
def __init__(self, state_dim, num_actions):
super(Net, self).__init__()
self.linear1 = nn... | [
"torch.nn.functional.log_softmax",
"torch.nn.Linear"
] | [((318, 342), 'torch.nn.Linear', 'nn.Linear', (['state_dim', '(20)'], {}), '(state_dim, 20)\n', (327, 342), True, 'import torch.nn as nn\n'), ((366, 392), 'torch.nn.Linear', 'nn.Linear', (['(20)', 'num_actions'], {}), '(20, num_actions)\n', (375, 392), True, 'import torch.nn as nn\n'), ((995, 1018), 'torch.nn.functiona... |
from flask import Flask, request
from tgmsg import TelegramClient, messages
app = Flask(__name__)
client = TelegramClient('<YOUR_TOKEN>')
@client.register_message_processor()
def text_handler(incoming):
msg = messages.TextMessage(incoming.message.text)
client.send_message(msg, incoming.message.chat.id)
@ap... | [
"tgmsg.messages.TextMessage",
"tgmsg.TelegramClient",
"flask.Flask"
] | [((83, 98), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (88, 98), False, 'from flask import Flask, request\n'), ((108, 138), 'tgmsg.TelegramClient', 'TelegramClient', (['"""<YOUR_TOKEN>"""'], {}), "('<YOUR_TOKEN>')\n", (122, 138), False, 'from tgmsg import TelegramClient, messages\n'), ((216, 259), 'tgm... |
#!/usr/bin/env python3
import numpy as np
import copy
import itertools
import sys
import ete3
import numpy as np
from Bio import AlignIO
# import CIAlign.cropSeq as cropSeq
# from AlignmentStats import find_removed_cialign
def writeOutfile(outfile, arr, nams, rmfile=None):
'''
Writes an alignment stored in ... | [
"numpy.char.upper",
"numpy.where",
"numpy.append",
"numpy.array",
"numpy.sum",
"numpy.vstack",
"copy.copy"
] | [((7324, 7342), 'numpy.char.upper', 'np.char.upper', (['arr'], {}), '(arr)\n', (7337, 7342), True, 'import numpy as np\n'), ((2403, 2421), 'numpy.array', 'np.array', (['seqs[1:]'], {}), '(seqs[1:])\n', (2411, 2421), True, 'import numpy as np\n'), ((5606, 5621), 'copy.copy', 'copy.copy', (['nams'], {}), '(nams)\n', (561... |
import click
from vlc_helper import vlcstart_precise
@click.command()
@click.argument('filename', nargs=1, default='')
@click.argument('starttime', nargs=1, default='')
@click.argument('stoptime', nargs=1, default='')
def main(filename, starttime, stoptime):
"""Start filename at specific start time (and/or end at... | [
"click.argument",
"click.command",
"vlc_helper.vlcstart_precise"
] | [((56, 71), 'click.command', 'click.command', ([], {}), '()\n', (69, 71), False, 'import click\n'), ((73, 120), 'click.argument', 'click.argument', (['"""filename"""'], {'nargs': '(1)', 'default': '""""""'}), "('filename', nargs=1, default='')\n", (87, 120), False, 'import click\n'), ((122, 170), 'click.argument', 'cli... |
# -*- coding: utf-8 -*-
#
# Author: <NAME>
# Project: crawler 1.0
# Date: 2021-07-10
#
import unittest
from pkg.util.parser_cve_json import is_cve_json_filename
from pkg.util.parser_cve_json import extract_cveid
from pkg.util.parser_cve_json import splitcveid
class IsCveJsonFilenameTestCase(unittest.... | [
"pkg.util.parser_cve_json.splitcveid",
"pkg.util.parser_cve_json.extract_cveid",
"pkg.util.parser_cve_json.is_cve_json_filename"
] | [((484, 522), 'pkg.util.parser_cve_json.is_cve_json_filename', 'is_cve_json_filename', (['"""CVE-2021-28809"""'], {}), "('CVE-2021-28809')\n", (504, 522), False, 'from pkg.util.parser_cve_json import is_cve_json_filename\n'), ((600, 637), 'pkg.util.parser_cve_json.is_cve_json_filename', 'is_cve_json_filename', (['"""CV... |
import matplotlib
import numpy as np
import pandas as pd
from funcoes.dados import mse
from PyQt5.QtCore import QObject, QAbstractTableModel, Qt
from PyQt5.QtWidgets import QTableView
class ctrl_func(mse):
fs: float = 2
def __init__(self, views):
super().__init__()
self._views = views
d... | [
"PyQt5.QtCore.QAbstractTableModel.__init__",
"PyQt5.QtWidgets.QTableView",
"pandas.set_option"
] | [((403, 452), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', 'self.sondagens'], {}), "('display.max_rows', self.sondagens)\n", (416, 452), True, 'import pandas as pd\n'), ((1798, 1810), 'PyQt5.QtWidgets.QTableView', 'QTableView', ([], {}), '()\n', (1808, 1810), False, 'from PyQt5.QtWidgets import QTa... |
import unittest
import pathlib
import shutil
import pytest
import torch
from transformers import PretrainedConfig
from sgnlp.models.nea import (
NEAConfig,
NEARegPoolingModel,
NEARegModel,
NEABiRegModel,
NEABiRegPoolingModel,
NEATokenizer,
)
PARENT_DIR = pathlib.Path(__file__).parent
class... | [
"pathlib.Path",
"torch.Tensor",
"torch.tensor",
"sgnlp.models.nea.NEATokenizer",
"shutil.rmtree",
"torch.Size",
"torch.ones"
] | [((283, 305), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (295, 305), False, 'import pathlib\n'), ((6045, 6084), 'torch.Tensor', 'torch.Tensor', (['[0.1, 0.2, 0.3, 0.4, 0.5]'], {}), '([0.1, 0.2, 0.3, 0.4, 0.5])\n', (6057, 6084), False, 'import torch\n'), ((6144, 6166), 'torch.ones', 'torch.ones'... |
'''
Created on Jan 26, 2011
This module is a local copy of python locale in order to allow
passing in localconv as an argument to functions without affecting
system-wide settings. (The system settings can remain in 'C' locale.)
@author: Mark V Systems Limited (incorporating python locale module code)
(original pytho... | [
"re.compile",
"locale.partition",
"unicodedata.bidirectional",
"decimal.Decimal.from_float",
"locale.getdefaultlocale",
"locale.localeconv",
"decimal.Decimal",
"subprocess.getstatusoutput"
] | [((13519, 13616), 're.compile', 're.compile', (['"""%(?:\\\\((?P<key>.*?)\\\\))?(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]"""'], {}), "(\n '%(?:\\\\((?P<key>.*?)\\\\))?(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]'\n )\n", (13529, 13616), False, 'import re\n'), ((1099, 1157), 'subprocess.getstatusoutpu... |
from wtforms import StringField
from flask_babel import lazy_gettext
from wtforms.validators import DataRequired
from flask_appbuilder.fieldwidgets import BS3TextFieldWidget
from flask_appbuilder.forms import DynamicForm
class TestForm(DynamicForm):
TestFieldOne = StringField(lazy_gettext('Test Field One'), valid... | [
"flask_babel.lazy_gettext",
"flask_appbuilder.fieldwidgets.BS3TextFieldWidget",
"wtforms.validators.DataRequired"
] | [((283, 313), 'flask_babel.lazy_gettext', 'lazy_gettext', (['"""Test Field One"""'], {}), "('Test Field One')\n", (295, 313), False, 'from flask_babel import lazy_gettext\n'), ((404, 434), 'flask_babel.lazy_gettext', 'lazy_gettext', (['"""Test Field One"""'], {}), "('Test Field One')\n", (416, 434), False, 'from flask_... |
"""
Contacts between nucleotides in a tetracycline aptamer
======================================================
This example reproduces a figure from the publication
*"StreAM-Tg: algorithms for analyzing coarse grained RNA dynamics based
on Markov models of connectivity-graphs"* [1]_.
The figure displays a coarse g... | [
"ammolite.PyMOLObject.from_structure",
"biotite.database.rcsb.fetch",
"numpy.where",
"biotite.structure.io.mmtf.get_structure",
"numpy.stack",
"biotite.structure.CellList",
"ammolite.show",
"biotite.structure.filter_nucleotides",
"ammolite.cmd.set",
"ammolite.cmd.rotate",
"ammolite.cmd.bg_color"... | [((998, 1036), 'biotite.structure.io.mmtf.get_structure', 'mmtf.get_structure', (['mmtf_file'], {'model': '(1)'}), '(mmtf_file, model=1)\n', (1016, 1036), True, 'import biotite.structure.io.mmtf as mmtf\n'), ((1409, 1453), 'ammolite.PyMOLObject.from_structure', 'ammolite.PyMOLObject.from_structure', (['aptamer'], {}), ... |
"""Convert XFL edges to SVG paths.
If you just want to convert, use `xfl_edge_to_svg_path()`. If you're interested
in how everything works, read on.
"""
# Read these links first, as there is no official documentation for the XFL
# edge format:
#
# * https://github.com/SasQ/SavageFlask/blob/master/doc/FLA.txt
# * ... | [
"xml.etree.ElementTree.Element",
"collections.defaultdict",
"re.compile"
] | [((3085, 3274), 're.compile', 're.compile', (['"""\n[!|/[\\\\]] | # Move to, line to, quad to\n(?<!S)-?\\\\d+(?:\\\\.\\\\d+)? | # Decimal number\n\\\\#[A-Z0-9]+\\\\.[A-Z0-9]+ # Hex number\n"""', 're.VERBOSE'], {}), '(\n """\n[!|/[\\\\]] | # Move to, line to, quad to\n(?<!S)... |
import torch
import torch.nn.utils
import torch.cuda.amp as amp
import torchvision.ops as cv_ops
import utils.bbox_ops as bbox_ops
def train_one_epoch(model, optimizer, criterion, lr_scheduler, data_loader, dist_logger, epoch_idx):
losses, cls_losses, bbox_losses, centerness_losses = [], [], [], []
model.tr... | [
"torch.cuda.amp.GradScaler",
"torchvision.ops.clip_boxes_to_image",
"torchvision.ops.box_convert",
"torch.cuda.amp.autocast",
"utils.bbox_ops.convert_distance_to_bbox",
"torch.no_grad",
"utils.bbox_ops.recover_bboxes",
"torchvision.ops.batched_nms"
] | [((2300, 2315), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2313, 2315), False, 'import torch\n'), ((339, 355), 'torch.cuda.amp.GradScaler', 'amp.GradScaler', ([], {}), '()\n', (353, 355), True, 'import torch.cuda.amp as amp\n'), ((3039, 3095), 'utils.bbox_ops.convert_distance_to_bbox', 'bbox_ops.convert_dista... |
from unobase.support import models
__author__ = 'michael'
from django.contrib import admin
admin.site.register(models.Case)
admin.site.register(models.FrequentlyAskedQuestion) | [
"django.contrib.admin.site.register"
] | [((98, 130), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Case'], {}), '(models.Case)\n', (117, 130), False, 'from django.contrib import admin\n'), ((131, 182), 'django.contrib.admin.site.register', 'admin.site.register', (['models.FrequentlyAskedQuestion'], {}), '(models.FrequentlyAskedQuesti... |
import re
from svgParsing.formatted_text import merge_pages, svg_to_text, FormattedText
from svgParsing.table_names import tables_to_remove
# A function to parse the rules from SVG files (one per page).
def generate_srd_articles():
''' Parse the svg files created from the SRD, into a dictionary of
articles. ... | [
"svgParsing.formatted_text.FormattedText",
"re.match",
"svgParsing.formatted_text.merge_pages"
] | [((743, 784), 'svgParsing.formatted_text.merge_pages', 'merge_pages', (['merged_content', 'current_page'], {}), '(merged_content, current_page)\n', (754, 784), False, 'from svgParsing.formatted_text import merge_pages, svg_to_text, FormattedText\n'), ((2539, 2571), 're.match', 're.match', (['rule[0]', 'formText.text'],... |
#!/usr/bin/python3
from pysimplesoap.client import SoapClient
# Install the above dependency with "pip install pysimplesoap"
location = 'http://fritz.box:49000/igdupnp/control/WANCommonIFC1'
namespace = 'urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1'
action = 'urn:schemas-upnp-org:service:WANCommonInterface... | [
"pysimplesoap.client.SoapClient"
] | [((400, 452), 'pysimplesoap.client.SoapClient', 'SoapClient', (['location', 'action', 'namespace'], {'trace': 'debug'}), '(location, action, namespace, trace=debug)\n', (410, 452), False, 'from pysimplesoap.client import SoapClient\n')] |
#!/usr/bin/env python
"""
Hackerrank Solution
-
<NAME>
<@natebwangsut | <EMAIL>>
"""
__author__ = "<NAME>"
__credits__ = ["<NAME>sutthitham"]
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
import itertools
line = input()
line = input().split()
repeat = int(input())
com = ... | [
"itertools.combinations"
] | [((325, 361), 'itertools.combinations', 'itertools.combinations', (['line', 'repeat'], {}), '(line, repeat)\n', (347, 361), False, 'import itertools\n')] |
import json
import aiohttp
from AsyncWebsocketStreamInterface import AsyncWebsocketStreamInterface
import websockets
from loguru import logger
class BinanceFapiAsyncWs(AsyncWebsocketStreamInterface):
ws_baseurl = 'wss://fstream.binance.com'
restful_baseurl = 'https://fapi.binance.com'
def __init__(self,... | [
"aiohttp.ClientSession",
"json.loads",
"loguru.logger.debug",
"loguru.logger.info",
"asyncio.sleep",
"asyncio.get_event_loop"
] | [((3311, 3335), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (3333, 3335), False, 'import asyncio\n'), ((2596, 2641), 'loguru.logger.debug', 'logger.debug', (['"""Time to update ws connection."""'], {}), "('Time to update ws connection.')\n", (2608, 2641), False, 'from loguru import logger\n'),... |