code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
Use cases related to writing data to an output repository.
"""
import logging
import warnings
from pathlib import Path
from typing import List
from openpyxl import load_workbook
from engine.repository.datamap import InMemorySingleDatamapRepository
from engine.use_cases.parsing import ParseDatamapUseCase
from eng... | [
"logging.basicConfig",
"logging.getLogger",
"openpyxl.load_workbook",
"engine.use_cases.parsing.ParseDatamapUseCase",
"engine.use_cases.typing.ColData",
"warnings.filterwarnings"
] | [((418, 481), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""', '""".*Conditional Formatting*."""'], {}), "('ignore', '.*Conditional Formatting*.')\n", (441, 481), False, 'import warnings\n'), ((482, 538), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""', '""".*Sparkline Grou... |
from setuptools import setup
if __name__ == '__main__':
setup(
package_data={'ml_pipeline':
[ 'Templates/*.ipynb', 'Templates/*.xlsx' ]
}
) | [
"setuptools.setup"
] | [((61, 139), 'setuptools.setup', 'setup', ([], {'package_data': "{'ml_pipeline': ['Templates/*.ipynb', 'Templates/*.xlsx']}"}), "(package_data={'ml_pipeline': ['Templates/*.ipynb', 'Templates/*.xlsx']})\n", (66, 139), False, 'from setuptools import setup\n')] |
from unittest import TestCase
from testfixtures import should_raise
from rec_to_nwb.processing.exceptions.corrupted_data_exception import CorruptedDataException
from rec_to_nwb.processing.metadata.corrupted_data_manager import CorruptedDataManager
class TestCorruptedDataManager(TestCase):
def test_corrupted_da... | [
"rec_to_nwb.processing.metadata.corrupted_data_manager.CorruptedDataManager",
"testfixtures.should_raise"
] | [((2662, 2685), 'testfixtures.should_raise', 'should_raise', (['TypeError'], {}), '(TypeError)\n', (2674, 2685), False, 'from testfixtures import should_raise\n'), ((2845, 2868), 'testfixtures.should_raise', 'should_raise', (['TypeError'], {}), '(TypeError)\n', (2857, 2868), False, 'from testfixtures import should_rais... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.conv import _ConvNd
class Conv(_ConvNd):
def __init__(self, in_channels, out_channels, kernel_size, stride=(1, 1),
padding=(0, 0), dilation=(1, 1), groups=1, bias=True, active_function="LeakyReLU"):
#... | [
"torch.nn.Sigmoid",
"torch.nn.ReLU",
"torch.nn.BatchNorm2d",
"torch.nn.Tanh",
"torch.nn.LeakyReLU",
"torch.nn.Conv2d",
"torch.sum",
"torch.nn.functional.max_pool2d",
"torch.nn.ConvTranspose2d",
"torch.cat"
] | [((2492, 2571), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(1, 1)', 'stride': 'stride', 'bias': '(False)'}), '(in_planes, out_planes, kernel_size=(1, 1), stride=stride, bias=False)\n', (2501, 2571), True, 'import torch.nn as nn\n'), ((590, 680), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_... |
from typing import Any, TypeVar
TItem = TypeVar("TItem")
def get_task_name(value: Any, explicit_name: str = None) -> str:
# inline import to ensure `_utils` is always importable from the rest of
# the module.
from .abc import ManagerAPI, ServiceAPI # noqa: F401
if explicit_name is not None:
... | [
"typing.TypeVar"
] | [((41, 57), 'typing.TypeVar', 'TypeVar', (['"""TItem"""'], {}), "('TItem')\n", (48, 57), False, 'from typing import Any, TypeVar\n')] |
import pandas as pd
import numpy as np
import pytest
from nltk.metrics.distance import masi_distance
from pandas.testing import assert_series_equal
from crowdkit.aggregation.utils import get_accuracy
from crowdkit.metrics.data import alpha_krippendorff, consistency, uncertainty
from crowdkit.metrics.performers import ... | [
"pandas.Series",
"pandas.DataFrame.from_records",
"numpy.unique",
"crowdkit.aggregation.utils.get_accuracy",
"numpy.testing.assert_allclose",
"crowdkit.metrics.data.alpha_krippendorff",
"crowdkit.metrics.performers.accuracy_on_aggregates",
"pandas.Index",
"crowdkit.metrics.data.consistency",
"pyte... | [((394, 421), 'crowdkit.metrics.data.consistency', 'consistency', (['toy_answers_df'], {}), '(toy_answers_df)\n', (405, 421), False, 'from crowdkit.metrics.data import alpha_krippendorff, consistency, uncertainty\n'), ((4908, 4993), 'crowdkit.metrics.data.uncertainty', 'uncertainty', (['answers', 'performers_skills'], ... |
import pandas as pd
def correct_lr(data):
'''
Invert the RL to LR and R1R2 to r2>r1
'''
import pandas as pd
def swap(a,b): return b,a
data = data.to_dict('index')
for k,v in data.items():
if v['isReceptor_fst'] and v['isReceptor_scn']:
v['isReceptor_fst'],v['isReceptor_s... | [
"os.chdir",
"pandas.DataFrame.from_dict",
"pandas.read_csv"
] | [((2026, 2070), 'os.chdir', 'os.chdir', (['"""/home/nagai/Documents/sarscov/LR"""'], {}), "('/home/nagai/Documents/sarscov/LR')\n", (2034, 2070), False, 'import os\n'), ((2076, 2137), 'pandas.read_csv', 'pd.read_csv', (['"""./CTR_filtered/significant_means.txt"""'], {'sep': '"""\t"""'}), "('./CTR_filtered/significant_m... |
import albumentations
from albumentations.pytorch import ToTensorV2
import cv2
import numpy as np
def crop_image_from_gray(img, tol=7):
if img.ndim == 2:
mask = img > tol
return img[np.ix_(mask.any(1), mask.any(0))]
elif img.ndim == 3:
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
... | [
"albumentations.pytorch.ToTensorV2",
"albumentations.MedianBlur",
"albumentations.RandomBrightnessContrast",
"albumentations.Cutout",
"albumentations.VerticalFlip",
"albumentations.IAAAdditiveGaussianNoise",
"albumentations.HueSaturationValue",
"numpy.stack",
"albumentations.Normalize",
"albumenta... | [((280, 317), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (292, 317), False, 'import cv2\n'), ((1166, 1211), 'albumentations.Resize', 'albumentations.Resize', (['image_size', 'image_size'], {}), '(image_size, image_size)\n', (1187, 1211), False, 'import albumentat... |
"""
Short corridor with switched actions (Example 13.1) of Sutton and Barto's
"Reinforcement learning"
"""
import numpy as np
class ShortCorridor():
"""Short corridor with switched actions"""
def __init__(self):
self.num_states = 4
self.states = self.state_space()
self.a... | [
"numpy.array"
] | [((1538, 1555), 'numpy.array', 'np.array', (['[-1, 1]'], {}), '([-1, 1])\n', (1546, 1555), True, 'import numpy as np\n'), ((2172, 2188), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1])\n', (2180, 2188), True, 'import numpy as np\n'), ((2234, 2250), 'numpy.array', 'np.array', (['[1, 0]'], {}), '([1, 0])\n', (2242... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------
# Copyright (c) 2010-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 ... | [
"ea.servercontrols.RestTesterFunctions.AgentsDisconnect",
"ea.servercontrols.RestTesterFunctions.ResultsReports",
"ea.servercontrols.RestTesterFunctions.AdaptersDirectoryRename",
"ea.servercontrols.RestTesterFunctions.ResultsDownloadResultUncomplete",
"ea.servercontrols.RestTesterFunctions.TestsDirectoryRem... | [((2572, 2593), 'logging.Logger', 'logging.Logger', (['"""LOG"""'], {}), "('LOG')\n", (2586, 2593), False, 'import logging\n'), ((2643, 2676), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (2664, 2676), False, 'import logging\n'), ((13628, 13659), 'threading.Thread.__init__',... |
# Generated by Django 3.0.7 on 2020-06-23 03:04
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Events',
fields=[
... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ImageField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((335, 428), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (351, 428), False, 'from django.db import migrations, models\... |
"""Command to assist with reporting DeviantArt users for spam."""
from itertools import combinations
import cli_ui
import daeclipse
def spammer(
username: str,
):
"""Return information and output for spam report helpdesk ticket creation.
Args:
username (str): DeviantArt username to query.
... | [
"itertools.combinations",
"daeclipse.Eclipse"
] | [((338, 357), 'daeclipse.Eclipse', 'daeclipse.Eclipse', ([], {}), '()\n', (355, 357), False, 'import daeclipse\n'), ((5934, 5963), 'itertools.combinations', 'combinations', (['full_strings', '(2)'], {}), '(full_strings, 2)\n', (5946, 5963), False, 'from itertools import combinations\n')] |
# 6. Лица на фигури
# Да се напише програма, в която потребителят въвежда вида и размерите на геометрична фигура и пресмята лицето й.
# Фигурите са четири вида: квадрат (square), правоъгълник (rectangle), кръг (circle) и триъгълник (triangle).
# На първия ред на входа се чете вида на фигурата (square, rectangle, circle... | [
"math.pow"
] | [((892, 906), 'math.pow', 'math.pow', (['a', '(2)'], {}), '(a, 2)\n', (900, 906), False, 'import math\n')] |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | [
"numpy.random.rand",
"jax.nn.log_softmax",
"numpy.log",
"language.mentionmemory.utils.metric_utils.compute_cross_entropy_loss_with_positives_and_negatives_masks",
"numpy.array",
"numpy.random.random",
"jax.numpy.asarray",
"numpy.random.seed",
"language.mentionmemory.utils.metric_utils.compute_loss_a... | [((5319, 5683), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['(0, 1, 29, 31, 31)', '(1, 1000000, 29, 31)', '(2, 1000000, 29, 31)', '(3, 100, 29, 1001)', '(4, 100, 323, 31)', '(5, 1, 29, 31, 1, 31)', '(6, 1, 29, 31, 0, 31)', '(7, 1, 29, 31, 31, 1)', '(8, 1, 29, 31, 31, 0)', '(9, 1, 29, 31, 1, 1... |
from plenum.common.constants import DOMAIN_LEDGER_ID
from plenum.common.messages.node_messages import Checkpoint
from plenum.test.helper import \
send_signed_requests, \
waitForSufficientRepliesForRequests, \
random_requests
def set_checkpoint_faking(replica):
old = replica.send
def send(msg, sta... | [
"plenum.test.helper.send_signed_requests",
"plenum.test.helper.random_requests",
"plenum.test.helper.waitForSufficientRepliesForRequests"
] | [((1499, 1539), 'plenum.test.helper.send_signed_requests', 'send_signed_requests', (['client1', '[request]'], {}), '(client1, [request])\n', (1519, 1539), False, 'from plenum.test.helper import send_signed_requests, waitForSufficientRepliesForRequests, random_requests\n'), ((1548, 1620), 'plenum.test.helper.waitForSuff... |
#
# Copyright 2021 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | [
"contextlib.suppress",
"os.getenv",
"dotenv.load_dotenv"
] | [((756, 788), 'os.getenv', 'os.getenv', (['"""MONGO_DB"""', '"""sc4snmp"""'], {}), "('MONGO_DB', 'sc4snmp')\n", (765, 788), False, 'import os\n'), ((810, 854), 'os.getenv', 'os.getenv', (['"""MONGO_DB_SCHEDULES"""', '"""schedules"""'], {}), "('MONGO_DB_SCHEDULES', 'schedules')\n", (819, 854), False, 'import os\n'), ((8... |
#!/usr/bin/env python
from cffi import FFI
ffi = FFI()
ffi.cdef("""
#define CLONE_FS ...
#define CLONE_NEWNS ...
#define CLONE_NEWUTS ...
#define CLONE_NEWIPC ...
#define CLONE_NEWUSER ...
#define CLONE_NEWPID ...
#define CLONE_NEWNET ...
//#long __clone(unsigned long flags, void *child_stack, ...);
lon... | [
"cffi.FFI"
] | [((51, 56), 'cffi.FFI', 'FFI', ([], {}), '()\n', (54, 56), False, 'from cffi import FFI\n')] |
from collections import defaultdict, deque
from collections import namedtuple
from functools import cmp_to_key
import itertools
import copy
import re
file_name = "Input1.txt"
'''
with open(file_name, "r") as fp:
lines = fp.readlines()
lines = [x.strip() for x in lines]
line = lines[0].strip()
toks = line.split("... | [
"collections.deque"
] | [((607, 614), 'collections.deque', 'deque', ([], {}), '()\n', (612, 614), False, 'from collections import defaultdict, deque\n'), ((750, 757), 'collections.deque', 'deque', ([], {}), '()\n', (755, 757), False, 'from collections import defaultdict, deque\n')] |
import requests
login_url = "http://shop2.q.2019.volgactf.ru/loginProcess"
target_url = "http://shop2.q.2019.volgactf.ru/profile"
payload0 = {'name': 'wani', 'pass': '<PASSWORD>'}
payload1 = {'name': 'wani', 'CartItems[0].id': 4}
s = requests.Session()
r = s.post(login_url, data=payload0)
r = s.post(target_url, data... | [
"requests.Session"
] | [((237, 255), 'requests.Session', 'requests.Session', ([], {}), '()\n', (253, 255), False, 'import requests\n')] |
from django.db import models
from django.contrib.auth.models import User
import datetime
# Create your models here.
class Time_option(models.Model):
timee = models.CharField(max_length = 10)
def __str__(self):
return self.timee
class Fields(models.Model):
name = models.CharField(max_length = ... | [
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"datetime.datetime.now",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((162, 193), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)'}), '(max_length=10)\n', (178, 193), False, 'from django.db import models\n'), ((290, 322), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (306, 322), False, 'from django.db ... |
"""
Multi object tracking results and ground truth
- conversion,
- evaluation,
- visualization.
For more help run this file as a script with --help parameter.
PyCharm debugger could have problems debugging inside this module due to a bug:
https://stackoverflow.com/questions/47988936/debug-properly-with-pycharm-modul... | [
"motmetrics.io.render_summary",
"numpy.sqrt",
"pandas.read_csv",
"pandas.DataFrame",
"motmetrics.utils.compare_to_groundtruth",
"tqdm.tqdm",
"h5py.File",
"motmetrics.metrics.create",
"numpy.concatenate",
"numpy.moveaxis",
"warnings.warn",
"numpy.load",
"pandas.concat",
"numpy.arange",
"s... | [((836, 876), 'pandas.read_csv', 'pd.read_csv', (['filename_or_buffer'], {'nrows': '(2)'}), '(filename_or_buffer, nrows=2)\n', (847, 876), True, 'import pandas as pd\n'), ((2010, 2064), 'pandas.read_csv', 'pd.read_csv', (['filename_or_buffer'], {'delim_whitespace': '(True)'}), '(filename_or_buffer, delim_whitespace=Tru... |
#!/usr/bin/env python
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow_spell import SpellRunOperator
default_args = {
"depends_on_past": False,
"start_date": datetime(2019, 10, 13),
"retries": 1,
"retry_delay": time... | [
"datetime.datetime",
"airflow_spell.SpellRunOperator",
"airflow.operators.bash_operator.BashOperator",
"airflow.DAG",
"datetime.timedelta"
] | [((255, 277), 'datetime.datetime', 'datetime', (['(2019)', '(10)', '(13)'], {}), '(2019, 10, 13)\n', (263, 277), False, 'from datetime import datetime, timedelta\n'), ((316, 337), 'datetime.timedelta', 'timedelta', ([], {'minutes': '(10)'}), '(minutes=10)\n', (325, 337), False, 'from datetime import datetime, timedelta... |
from neural_transer import style_transfer
cnt_image = 'img/neckarfront.jpg'
style_image = 'img/starry_night.jpg'
output = 'test/'
epochs = 600
save_per_epoch = 40
style_transfer(cnt_image, style_image, output, epochs, save_per_epoch, random_canvas=True)
| [
"neural_transer.style_transfer"
] | [((165, 259), 'neural_transer.style_transfer', 'style_transfer', (['cnt_image', 'style_image', 'output', 'epochs', 'save_per_epoch'], {'random_canvas': '(True)'}), '(cnt_image, style_image, output, epochs, save_per_epoch,\n random_canvas=True)\n', (179, 259), False, 'from neural_transer import style_transfer\n')] |
import numpy as np
class Poblacion:
"""Posibles soluciones del óptimo de una función.
Esta clase crea posibles soluciones para una función a optimizar. Toma la dimensión
del espacio, los límites de búsqueda y el número de elementos a tomar en cuenta.
Attributes:
dimension: Un entero que dete... | [
"numpy.clip",
"numpy.copy",
"numpy.zeros",
"numpy.random.uniform"
] | [((1557, 1624), 'numpy.random.uniform', 'np.random.uniform', (['*self.lim'], {'size': '(self.elementos, self.dimension)'}), '(*self.lim, size=(self.elementos, self.dimension))\n', (1574, 1624), True, 'import numpy as np\n'), ((3821, 3867), 'numpy.zeros', 'np.zeros', (['(self.elementos, self.dimension + 1)'], {}), '((se... |
"""
API check for whether the current session's interactive environment launch is ready
"""
from subprocess import Popen, PIPE
from galaxy.web import expose, json
from galaxy.web.base.controller import BaseUIController
import logging
log = logging.getLogger(__name__)
class InteractiveEnvironmentsController(BaseUICo... | [
"logging.getLogger",
"subprocess.Popen"
] | [((242, 269), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (259, 269), False, 'import logging\n'), ((1385, 1453), 'subprocess.Popen', 'Popen', (['command'], {'stdout': 'PIPE', 'stderr': 'PIPE', 'close_fds': '(True)', 'shell': '(True)'}), '(command, stdout=PIPE, stderr=PIPE, close_fds=Tr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sublime_plugin
import sublime
import sys
import subprocess
import json
PY2 = sys.version_info < (3, 0)
if not PY2: basestring = str
helper = None
mozc_mode_line = ""
mozc_input_mode_line = ""
mozc_highlight_style = ""
mozc_use... | [
"sublime.windows",
"sublime.active_window",
"sublime.version",
"json.dumps",
"sublime.Region",
"sublime.load_settings"
] | [((1932, 1949), 'sublime.windows', 'sublime.windows', ([], {}), '()\n', (1947, 1949), False, 'import sublime\n'), ((618, 669), 'sublime.load_settings', 'sublime.load_settings', (['"""MozcInput.sublime-settings"""'], {}), "('MozcInput.sublime-settings')\n", (639, 669), False, 'import sublime\n'), ((1670, 1687), 'sublime... |
# Copyright (c) 2021-present, Facebook, Inc.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import bisk
from bisk.features.joints import JointsFeaturizer
from bisk.single_robot import BiskSingleRobotEnv
def test... | [
"bisk.single_robot.BiskSingleRobotEnv",
"bisk.features.joints.JointsFeaturizer"
] | [((347, 375), 'bisk.single_robot.BiskSingleRobotEnv', 'BiskSingleRobotEnv', (['"""walker"""'], {}), "('walker')\n", (365, 375), False, 'from bisk.single_robot import BiskSingleRobotEnv\n'), ((387, 429), 'bisk.features.joints.JointsFeaturizer', 'JointsFeaturizer', (['env.p', '"""walker"""', '"""robot"""'], {}), "(env.p,... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest
import frappe
from frappe.test_runner import make_test_records
from frappe.utils import random_string
class TestAutoAssign(unittest.TestCase):
def setUp(self)... | [
"frappe.test_runner.make_test_records",
"frappe.utils.random_string",
"frappe.custom.doctype.custom_field.custom_field.create_custom_field",
"frappe.set_user",
"frappe.utils.nowdate",
"frappe.db.sql",
"frappe.get_doc",
"frappe.utils.add_days",
"frappe.delete_doc_if_exists",
"frappe.utils.get_date_... | [((7487, 7553), 'frappe.db.sql', 'frappe.db.sql', (['"""delete from tabToDo where reference_type = \'Note\'"""'], {}), '("delete from tabToDo where reference_type = \'Note\'")\n', (7500, 7553), False, 'import frappe\n'), ((7601, 7661), 'frappe.delete_doc_if_exists', 'frappe.delete_doc_if_exists', (['"""Assignment Rule"... |
"""
The Texas Gateway OAuth 2 backend.
"""
try:
from social.backends.oauth import BaseOAuth2
from social.exceptions import AuthException
except ImportError:
from social_core.backends.oauth import BaseOAuth2
from social_core.exceptions import AuthException
from urllib import urlencode
class TrinityOa... | [
"urllib.urlencode"
] | [((2038, 2079), 'urllib.urlencode', 'urlencode', (["{'access_token': access_token}"], {}), "({'access_token': access_token})\n", (2047, 2079), False, 'from urllib import urlencode\n')] |
"""
Will run "shellfoundry install" on all shell subdirectories of current folder
"""
import os
import subprocess
def install_shell(dir_name):
my_path = os.path.abspath(__file__)
mydir = os.path.dirname(my_path)
shell_dir_path = os.path.join(mydir, dir_name)
subprocess.call(["shellfoundry", "install"... | [
"os.listdir",
"os.path.join",
"os.path.dirname",
"os.path.isdir",
"subprocess.call",
"os.path.abspath"
] | [((160, 185), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (175, 185), False, 'import os\n'), ((198, 222), 'os.path.dirname', 'os.path.dirname', (['my_path'], {}), '(my_path)\n', (213, 222), False, 'import os\n'), ((244, 273), 'os.path.join', 'os.path.join', (['mydir', 'dir_name'], {}), '(m... |
# coding=utf-8
from __future__ import unicode_literals
from datetime import datetime, timedelta
from pub_site.constant import WithdrawState
from pub_site.withdraw import dba as withdraw_dba
from pub_site import pay_client
from pub_site.sms import sms
from tools.utils import to_bankcard_mask
def fetch_notify_withdraw... | [
"tools.utils.to_bankcard_mask",
"pub_site.withdraw.dba.get_requested_withdraw_record_before",
"datetime.datetime.utcnow",
"pub_site.withdraw.dba.update_withdraw_state",
"pub_site.pay_client.query_withdraw",
"pub_site.sms.sms.send",
"pub_site.pay_client.app_get_user_bankcard",
"datetime.timedelta"
] | [((348, 365), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (363, 365), False, 'from datetime import datetime, timedelta\n'), ((374, 400), 'datetime.timedelta', 'timedelta', ([], {'minutes': 'minutes'}), '(minutes=minutes)\n', (383, 400), False, 'from datetime import datetime, timedelta\n'), ((441, 4... |
"""A collection of simple bandit algorithms for comparison purposes."""
import math
from collections import defaultdict
from typing import Any, Dict, Tuple, Sequence, Optional, cast, Hashable
from coba.simulations import Context, Action
from coba.statistics import OnlineVariance
from coba.learners.core import Learne... | [
"collections.defaultdict",
"typing.cast"
] | [((2589, 2605), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (2600, 2605), False, 'from collections import defaultdict\n'), ((2657, 2673), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (2668, 2673), False, 'from collections import defaultdict\n'), ((4952, 5012), 'typing.cast... |
#!/usr/bin/env python3
import os
import json
import bitcoin
from bitcoin.wallet import P2PKHBitcoinAddress
from bitcoin.core import x
from bitcoin.core import CoreMainParams
from datetime import datetime, timezone
from os import listdir
from os.path import isfile, join
jsonfiles = [f for f in listdir('/var/www/html/js... | [
"datetime.datetime",
"os.path.exists",
"os.listdir",
"json.dumps",
"os.path.join",
"datetime.datetime.timestamp",
"json.load",
"os.path.getmtime",
"bitcoin.core.x"
] | [((2636, 2658), 'os.path.getmtime', 'os.path.getmtime', (['file'], {}), '(file)\n', (2652, 2658), False, 'import os\n'), ((4179, 4198), 'os.listdir', 'os.listdir', (['"""MAKER"""'], {}), "('MAKER')\n", (4189, 4198), False, 'import os\n'), ((295, 324), 'os.listdir', 'listdir', (['"""/var/www/html/json"""'], {}), "('/var... |
# -----------------------------------------------------------------------------
# Licence:
# Copyright (c) 2012-2018 <NAME> for Gecosistema S.r.l.
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WI... | [
"smtplib.SMTP_SSL",
"json.loads",
"email.mime.text.MIMEText"
] | [((1864, 1880), 'json.loads', 'json.loads', (['text'], {}), '(text)\n', (1874, 1880), False, 'import smtplib, json\n'), ((2209, 2231), 'email.mime.text.MIMEText', 'MIMEText', (['Body', '"""html"""'], {}), "(Body, 'html')\n", (2217, 2231), False, 'from email.mime.text import MIMEText\n'), ((2495, 2513), 'smtplib.SMTP_SS... |
import time
import cv2
import numpy as np
from chainer import serializers, Variable
import chainer.functions as F
import argparse
from darknet19 import *
from yolov2 import *
from yolov2_grid_prob import *
from yolov2_bbox import *
n_classes = 10
n_boxes = 5
partial_layer = 18
def copy_conv_layer(src, dst, layers):
... | [
"chainer.serializers.save_hdf5",
"chainer.serializers.load_hdf5"
] | [((1241, 1288), 'chainer.serializers.load_hdf5', 'serializers.load_hdf5', (['input_weight_file', 'model'], {}), '(input_weight_file, model)\n', (1262, 1288), False, 'from chainer import serializers, Variable\n'), ((1649, 1704), 'chainer.serializers.save_hdf5', 'serializers.save_hdf5', (["('%s' % output_weight_file)", '... |
# Copyright (c) 2018, 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 retain the above copyright
# notice, this list of c... | [
"torch.nn.Conv1d",
"torch.max",
"math.log2",
"torch.nn.functional.pad",
"torch.nn.functional.softmax",
"torch.tanh",
"torch.nn.ModuleList",
"utils.print_etr",
"torch.nn.Embedding",
"numpy.random.choice",
"torch.nn.functional.relu",
"time.time",
"torch.cat",
"torch.cuda.FloatTensor",
"tor... | [((2235, 2352), 'torch.nn.Conv1d', 'torch.nn.Conv1d', (['in_channels', 'out_channels'], {'kernel_size': 'kernel_size', 'stride': 'stride', 'dilation': 'dilation', 'bias': 'bias'}), '(in_channels, out_channels, kernel_size=kernel_size, stride=\n stride, dilation=dilation, bias=bias)\n', (2250, 2352), False, 'import t... |
# pylint: disable=missing-docstring, line-too-long, protected-access, E1101, C0202, E0602, W0109
# import relevant modules
import unittest
from runner import Runner
# Creates a class derived form unittest.TestCase
class TestE2E(unittest.TestCase):
@classmethod
def setUpClass(self):
self.snippet = """
... | [
"unittest.main",
"runner.Runner"
] | [((1742, 1757), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1755, 1757), False, 'import unittest\n'), ((792, 812), 'runner.Runner', 'Runner', (['self.snippet'], {}), '(self.snippet)\n', (798, 812), False, 'from runner import Runner\n')] |
from sklearn.svm import LinearSVC
import numpy as np
import scipy
from Blob import Blob
import logging
import time
import IAlgorithm
__author__ = 'simon'
class Classificator(IAlgorithm.IAlgorithm):
def __init__(self, classificator, use_sparse = None):
''' Trains a classificator in training phase and pre... | [
"logging.debug",
"logging.warning",
"numpy.array",
"Blob.Blob",
"scipy.sparse.vstack",
"logging.error"
] | [((666, 712), 'logging.debug', 'logging.debug', (["('Using sparse: %s' % use_sparse)"], {}), "('Using sparse: %s' % use_sparse)\n", (679, 712), False, 'import logging\n'), ((2530, 2637), 'logging.warning', 'logging.warning', (["('Training the model with feature dim %i, this might take a while' % data.\n shape[1])"],... |
import numpy as np
import brainscore
from brainio.assemblies import DataAssembly
from brainscore.benchmarks._properties_common import PropertiesBenchmark, _assert_grating_activations
from brainscore.benchmarks._properties_common import calc_spatial_frequency_tuning
from brainscore.metrics.ceiling import NeuronalProper... | [
"brainscore.get_assembly",
"brainscore.benchmarks._properties_common.PropertiesBenchmark",
"numpy.ones",
"numpy.argmax",
"brainscore.benchmarks._properties_common.calc_spatial_frequency_tuning",
"brainscore.metrics.distribution_similarity.BootstrapDistributionSimilarity",
"numpy.zeros",
"numpy.argwher... | [((2276, 2326), 'result_caching.store', 'store', ([], {'identifier_ignore': "['responses', 'baseline']"}), "(identifier_ignore=['responses', 'baseline'])\n", (2281, 2326), False, 'from result_caching import store\n'), ((1318, 1356), 'brainscore.get_assembly', 'brainscore.get_assembly', (['ASSEMBLY_NAME'], {}), '(ASSEMB... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: Ampel-plot/ampel-plot-browse/ampel/plot/SVGPlot.py
# License: BSD-3-Clause
# Author: <NAME> <<EMAIL>>
# Date: 13.06.2019
# Last Modified Date: 20.04.2022
# Last Modified By: <NAME> <<EMAIL>>
import os, html... | [
"ampel.plot.util.compression.decompress_svg_dict",
"os.path.join",
"ampel.plot.util.transform.rescale_str",
"html.escape",
"ampel.plot.util.transform.svg_to_png_html"
] | [((2751, 2790), 'ampel.plot.util.transform.rescale_str', 'rescale_str', (["self._record['svg']", 'scale'], {}), "(self._record['svg'], scale)\n", (2762, 2790), False, 'from ampel.plot.util.transform import svg_to_png_html, rescale_str\n'), ((755, 783), 'ampel.plot.util.compression.decompress_svg_dict', 'decompress_svg_... |
from random import randint
from rx import operators as op
from rx import range
from rx.core.typing import Observer
class Subscriber(Observer):
def __init__(self, ident):
self.id = ident
def on_next(self, value):
print(f'Subscriber: {self.id} Received: {value}')
def on_completed(self):
... | [
"rx.range",
"random.randint",
"rx.operators.publish"
] | [((530, 542), 'rx.operators.publish', 'op.publish', ([], {}), '()\n', (540, 542), True, 'from rx import operators as op\n'), ((466, 477), 'rx.range', 'range', (['(1)', '(4)'], {}), '(1, 4)\n', (471, 477), False, 'from rx import range\n'), ((505, 523), 'random.randint', 'randint', (['(1)', '(100000)'], {}), '(1, 100000)... |
import tensorflow as tf
import numpy as np
class MaxoutNN():
def __init__(self, input_dim, hidden_layers, output_dim):
self.input_dim = input_dim
self.hidden_layers = hidden_layers
self.output_dim = output_dim
self.inp = tf.placeholder(tf.float32, [None, self.input_dim], 'inp')
... | [
"tensorflow.contrib.layers.batch_norm",
"numpy.prod",
"tensorflow.get_variable",
"tensorflow.contrib.layers.layer_norm",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.nn.softmax_cross_entropy_with_logits_v2",
"tensorflow.global_variables_initializer",
"tensorflow.argmax",
"tensorflow... | [((259, 316), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, self.input_dim]', '"""inp"""'], {}), "(tf.float32, [None, self.input_dim], 'inp')\n", (273, 316), True, 'import tensorflow as tf\n'), ((339, 400), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, self.output_dim]', '"""... |
from denoising_diffusion_pytorch import Unet, GaussianDiffusion, Trainer
import torchvision
import os
import errno
import shutil
def create_folder(path):
try:
os.mkdir(path)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise
pass
def del_folder(path):
try:
... | [
"denoising_diffusion_pytorch.GaussianDiffusion",
"shutil.rmtree",
"os.mkdir",
"denoising_diffusion_pytorch.Trainer",
"denoising_diffusion_pytorch.Unet"
] | [((611, 853), 'denoising_diffusion_pytorch.Trainer', 'Trainer', (['diffusion', '"""/fs/cml-datasets/CelebA/Img/img_celeba/"""'], {'image_size': '(64)', 'train_batch_size': '(32)', 'train_lr': '(2e-05)', 'train_num_steps': '(700000)', 'gradient_accumulate_every': '(2)', 'ema_decay': '(0.995)', 'fp16': '(True)', 'results... |
from django.shortcuts import render
from django.http import HttpResponseRedirect
from .models import (lab_member, publication, job_listing,
media_listing, current_study, data_listing, software_listing)
from datetime import datetime
# homepage
def home_page(request):
return render(request, 'dlabsite/index.html'... | [
"django.shortcuts.render"
] | [((283, 321), 'django.shortcuts.render', 'render', (['request', '"""dlabsite/index.html"""'], {}), "(request, 'dlabsite/index.html')\n", (289, 321), False, 'from django.shortcuts import render\n'), ((465, 526), 'django.shortcuts.render', 'render', (['request', '"""dlabsite/people.html"""', "{'members': members}"], {}),... |
import asyncio
import copy
import inspect
import logging
from typing import Dict, Any, Callable, List, Tuple
log = logging.getLogger(__name__)
class Parser:
"""
deal with a list of tokens made from Lexer, convert their type to match the command.handler
"""
_parse_funcs: Dict[Any, Callable] = {
... | [
"logging.getLogger",
"copy.copy",
"inspect.signature",
"asyncio.iscoroutinefunction"
] | [((116, 143), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (133, 143), False, 'import logging\n'), ((532, 562), 'copy.copy', 'copy.copy', (['Parser._parse_funcs'], {}), '(Parser._parse_funcs)\n', (541, 562), False, 'import copy\n'), ((908, 934), 'inspect.signature', 'inspect.signature',... |
import warnings
warnings.simplefilter("ignore", UserWarning)
import pandas as pd
import dill as pickle
import functools
import os
from sklearn.feature_selection import f_regression, mutual_info_regression
from sklearn.mixture import BayesianGaussianMixture as GMM
from scipy.stats import spearmanr, pearsonr
import scipy... | [
"scipy.stats.spearmanr",
"os.path.exists",
"numpy.sqrt",
"pandas.read_csv",
"os.makedirs",
"tqdm.tqdm",
"os.getcwd",
"os.path.isfile",
"dill.dump",
"sklearn.mixture.BayesianGaussianMixture",
"functools.partial",
"numpy.sign",
"warnings.simplefilter",
"scipy.stats.norm.cdf",
"numpy.isinf"... | [((16, 60), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'UserWarning'], {}), "('ignore', UserWarning)\n", (37, 60), False, 'import warnings\n'), ((418, 504), 'pandas.read_csv', 'pd.read_csv', (['sif_file'], {'names': "['UpGene', 'Type', 'DownGene']", 'sep': '"""\t"""', 'header': 'None'}), "(sif_... |
# Copyright (c) 2016-2020, <NAME>
# 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
# notice, this list of conditions and the ... | [
"posixpath.join",
"re.compile",
"posixpath.dirname",
"posixpath.basename",
"posixpath.normpath"
] | [((2201, 2219), 're.compile', 're.compile', (['"""\\\\.+"""'], {}), "('\\\\.+')\n", (2211, 2219), False, 'import re\n'), ((2260, 2422), 're.compile', 're.compile', (['"""(^|[^\\\\\\\\])\\\\\\\\(\\\\\\\\\\\\\\\\)*($|[^xuU\\\\\\\\]|x[0-9a-fA-F]?($|[^0-9a-fA-F])|u[0-9a-fA-F]{0,3}($|[^0-9a-fA-F])|U[0-9a-fA-F]{0,7}($|[^0-9a... |
# -*- coding: utf-8 -*-
#
# Copyright 2009, 2010 <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/LICENSE-2.0
#
# Unless required by applicable la... | [
"logging.warn",
"logging.debug",
"base64.b64encode",
"cPickle.loads",
"os.environ.get",
"google.appengine.runtime.apiproxy_errors.ApplicationError",
"pylibmc.Client",
"time.time"
] | [((1411, 1447), 'os.environ.get', 'os.environ.get', (['"""APPLICATION_ID"""', '""""""'], {}), "('APPLICATION_ID', '')\n", (1425, 1447), False, 'import os\n'), ((1597, 1618), 'base64.b64encode', 'base64.b64encode', (['key'], {}), '(key)\n', (1613, 1618), False, 'import base64\n'), ((2224, 2246), 'pylibmc.Client', 'pylib... |
import math
layouts = []
def register_layout(cls):
layouts.append(cls)
return cls
def node(percent, layout, swallows, children):
result = {
"border": "normal",
# "current_border_width": 2,
"floating": "auto_off",
# "name": "fish <</home/finkernagel>>",
"percent"... | [
"math.sqrt",
"math.ceil",
"math.floor"
] | [((18396, 18413), 'math.ceil', 'math.ceil', (['(lr / 2)'], {}), '(lr / 2)\n', (18405, 18413), False, 'import math\n'), ((18430, 18448), 'math.floor', 'math.floor', (['(lr / 2)'], {}), '(lr / 2)\n', (18440, 18448), False, 'import math\n'), ((2163, 2190), 'math.ceil', 'math.ceil', (['(window_count / 2)'], {}), '(window_c... |
# Generated by Django 2.2.2 on 2019-09-27 06:34
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('dcodex_lectionary', '0005_auto_20190921_1617'),
]
operations = [
migrations.AlterModelOptions(
name='lectioninsystem',
optio... | [
"django.db.migrations.AlterModelOptions"
] | [((237, 363), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""lectioninsystem"""', 'options': "{'ordering': ['fixed_date', 'day_of_year', 'order_on_day']}"}), "(name='lectioninsystem', options={'ordering': [\n 'fixed_date', 'day_of_year', 'order_on_day']})\n", (265, 363), ... |
# -*- coding: utf-8 -*-
"""
Example code for feature extraction shown in Session 08.
Created on Mon Dec 10 15:48:37 2018
@author: lbechberger
"""
import sys, pickle, time, string
sys.path.append(".")
import knowledgestore.ks as ks
import nltk
from nltk.corpus import wordnet as wn
from sklearn.feature_extraction.tex... | [
"sklearn.metrics.pairwise.cosine_similarity",
"nltk.word_tokenize",
"nltk.FreqDist",
"knowledgestore.ks.run_resource_query",
"pickle.load",
"knowledgestore.ks.run_files_query",
"knowledgestore.ks.run_sparql_query",
"gensim.models.KeyedVectors.load_word2vec_format",
"sklearn.feature_extraction.text.T... | [((183, 203), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (198, 203), False, 'import sys, pickle, time, string\n'), ((737, 761), 'nltk.word_tokenize', 'nltk.word_tokenize', (['text'], {}), '(text)\n', (755, 761), False, 'import nltk\n'), ((844, 864), 'nltk.bigrams', 'nltk.bigrams', (['tokens'], ... |
import cv2
import time
import numpy as np
from tkinter import Tk
from tkinter.filedialog import askopenfilename
from utils import convert_image, chars_to_img, get_img_in_ascii, get_tile_img_dim
if __name__ == "__main__":
c = input("Choose what would you like to do:\nl - Load image to transform\nt - Translate you ... | [
"utils.chars_to_img",
"cv2.waitKey",
"tkinter.Tk",
"utils.convert_image",
"cv2.VideoCapture",
"utils.get_img_in_ascii",
"utils.get_tile_img_dim",
"time.time",
"tkinter.filedialog.askopenfilename"
] | [((363, 367), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (365, 367), False, 'from tkinter import Tk\n'), ((453, 539), 'tkinter.filedialog.askopenfilename', 'askopenfilename', ([], {'filetypes': "[('Image files', '*.png, *.jpg'), ('All Files', '*.*')]"}), "(filetypes=[('Image files', '*.png, *.jpg'), ('All Files',\n '*.*'... |
#!/usr/bin/env python
from __future__ import print_function
import sys
import datetime
from os import (sysconf, listdir, rename)
from os.path import (basename, dirname, exists,
isfile, realpath, join as path_join)
from re import (match as re_match,
sub as re_sub)
from fnmatch impor... | [
"os.rename",
"os.path.join",
"re.match",
"optparse.OptionParser",
"os.path.isfile",
"os.sysconf"
] | [((1093, 1125), 'optparse.OptionParser', 'OptionParser', ([], {'usage': 'HELP_MESSAGE'}), '(usage=HELP_MESSAGE)\n', (1105, 1125), False, 'from optparse import OptionParser\n'), ((2807, 2850), 're.match', 're_match', (['JVM_MEMORY_REGEXP', 'jvm_mem_option'], {}), '(JVM_MEMORY_REGEXP, jvm_mem_option)\n', (2815, 2850), Tr... |
import pytest
import mantle
from ..harness import show
def com(name, main):
import magma
from magma.testing import check_files_equal
name += '_' + magma.mantle_target
build = 'build/' + name
gold = 'gold/' + name
magma.compile(build, main)
assert check_files_equal(__file__, build+'.v', go... | [
"mantle.util.lfsr.DefineLFSR",
"pytest.mark.parametrize",
"magma.compile",
"magma.testing.check_files_equal"
] | [((398, 450), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""width"""', '[3, 4, 5, 6, 7, 8]'], {}), "('width', [3, 4, 5, 6, 7, 8])\n", (421, 450), False, 'import pytest\n'), ((238, 264), 'magma.compile', 'magma.compile', (['build', 'main'], {}), '(build, main)\n', (251, 264), False, 'import magma\n'), ((27... |
import pandas as pd
import scipy.spatial as sp
import scipy.cluster.hierarchy as hc
from sklearn.metrics import silhouette_score
import numpy as np
from common import genome_pdist as gd
def automatic_cluster_species(Dist,seed_tresholds= [0.92,0.97],linkage_method='average'):
linkage = hc.linkage(sp.distance... | [
"common.genome_pdist.load_mummer",
"common.genome_pdist.evaluate_clusters_tresholds",
"scipy.spatial.distance.squareform",
"numpy.isnan",
"common.genome_pdist.load_quality",
"pandas.DataFrame",
"common.genome_pdist.best_genome_from_table",
"common.genome_pdist.pairewise2matrix",
"scipy.cluster.hiera... | [((1362, 1418), 'scipy.cluster.hierarchy.fcluster', 'hc.fcluster', (['linkage', '(1 - treshold)'], {'criterion': '"""distance"""'}), "(linkage, 1 - treshold, criterion='distance')\n", (1373, 1418), True, 'import scipy.cluster.hierarchy as hc\n'), ((1429, 1508), 'common.genome_pdist.evaluate_clusters_tresholds', 'gd.eva... |
#-------------------------------------------------------------------------------------------------------------------
# Packages & Settings
#-------------------------------------------------------------------------------------------------------------------
# General packages
import time
import sys
import os
import date... | [
"scipy.optimize.curve_fit",
"numpy.mean",
"matplotlib.pyplot.hist",
"os.makedirs",
"os.path.isdir",
"numpy.std",
"sys.path.append",
"matplotlib.pyplot.show"
] | [((935, 974), 'sys.path.append', 'sys.path.append', (['"""/home/rettenls/code/"""'], {}), "('/home/rettenls/code/')\n", (950, 974), False, 'import sys\n'), ((1929, 1950), 'numpy.mean', 'np.mean', (['displacement'], {}), '(displacement)\n', (1936, 1950), True, 'import numpy as np\n'), ((2219, 2263), 'matplotlib.pyplot.h... |
import json
import os
import asyncio
from aiohttp.client import ClientSession
from ln_address import LNAddress
import logging
###################################
logging.basicConfig(filename='lnaddress.log', level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
logging.getLogger("lnaddres... | [
"logging.basicConfig",
"logging.getLogger",
"aiohttp.client.ClientSession",
"os.getenv",
"ln_address.LNAddress",
"asyncio.get_event_loop",
"logging.info",
"logging.error"
] | [((164, 297), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""lnaddress.log"""', 'level': 'logging.INFO', 'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'}), "(filename='lnaddress.log', level=logging.INFO, format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n",... |
import unittest
import dwmon
class CronTests(unittest.TestCase):
def test_parse_requirements(self):
cron_string = "CHECKHOURS0-9 CHECKMINUTES0-10 " \
"WEEKDAYS MINNUM5 MAXNUM20 LOOKBACKSECONDS3600"
result = dwmon.parse_requirements(cron_string)
self.assertTrue(result["check_ho... | [
"dwmon.parse_requirements",
"dwmon.matches_time_pattern"
] | [((242, 279), 'dwmon.parse_requirements', 'dwmon.parse_requirements', (['cron_string'], {}), '(cron_string)\n', (266, 279), False, 'import dwmon\n'), ((959, 996), 'dwmon.parse_requirements', 'dwmon.parse_requirements', (['cron_string'], {}), '(cron_string)\n', (983, 996), False, 'import dwmon\n'), ((3238, 3277), 'dwmon... |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from telemetry import story
from telemetry.story import shared_state
# pylint: disable=abstract-method
class SharedStateBar(shared_state.S... | [
"telemetry.story.Story"
] | [((577, 611), 'telemetry.story.Story', 'story.Story', (['SharedStateBar', '"""foo"""'], {}), "(SharedStateBar, 'foo')\n", (588, 611), False, 'from telemetry import story\n'), ((621, 655), 'telemetry.story.Story', 'story.Story', (['SharedStateBar', '"""bar"""'], {}), "(SharedStateBar, 'bar')\n", (632, 655), False, 'from... |
#!/usr/bin/python3
###################
# CONFIG FILE
###################
###################
# IMPORTS
import logging
###################
###################
# GENERAL
# LOGGING
logger = logging.getLogger("webnetter")
hdlr = logging.FileHandler("webnetter.log")
formatter = logging.Formatter("%(asctime)s:%(levelname)s... | [
"logging.getLogger",
"logging.Formatter",
"logging.FileHandler"
] | [((189, 219), 'logging.getLogger', 'logging.getLogger', (['"""webnetter"""'], {}), "('webnetter')\n", (206, 219), False, 'import logging\n'), ((227, 263), 'logging.FileHandler', 'logging.FileHandler', (['"""webnetter.log"""'], {}), "('webnetter.log')\n", (246, 263), False, 'import logging\n'), ((276, 334), 'logging.For... |
from websocket import run
def main():
run(8000, False)
if __name__ == '__main__':
main()
| [
"websocket.run"
] | [((41, 57), 'websocket.run', 'run', (['(8000)', '(False)'], {}), '(8000, False)\n', (44, 57), False, 'from websocket import run\n')] |
from django.shortcuts import render
from .models import RcStudent
from django.http import HttpResponse
import os
import random
import string
import hashlib
import simplejson
def get_post(request):
if request.method == "POST":
req = simplejson.loads(request.body)
# 检查token是否一致
token = "<PAS... | [
"random.sample",
"aliyunsdkcore.request.CommonRequest",
"aliyunsdkcore.client.AcsClient",
"django.http.HttpResponse",
"os.path.splitext",
"os.path.join",
"os.path.split",
"simplejson.loads"
] | [((246, 276), 'simplejson.loads', 'simplejson.loads', (['request.body'], {}), '(request.body)\n', (262, 276), False, 'import simplejson\n'), ((1013, 1028), 'django.http.HttpResponse', 'HttpResponse', (['(0)'], {}), '(0)\n', (1025, 1028), False, 'from django.http import HttpResponse\n'), ((1177, 1204), 'os.path.splitext... |
"""
Author : <NAME>
FileName : page.py
Date : 5.5.17
Version : 1.0
"""
from tkinter import *
import tkFontChooser
from constants import *
class Page(object):
def __init__(self, root):
object.__init__(self)
root.title(TITLE)
root.geometry(PAGE_SIZ... | [
"tkFontChooser.Font"
] | [((382, 429), 'tkFontChooser.Font', 'tkFontChooser.Font', ([], {'size': 'MENU_SIZE', 'weight': 'BOLD'}), '(size=MENU_SIZE, weight=BOLD)\n', (400, 429), False, 'import tkFontChooser\n'), ((451, 498), 'tkFontChooser.Font', 'tkFontChooser.Font', ([], {'size': 'TEXT_SIZE', 'weight': 'BOLD'}), '(size=TEXT_SIZE, weight=BOLD)... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of command_runner module
"""
wmi_queries wrapper
transforms wmi objects into python dicts
Handles most runtime errors
Versioning semantics:
Major version: backward compatibility breaking changes
Minor version: New functionality
Patch v... | [
"time.localtime"
] | [((3409, 3425), 'time.localtime', 'time.localtime', ([], {}), '()\n', (3423, 3425), False, 'import time\n')] |
import datetime
import numpy as np
import os
import pandas as pd
import shutil
import urllib.request
import zipfile
__all__ = [
'fetch_ml_ratings',
]
VARIANTS = {
'100k': {'filename': 'u.data', 'sep': '\t'},
'1m': {'filename': 'ratings.dat', 'sep': r'::'},
'10m': {'filename': 'ratings.dat', 'sep': r'... | [
"os.path.exists",
"shutil.copyfileobj",
"pandas.read_csv",
"os.makedirs",
"zipfile.ZipFile",
"os.path.join",
"os.environ.get",
"os.path.expanduser",
"os.remove"
] | [((1383, 1407), 'os.path.exists', 'os.path.exists', (['csv_path'], {}), '(csv_path)\n', (1397, 1407), False, 'import os\n'), ((3658, 3823), 'pandas.read_csv', 'pd.read_csv', (['csv_path'], {'names': 'names', 'dtype': 'dtype', 'header': '(0)', 'sep': "VARIANTS[variant]['sep']", 'parse_dates': "['timestamp']", 'date_pars... |
# //utils for periodic boundary conditions
# // Author: <NAME>
# // Date: 6.8.2021
# // Group: Rappel Group, UCSD
from numba import njit
import numpy as np
@njit
def pbc(x, L):
if(x<0):
X = x+L
return X
if(x>=L):
X = x-L
return X
return x
@njit
def sqdiff(x1, x2):
return... | [
"numpy.sqrt"
] | [((1036, 1054), 'numpy.sqrt', 'np.sqrt', (['(xsq + ysq)'], {}), '(xsq + ysq)\n', (1043, 1054), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2019-11-17 15:46
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Aluse... | [
"django.db.models.DateTimeField",
"django.db.models.EmailField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((368, 461), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (384, 461), False, 'from django.db import migrations, models\... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Ansible Project
# Copyright: (c) 2018, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = ... | [
"traceback.format_exc",
"ansible.module_utils.basic.AnsibleModule",
"ansible_collections.community.digitalocean.plugins.module_utils.digital_ocean.DigitalOceanHelper.digital_ocean_argument_spec",
"ansible_collections.community.digitalocean.plugins.module_utils.digital_ocean.DigitalOceanHelper",
"ansible.mod... | [((3453, 3479), 'ansible_collections.community.digitalocean.plugins.module_utils.digital_ocean.DigitalOceanHelper', 'DigitalOceanHelper', (['module'], {}), '(module)\n', (3471, 3479), False, 'from ansible_collections.community.digitalocean.plugins.module_utils.digital_ocean import DigitalOceanHelper\n'), ((3897, 3945),... |
""" The functions implemented here are standard benchmarks from literature. """
__author__ = '<NAME>, <EMAIL>'
from scipy import ones, sqrt, dot, sign, randn, power, rand, floor, array
from scipy.linalg import norm, orth
from function import FunctionEnvironment
class SphereFunction(FunctionEnvironment):
""" Si... | [
"function.FunctionEnvironment.__init__",
"scipy.ones",
"scipy.sqrt",
"scipy.floor",
"scipy.power",
"scipy.linalg.norm",
"scipy.randn",
"scipy.dot",
"scipy.rand"
] | [((384, 393), 'scipy.dot', 'dot', (['x', 'x'], {}), '(x, x)\n', (387, 393), False, 'from scipy import ones, sqrt, dot, sign, randn, power, rand, floor, array\n'), ((1025, 1076), 'function.FunctionEnvironment.__init__', 'FunctionEnvironment.__init__', (['self', '*args'], {}), '(self, *args, **kwargs)\n', (1053, 1076), F... |
from time import sleep
from math import isnan
import time
import sys
import datetime
import subprocess
import sys
import os
from subprocess import PIPE, Popen
import traceback
import math
import base64
import json
from time import gmtime, strftime
import random, string
import psutil
import base64
import uuid
import soc... | [
"psutil.virtual_memory",
"pulsar.Client",
"bme280.BME280",
"subprocess.Popen",
"enviroplus.noise.Noise",
"ltr559.get_lux",
"psutil.net_if_addrs",
"socket.gethostname",
"os.uname",
"psutil.cpu_percent",
"ST7735.ST7735",
"uuid.uuid4",
"enviroplus.gas.read_all",
"ltr559.LTR559",
"smbus2.SMB... | [((1552, 1559), 'enviroplus.noise.Noise', 'Noise', ([], {}), '()\n', (1557, 1559), False, 'from enviroplus.noise import Noise\n'), ((1689, 1700), 'time.time', 'time.time', ([], {}), '()\n', (1698, 1700), False, 'import time\n'), ((1942, 2031), 'ST7735.ST7735', 'ST7735.ST7735', ([], {'port': '(0)', 'cs': '(1)', 'dc': '(... |
import os
import sys
from PyQt5 import QtGui
from PyQt5.QtCore import QStandardPaths, QSettings
from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox, QFileDialog
from PyQt5.QtXml import QDomDocument, QDomNode
try:
from krita import *
CONTEXT_KRITA = True
Krita = Krita # to stop Eric ide compl... | [
"durraext.DURRAExt",
"PyQt5.QtWidgets.QApplication"
] | [((844, 860), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['[]'], {}), '([])\n', (856, 860), False, 'from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox, QFileDialog\n'), ((882, 896), 'durraext.DURRAExt', 'DURRAExt', (['None'], {}), '(None)\n', (890, 896), False, 'from durraext import DURRAExt\n')] |
from sympy import symbols, plot_implicit, plot, plot_parametric
from sympy.plotting import plot_parametric
x, y = symbols( 'x, y' )
exprs = [[ -3*x + 4*y >= 12, 'b' ],
[ x + 3*y >= 6, 'r'],
[ y <= 1, 'g']]
p = plot_implicit( exprs[ 0 ][ 0 ], line_color = exprs[ 0 ][ 1 ], show = False )
p.extend( plot_implici... | [
"sympy.symbols",
"sympy.plotting.plot_parametric",
"sympy.plot_implicit"
] | [((115, 130), 'sympy.symbols', 'symbols', (['"""x, y"""'], {}), "('x, y')\n", (122, 130), False, 'from sympy import symbols, plot_implicit, plot, plot_parametric\n'), ((220, 282), 'sympy.plot_implicit', 'plot_implicit', (['exprs[0][0]'], {'line_color': 'exprs[0][1]', 'show': '(False)'}), '(exprs[0][0], line_color=exprs... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/configExportDialog.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 impor... | [
"PyQt5.QtWidgets.QDialogButtonBox",
"PyQt5.QtWidgets.QPlainTextEdit",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QPushButton"
] | [((571, 619), 'PyQt5.QtWidgets.QDialogButtonBox', 'QtWidgets.QDialogButtonBox', (['TemplateConfigDialog'], {}), '(TemplateConfigDialog)\n', (597, 619), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((941, 987), 'PyQt5.QtWidgets.QPlainTextEdit', 'QtWidgets.QPlainTextEdit', (['TemplateConfigDialog'], {}), '(Tem... |
from os import path
def readfile (inpath):
# open file creating a context so that it is automatically created
# and process line by line in to a list of strings
with open(inpath, 'r') as infileobject:
lines = infileobject.readlines()
ledger = []
for line in lines:
columns = line.spl... | [
"os.path.realpath",
"os.path.replace"
] | [((1396, 1415), 'os.path.realpath', 'path.realpath', (['"""./"""'], {}), "('./')\n", (1409, 1415), False, 'from os import path\n'), ((1433, 1456), 'os.path.replace', 'path.replace', (['"""\\\\"""', '"""/"""'], {}), "('\\\\', '/')\n", (1445, 1456), False, 'from os import path\n')] |
import os
import scipy as sp
import scipy.misc
import imreg_dft as ird
basedir = os.path.join('..', 'examples')
# the TEMPLATE
im0 = sp.misc.imread(os.path.join(basedir, "sample1.png"), True)
# the image to be transformed
im1 = sp.misc.imread(os.path.join(basedir, "sample2.png"), True)
result = ird.translation(im0,... | [
"os.environ.get",
"os.path.join",
"imreg_dft.imshow",
"imreg_dft.translation",
"imreg_dft.transform_img",
"matplotlib.pyplot.show"
] | [((85, 115), 'os.path.join', 'os.path.join', (['""".."""', '"""examples"""'], {}), "('..', 'examples')\n", (97, 115), False, 'import os\n'), ((300, 325), 'imreg_dft.translation', 'ird.translation', (['im0', 'im1'], {}), '(im0, im1)\n', (315, 325), True, 'import imreg_dft as ird\n'), ((389, 422), 'imreg_dft.transform_im... |
from nextcord.ext import commands
from bot.checks import guild_allowed
from bot.cogs.cog import Cog
from log import init_logger, LogLevel
__all__ = ["Debug"]
log = init_logger(__name__, LogLevel.DEBUG)
class Debug(Cog):
def __init__(self, bot: commands.Bot, enabled=False) -> None:
super().__init__("debu... | [
"log.init_logger",
"bot.checks.guild_allowed",
"nextcord.ext.commands.command"
] | [((166, 203), 'log.init_logger', 'init_logger', (['__name__', 'LogLevel.DEBUG'], {}), '(__name__, LogLevel.DEBUG)\n', (177, 203), False, 'from log import init_logger, LogLevel\n'), ((366, 384), 'nextcord.ext.commands.command', 'commands.command', ([], {}), '()\n', (382, 384), False, 'from nextcord.ext import commands\n... |
# -*- coding: utf-8 -*-
# Created on Thu Dec 5 16:49:20 2019
# @author: arthurd
"""
FoRoute Module.
Visualize Map Matching routes on HTML maps.
"""
from matplotlib import collections as mc
import matplotlib.pyplot as plt
import osmnx as ox
import webbrowser
import folium
import numpy as np
import noiseplanet.matc... | [
"osmnx.plot_graph",
"folium.Element",
"osmnx.plot_graph_folium",
"folium.TileLayer",
"webbrowser.open",
"folium.Map",
"matplotlib.collections.LineCollection",
"numpy.array",
"noiseplanet.matcher.graph_from_track",
"matplotlib.pyplot.scatter",
"folium.PolyLine",
"matplotlib.pyplot.title",
"fo... | [((1160, 1184), 'numpy.array', 'np.array', (['[[None, None]]'], {}), '([[None, None]])\n', (1168, 1184), True, 'import numpy as np\n'), ((3143, 3269), 'osmnx.plot_graph', 'ox.plot_graph', (['graph'], {'node_color': '"""skyblue"""', 'node_alpha': '(0.5)', 'node_size': '(20)', 'annotate': '(True)', 'margin': '(0)', 'show... |
#!/usr/bin/env python3
import sys
import argparse
import tempfile
import re
import requests as req, zipfile, io, markdown2 as md, sqlite3, os, shutil, tarfile
p = argparse.ArgumentParser()
p.add_argument('--url', '-u')
p.add_argument('--dir', '-d')
p.add_argument('-k', '--keyword', default='tldr', help='Keyword for ... | [
"os.path.exists",
"os.listdir",
"tarfile.open",
"sqlite3.connect",
"os.makedirs",
"argparse.ArgumentParser",
"os.path.join",
"requests.get",
"shutil.rmtree",
"tempfile.mktemp",
"markdown2.Markdown",
"shutil.copyfile",
"sys.stderr.write",
"os.path.isdir",
"os.unlink",
"sys.exit",
"re.... | [((166, 191), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (189, 191), False, 'import argparse\n'), ((1078, 1102), 'os.path.exists', 'os.path.exists', (['doc_path'], {}), '(doc_path)\n', (1092, 1102), False, 'import requests as req, zipfile, io, markdown2 as md, sqlite3, os, shutil, tarfile\n... |
""" Key signature quiz """
import random
from typing import List
import webbrowser
from model import exercise, exercise_step
from model.exercise_helper import ExerciseHelperType, ExerciseHelper
from music_theory import key_signature
from practice import abstract_practice
from practice.practice_category import PracticeC... | [
"model.exercise_step.ExerciseStep",
"model.exercise_helper.ExerciseHelper",
"model.exercise.Exercise",
"music_theory.key_signature.KeySignature",
"webbrowser.open",
"random.randint"
] | [((580, 608), 'music_theory.key_signature.KeySignature', 'key_signature.KeySignature', ([], {}), '()\n', (606, 608), False, 'from music_theory import key_signature\n'), ((1980, 2077), 'model.exercise.Exercise', 'exercise.Exercise', (['self._TITLE', 'self._SUBTITLE', 'random_steps'], {'practice_category': 'self.category... |
from functools import update_wrapper
from django.contrib import admin
from django.contrib.admin.utils import unquote
from django.core.exceptions import PermissionDenied
from django.core.management import load_command_class
from django.http import Http404
from django.shortcuts import render
from django.utils.encoding i... | [
"django.shortcuts.render",
"django.utils.encoding.force_unicode",
"django.contrib.admin.site.register",
"ietf.group.models.Role.objects.filter",
"django.utils.html.escape",
"django.contrib.admin.utils.unquote",
"django.utils.translation.ugettext",
"django.core.management.load_command_class",
"functo... | [((3554, 3592), 'django.contrib.admin.site.register', 'admin.site.register', (['Group', 'GroupAdmin'], {}), '(Group, GroupAdmin)\n', (3573, 3592), False, 'from django.contrib import admin\n'), ((3869, 3921), 'django.contrib.admin.site.register', 'admin.site.register', (['GroupHistory', 'GroupHistoryAdmin'], {}), '(Grou... |
"""empty message
Revision ID: ee2aa0d04791
Revises: c45a6b3de513
Create Date: 2016-12-06 21:15:05.153828
"""
from alembic import op
import sqlalchemy as sa
import geoalchemy2
# revision identifiers, used by Alembic.
revision = 'ee2aa0d04791'
down_revision = 'c45a6b3de513'
branch_labels = None
depends_on = None
de... | [
"sqlalchemy.VARCHAR",
"alembic.op.drop_column",
"sqlalchemy.PrimaryKeyConstraint",
"geoalchemy2.types.Geography",
"sqlalchemy.INTEGER",
"alembic.op.drop_index",
"sqlalchemy.CheckConstraint",
"alembic.op.create_index"
] | [((576, 640), 'alembic.op.drop_index', 'op.drop_index', (['"""ix_containers_position"""'], {'table_name': '"""containers"""'}), "('ix_containers_position', table_name='containers')\n", (589, 640), False, 'from alembic import op\n'), ((645, 685), 'alembic.op.drop_column', 'op.drop_column', (['"""containers"""', '"""posi... |
#!/usr/bin/env python
# modules
# ROS stuff and multithreading
import rospy
from geometry_msgs.msg import Twist, Pose2D, PoseStamped
from sensor_msgs.msg import JointState
from nav_msgs.msg import Odometry, Path
from std_msgs.msg import Float32MultiArray
import tf
import numpy as np
import sys
from dynamic_reconfigure... | [
"rospy.init_node",
"rospy.Rate",
"numpy.arctan2",
"numpy.linalg.norm",
"numpy.sin",
"dynamic_reconfigure.server.Server",
"numpy.linspace",
"rospy.Subscriber",
"geometry_msgs.msg.Twist",
"rospy.Time.now",
"numpy.cos",
"rospy.Publisher",
"nav_msgs.msg.Path",
"rospy.is_shutdown",
"std_msgs.... | [((6547, 6573), 'rospy.init_node', 'rospy.init_node', (['"""control"""'], {}), "('control')\n", (6562, 6573), False, 'import rospy\n'), ((6671, 6677), 'nav_msgs.msg.Path', 'Path', ([], {}), '()\n', (6675, 6677), False, 'from nav_msgs.msg import Odometry, Path\n'), ((6728, 6786), 'numpy.linspace', 'np.linspace', (['(-np... |
import os
import requests
import json
import pandas as pd
from flask import Flask, request, Response
# constants
TOKEN = '<KEY>'
# Info about the bot
#https://api.telegram.org/bot1635014867:AAGcjBhZhXj635ezI6XeU-2vWP2FzJk9aH4/getMe
# Get Update from telegram
#https://api.telegram.org/bot1635014867:AAGcjBhZhXj635ezI6... | [
"requests.post",
"pandas.read_csv",
"flask.Flask",
"pandas.merge",
"os.environ.get",
"flask.request.get_json",
"flask.Response"
] | [((2373, 2388), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (2378, 2388), False, 'from flask import Flask, request, Response\n'), ((840, 879), 'requests.post', 'requests.post', (['url'], {'json': "{'text': text}"}), "(url, json={'text': text})\n", (853, 879), False, 'import requests\n'), ((1018, 1041), ... |
import os
import re
import string
import bs4
source = "C:/Users/bkoschicek/Desktop/Python/dig-tib/register/better/"
target = "C:/Users/bkoschicek/Desktop/Python/dig-tib/register/better/linked/"
lof = os.listdir(source)
result = []
tibname = ""
def getXML():
for f in lof:
tib = []
dump = []
... | [
"re.findall",
"os.listdir",
"os.path.splitext"
] | [((203, 221), 'os.listdir', 'os.listdir', (['source'], {}), '(source)\n', (213, 221), False, 'import os\n'), ((340, 359), 'os.path.splitext', 'os.path.splitext', (['f'], {}), '(f)\n', (356, 359), False, 'import os\n'), ((472, 495), 're.findall', 're.findall', (['"""[0-9]+"""', 'f'], {}), "('[0-9]+', f)\n", (482, 495), ... |
""" Contains classes and methods to obtain various regression based metrics to evaluate"""
from sklearn import metrics
import numpy as np
import pandas as pd
import math
import sys
sys.path.append("../config")
class MetricsEval:
"""MetricsEval Class
Evaluate metrics to evaluate model performance
"""
def metr... | [
"numpy.sqrt",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.r2_score",
"sys.path.append",
"numpy.mean",
"numpy.where",
"pandas.DataFrame.from_dict",
"numpy.exp",
"numpy.stack",
"pandas.DataFrame",
"sklearn.metrics.mean_ab... | [((181, 209), 'sys.path.append', 'sys.path.append', (['"""../config"""'], {}), "('../config')\n", (196, 209), False, 'import sys\n'), ((1268, 1285), 'numpy.zeros', 'np.zeros', (['kcc_dim'], {}), '(kcc_dim)\n', (1276, 1285), True, 'import numpy as np\n'), ((1299, 1316), 'numpy.zeros', 'np.zeros', (['kcc_dim'], {}), '(kc... |
import hashlib
def sha256_function(data: bytes) -> bytes:
sha256_object = hashlib.sha256()
sha256_object.update(data)
return sha256_object.digest()
def sha256_trim1(data: bytes) -> bytes:
return sha256_function(data)[:1]
def sha256_trim2(data: bytes) -> bytes:
return sha256_function(data)[:2]
| [
"hashlib.sha256"
] | [((76, 92), 'hashlib.sha256', 'hashlib.sha256', ([], {}), '()\n', (90, 92), False, 'import hashlib\n')] |
import csv
import json
from reporting.utils import get_value_by_pattern
from reporting.constants import LATENCY_ATTRIBUTE_MAPPING
def parse_res_file(path):
"""Read data from file ends with ".res".
Args:
path (str): The position of the res file.
Returns:
incremental_metrics (list, json a... | [
"csv.DictReader",
"reporting.utils.get_value_by_pattern"
] | [((419, 457), 'csv.DictReader', 'csv.DictReader', (['csvfile'], {'delimiter': '""","""'}), "(csvfile, delimiter=',')\n", (433, 457), False, 'import csv\n'), ((828, 868), 'reporting.utils.get_value_by_pattern', 'get_value_by_pattern', (['row', 'pattern', 'None'], {}), '(row, pattern, None)\n', (848, 868), False, 'from r... |
# Cuppa1 interpreter using Yacc
from cuppa1_state import state
from cuppa1_ply_lex import lexer
from cuppa1_ply_fe import parser
from cuppa1_interp_walk import walk
from dumpast import dumpast
def interp(input_stream, dump=False):
try:
state.initialize()
parser.parse(input_stream, lexer=lexer)
... | [
"dumpast.dumpast",
"cuppa1_ply_fe.parser.parse",
"os.path.isfile",
"cuppa1_interp_walk.walk",
"sys.exit",
"sys.stdin.read",
"cuppa1_state.state.initialize"
] | [((250, 268), 'cuppa1_state.state.initialize', 'state.initialize', ([], {}), '()\n', (266, 268), False, 'from cuppa1_state import state\n'), ((277, 316), 'cuppa1_ply_fe.parser.parse', 'parser.parse', (['input_stream'], {'lexer': 'lexer'}), '(input_stream, lexer=lexer)\n', (289, 316), False, 'from cuppa1_ply_fe import p... |
import json
def load_tools(file_path='/definitions/workers.json'):
tools = {}
with open(file_path) as json_file:
tools = json.load(json_file)
return tools
| [
"json.load"
] | [((138, 158), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (147, 158), False, 'import json\n')] |
# coding: utf-8
from __future__ import unicode_literals
from pprint import pformat
from boxsdk.network.default_network import DefaultNetwork
from boxsdk.util.log import setup_logging
class LoggingNetwork(DefaultNetwork):
"""
SDK Network subclass that logs requests and responses.
"""
LOGGER_NAME = 'bo... | [
"boxsdk.util.log.setup_logging",
"pprint.pformat"
] | [((859, 895), 'boxsdk.util.log.setup_logging', 'setup_logging', ([], {'name': 'self.LOGGER_NAME'}), '(name=self.LOGGER_NAME)\n', (872, 895), False, 'from boxsdk.util.log import setup_logging\n'), ((1528, 1543), 'pprint.pformat', 'pformat', (['kwargs'], {}), '(kwargs)\n', (1535, 1543), False, 'from pprint import pformat... |
import os
import argparse
import sys
from Image_extractor import *
from Lidar_pointcloud_extractor import *
from Calibration_extractor import *
from Label_extractor import *
from Label_ext_with_occlusion import *
def File_names_and_path(source_folder):
dir_list = os.listdir(source_folder)
files = list()
... | [
"os.listdir",
"os.path.join",
"os.path.isdir",
"argparse.ArgumentParser"
] | [((270, 295), 'os.listdir', 'os.listdir', (['source_folder'], {}), '(source_folder)\n', (280, 295), False, 'import os\n'), ((664, 689), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (687, 689), False, 'import argparse\n'), ((2808, 2857), 'os.path.join', 'os.path.join', (['dest_folder', '"""Out... |
# -*- coding: utf-8 -*-
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from listings.models import Job
from categories.models import Category
from listings.conf.setting... | [
"django.utils.translation.ugettext_lazy",
"django.shortcuts.get_object_or_404",
"listings.models.Job.active.all",
"django.core.urlresolvers.reverse"
] | [((1139, 1155), 'listings.models.Job.active.all', 'Job.active.all', ([], {}), '()\n', (1153, 1155), False, 'from listings.models import Job\n'), ((503, 541), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Category'], {'slug': 'slug'}), '(Category, slug=slug)\n', (520, 541), False, 'from django.shortcuts ... |
import os
import numpy as np
from .logger import *
from .bot import *
from .mongo import *
from .data_service_api import *
class Algorithm():
def __init__(self, db, bot_id, logger):
self.bot= Bot(db, bot_id)
self.account_data_service_api = DataServiceAPI(
os.environ.get("ACCOUNTS_R... | [
"os.environ.get"
] | [((294, 338), 'os.environ.get', 'os.environ.get', (['"""ACCOUNTS_REST_API_BASE_URL"""'], {}), "('ACCOUNTS_REST_API_BASE_URL')\n", (308, 338), False, 'import os\n'), ((352, 383), 'os.environ.get', 'os.environ.get', (['"""REST_API_USER"""'], {}), "('REST_API_USER')\n", (366, 383), False, 'import os\n'), ((397, 432), 'os.... |
#!/usr/bin/env python3
import asyncio
from async_generator import aclosing
from amqproto import BasicContent, BasicProperties
from amqproto.adapters.asyncio_adapter import AsyncioConnection, run
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n-1) + fib(n-2... | [
"amqproto.BasicProperties",
"amqproto.adapters.asyncio_adapter.AsyncioConnection"
] | [((370, 405), 'amqproto.adapters.asyncio_adapter.AsyncioConnection', 'AsyncioConnection', ([], {'host': '"""localhost"""'}), "(host='localhost')\n", (387, 405), False, 'from amqproto.adapters.asyncio_adapter import AsyncioConnection, run\n'), ((1257, 1322), 'amqproto.BasicProperties', 'BasicProperties', ([], {'correlat... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-05-18 18:39
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
# skip non-exixtent 0003_planschedule
dependencies = [("plan", "0002_plan_devhub")]
operations = [migrations.RemoveFie... | [
"django.db.migrations.RemoveField"
] | [((300, 356), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""plan"""', 'name': '"""devhub"""'}), "(model_name='plan', name='devhub')\n", (322, 356), False, 'from django.db import migrations\n')] |
import http.client
import json
import logging
import os
import ssl
import threading
import urllib.parse
from base64 import b64encode
from datetime import datetime
from http.client import HTTPConnection, HTTPResponse
from typing import Optional, Dict
from pyctuator.auth import Auth, BasicAuth
# pylint: disable=too-ma... | [
"logging.debug",
"os.getenv",
"threading.Timer",
"ssl.SSLContext",
"json.dumps",
"logging.info"
] | [((1680, 1765), 'threading.Timer', 'threading.Timer', (['registration_interval_sec', 'self._register_with_admin_server', '[]'], {}), '(registration_interval_sec, self._register_with_admin_server, []\n )\n', (1695, 1765), False, 'import threading\n'), ((2447, 2553), 'logging.debug', 'logging.debug', (['"""Trying to p... |
import cv2
import matplotlib
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
from PIL import ImageFilter, Image
def find_circle_coords(imagefile, radmin=80, radmax=110, houghaccumulator=0.6, searchrad=190):
''' Pass a raw image, and it will return a list of the identified circl... | [
"cv2.rectangle",
"numpy.hstack",
"cv2.HoughCircles",
"cv2.circle",
"cv2.destroyAllWindows",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imread"
] | [((672, 693), 'cv2.imread', 'cv2.imread', (['imagefile'], {}), '(imagefile)\n', (682, 693), False, 'import cv2\n'), ((761, 801), 'cv2.cvtColor', 'cv2.cvtColor', (['output', 'cv2.COLOR_BGR2GRAY'], {}), '(output, cv2.COLOR_BGR2GRAY)\n', (773, 801), False, 'import cv2\n'), ((1593, 1614), 'cv2.imread', 'cv2.imread', (['ima... |
# -*- coding: utf-8 -*-
from algo.stmts import *
from algo.worker import Worker
from maths.parser import quick_parse as parse
from tests.framework import expect
tests = [
(
[
AssignStmt(parse("sum"), parse("0")),
InputStmt(parse("N")),
ForStmt("i", parse("1"), parse("N"... | [
"algo.worker.Worker",
"maths.parser.quick_parse"
] | [((3928, 3940), 'algo.worker.Worker', 'Worker', (['algo'], {}), '(algo)\n', (3934, 3940), False, 'from algo.worker import Worker\n'), ((212, 224), 'maths.parser.quick_parse', 'parse', (['"""sum"""'], {}), "('sum')\n", (217, 224), True, 'from maths.parser import quick_parse as parse\n'), ((226, 236), 'maths.parser.quick... |
import csv
import os
from pprint import pprint
from types import SimpleNamespace
from tensorflow import keras
"""
import torch
import torch.nn.functional as F
import torch.optim as opt
from torch.utils.tensorboard import SummaryWriter
"""
from .models.senn import SENN, DiSENN
from .models.losses import *
from .utils... | [
"csv.DictWriter",
"os.path.exists",
"os.makedirs",
"types.SimpleNamespace",
"tensorflow.keras.optimizers.Adam",
"pprint.pprint"
] | [((1287, 1301), 'pprint.pprint', 'pprint', (['config'], {}), '(config)\n', (1293, 1301), False, 'from pprint import pprint\n'), ((1315, 1340), 'types.SimpleNamespace', 'SimpleNamespace', ([], {}), '(**config)\n', (1330, 1340), False, 'from types import SimpleNamespace\n'), ((3488, 3534), 'tensorflow.keras.optimizers.Ad... |
"""
This file is test file for agent 6,7 and 8.
"""
# Necessary imports
import time
import numpy as np
import multiprocessing
from datetime import datetime
import pickle
from constants import STARTING_POSITION_OF_AGENT, INF, PROBABILITY_OF_GRID, NUM_ROWS, NUM_COLS, NUM_ITERATIONS
from helpers.helper import generate_g... | [
"pickle.dump",
"helpers.helper.compute_explored_cells_from_path",
"numpy.average",
"helpers.helper.generate_grid_with_probability_p",
"multiprocessing.cpu_count",
"src.Agent6.Agent6",
"datetime.datetime.now",
"multiprocessing.Pool",
"helpers.helper.examine_and_propagate_probability",
"helpers.help... | [((543, 551), 'src.Agent6.Agent6', 'Agent6', ([], {}), '()\n', (549, 551), False, 'from src.Agent6 import Agent6\n'), ((3698, 3709), 'time.time', 'time.time', ([], {}), '()\n', (3707, 3709), False, 'import time\n'), ((3856, 3895), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {'processes': 'n_cores'}), '(process... |