code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from torch.utils.data import Sampler
import numpy as np
def get_chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
def flatten(l):
return [item for sublist in l for item in sublist]
class LengthSortSampler(Sampler):
def __init__(self, data_source, bs):
super().__init__(data_s... | [
"numpy.argsort",
"numpy.random.shuffle"
] | [((704, 733), 'numpy.random.shuffle', 'np.random.shuffle', (['chunk_inds'], {}), '(chunk_inds)\n', (721, 733), True, 'import numpy as np\n'), ((576, 595), 'numpy.argsort', 'np.argsort', (['lengths'], {}), '(lengths)\n', (586, 595), True, 'import numpy as np\n')] |
import math
import numpy as np
class Strategy:
"""Options strategy class.
Takes in a number of `StrategyLeg`'s (option contracts), and filters that determine
entry and exit conditions.
"""
def __init__(self, schema):
self.schema = schema
self.legs = []
self.conditions = []... | [
"numpy.sign"
] | [((2077, 2096), 'numpy.sign', 'np.sign', (['entry_cost'], {}), '(entry_cost)\n', (2084, 2096), True, 'import numpy as np\n')] |
"""
TODO: the code is take from Apache-2 Licensed NLTK: make sure we do this properly!
Copied over from nltk.tranlate.bleu_score. This code has two major changes:
- allows to turn off length/brevity penalty --- it has no sense for self-bleu,
- allows to use arithmetic instead of geometric mean
"""
impor... | [
"nltk.translate.bleu_score.SmoothingFunction",
"fractions.Fraction",
"math.log",
"collections.Counter",
"nltk.translate.bleu_score.brevity_penalty",
"nltk.translate.bleu_score.closest_ref_length",
"math.fsum",
"nltk.translate.bleu_score.modified_precision"
] | [((3419, 3428), 'collections.Counter', 'Counter', ([], {}), '()\n', (3426, 3428), False, 'from collections import Counter\n'), ((3507, 3516), 'collections.Counter', 'Counter', ([], {}), '()\n', (3514, 3516), False, 'from collections import Counter\n'), ((4490, 4529), 'nltk.translate.bleu_score.closest_ref_length', 'clo... |
from models.todo_ajax import TodoAjax
from web_framework import (
current_user,
html_response,
json_response,
)
from utils import log
def index(request):
u = current_user(request)
return html_response('todo_ajax_index.html')
def all(request):
todos = TodoAjax.all()
todos = [t.__dict__ f... | [
"utils.log",
"web_framework.current_user",
"models.todo_ajax.TodoAjax.all",
"web_framework.json_response",
"web_framework.html_response",
"models.todo_ajax.TodoAjax.add"
] | [((177, 198), 'web_framework.current_user', 'current_user', (['request'], {}), '(request)\n', (189, 198), False, 'from web_framework import current_user, html_response, json_response\n'), ((210, 247), 'web_framework.html_response', 'html_response', (['"""todo_ajax_index.html"""'], {}), "('todo_ajax_index.html')\n", (22... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import subprocess
def crunchyroll_name(anime_name, episode_number, resolution):
anime_name = str(anime_name).replace("039T", "'")
# rawName = str(animeName).title().strip().replace("Season ", "S") + " - " + \
# str(episode_number... | [
"subprocess.check_output"
] | [((617, 670), 'subprocess.check_output', 'subprocess.check_output', (["['getconf', 'PATH_MAX', '/']"], {}), "(['getconf', 'PATH_MAX', '/'])\n", (640, 670), False, 'import subprocess\n')] |
#!/usr/bin/env python3
#-*- coding=utf-8 -*-
## export phylogenetic data from UraLex basic vocabulary dataset
import sys
def checkPythonVersion():
if (sys.version_info[0] < 3):
print("Python 3 is needed to run this program.")
sys.exit(1)
checkPythonVersion()
import os
import io
import ar... | [
"exporter.setFormat",
"exporter.setMeaningList",
"exporter.export",
"exporter.setCharsets",
"argparse.ArgumentParser",
"reader.UraLexReader",
"os.path.isfile",
"exporter.setLanguageExcludeList",
"versions.getLatestVersion",
"sys.exit",
"exporter.UralexExporter"
] | [((600, 648), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'PARSER_DESC'}), '(description=PARSER_DESC)\n', (623, 648), False, 'import argparse\n'), ((2999, 3031), 'exporter.UralexExporter', 'exporter.UralexExporter', (['dataset'], {}), '(dataset)\n', (3022, 3031), False, 'import exporter\n... |
import clr
from PythonNetTest import Multiplier
def multiplyThese (a, b):
m = Multiplier()
return m.Multiply(a, b)
# print "3 * 5: " + str(multiplyThese(3.0, 5.0))
| [
"PythonNetTest.Multiplier"
] | [((81, 93), 'PythonNetTest.Multiplier', 'Multiplier', ([], {}), '()\n', (91, 93), False, 'from PythonNetTest import Multiplier\n')] |
import os
EXAMPLE_SVG_PATH = os.path.join(os.path.dirname(__file__), 'example.svg')
IDS_IN_EXAMPLE_SVG = {'red', 'yellow', 'blue', 'green'}
IDS_IN_EXAMPLE2_SVG = {'punainen', 'keltainen', 'sininen', 'vihrea'}
with open(EXAMPLE_SVG_PATH, 'rb') as infp:
EXAMPLE_SVG_DATA = infp.read()
EXAMPLE2_SVG_DATA = (
EXAM... | [
"os.path.dirname"
] | [((43, 68), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (58, 68), False, 'import os\n')] |
import deck_of_cards
from deck_of_cards import CountingSystemHiLo, DeckOfCards
import random
from time import sleep
from dataclasses import dataclass
import rich
from rich.console import Console
from rich.panel import Panel
from rich.markdown import Markdown
from rich.text import Text
from rich.layout import Layout
fro... | [
"random.sample",
"deck_of_cards.DeckOfCards",
"rich.live.Live",
"rich.panel.Panel",
"rich.layout.Layout",
"rich.text.Text",
"rich.console.Console",
"deck_of_cards.CountingSystemHiLo.count_cards"
] | [((396, 429), 'rich.console.Console', 'Console', ([], {'color_system': '"""truecolor"""'}), "(color_system='truecolor')\n", (403, 429), False, 'from rich.console import Console\n'), ((439, 447), 'rich.layout.Layout', 'Layout', ([], {}), '()\n', (445, 447), False, 'from rich.layout import Layout\n'), ((474, 495), 'rich.... |
from django.conf import settings
import requests
from argos.libs.discovery import Discovery
__author__ = 'mphilpot'
class OntologyClient(object):
def __init__(self, token, url=None):
if url is None:
discovery = Discovery()
self.url = discovery.get_url("ontology")
else:
... | [
"requests.post",
"argos.libs.discovery.Discovery",
"requests.get"
] | [((818, 943), 'requests.get', 'requests.get', (["('%s/ontologies/%s' % (self.url, domain))"], {'headers': 'headers', 'params': 'params', 'cert': 'self.cert', 'verify': 'self.verify'}), "('%s/ontologies/%s' % (self.url, domain), headers=headers,\n params=params, cert=self.cert, verify=self.verify)\n", (830, 943), Fal... |
#Imports
import pandas as pd
import pickle
from sklearn import datasets
def dataset():
iris_data = datasets.load_iris() # Loads the Iris Dataset
X = iris_data.data
y = iris_data.target
# Creating Dataframes
df_data = pd.DataFrame(X, columns=['sepal_length', 'sepal_width','petal_length','... | [
"sklearn.datasets.load_iris",
"pickle.dump",
"pandas.concat",
"pandas.DataFrame"
] | [((105, 125), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (123, 125), False, 'from sklearn import datasets\n'), ((249, 340), 'pandas.DataFrame', 'pd.DataFrame', (['X'], {'columns': "['sepal_length', 'sepal_width', 'petal_length', 'petal_width']"}), "(X, columns=['sepal_length', 'sepal_width', ... |
from Configurables import DaVinci
from GaudiConf import IOHelper
DaVinci().InputType = 'DST'
DaVinci().TupleFile = 'DVntuple.root'
DaVinci().PrintFreq = 1000
DaVinci().DataType = '2012'
DaVinci().Simulation = True
# Only ask for luminosity information when not using simulated data
DaVinci().Lumi = not DaVinci().Simula... | [
"Configurables.DaVinci",
"GaudiConf.IOHelper"
] | [((66, 75), 'Configurables.DaVinci', 'DaVinci', ([], {}), '()\n', (73, 75), False, 'from Configurables import DaVinci\n'), ((94, 103), 'Configurables.DaVinci', 'DaVinci', ([], {}), '()\n', (101, 103), False, 'from Configurables import DaVinci\n'), ((132, 141), 'Configurables.DaVinci', 'DaVinci', ([], {}), '()\n', (139,... |
import os, math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#from matplotlib.collections import PatchCollection
from sklearn import linear_model
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
from importlib import reload
# Constants
#files = ['tim... | [
"pandas.read_csv",
"numpy.log",
"math.sqrt",
"math.log",
"numpy.array",
"pandas.plotting.register_matplotlib_converters",
"math.exp",
"math.log10",
"pandas.to_datetime",
"numpy.arange",
"matplotlib.pyplot.close",
"pandas.DataFrame",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.gcf",
"... | [((231, 263), 'pandas.plotting.register_matplotlib_converters', 'register_matplotlib_converters', ([], {}), '()\n', (261, 263), False, 'from pandas.plotting import register_matplotlib_converters\n'), ((13594, 13643), 'sklearn.linear_model.LinearRegression', 'linear_model.LinearRegression', ([], {'fit_intercept': '(True... |
"""
Tests for the collectd/nginx monitor
"""
from contextlib import contextmanager
from functools import partial as p
import pytest
from tests.helpers.agent import Agent
from tests.helpers.assertions import has_datapoint_with_dim, tcp_socket_open
from tests.helpers.metadata import Metadata
from tests.helpers.util imp... | [
"tests.helpers.metadata.Metadata.from_package",
"tests.helpers.agent.Agent.run",
"tests.helpers.util.container_ip",
"tests.helpers.verify.verify",
"tests.helpers.assertions.has_datapoint_with_dim",
"functools.partial",
"tests.helpers.util.run_service"
] | [((505, 544), 'tests.helpers.metadata.Metadata.from_package', 'Metadata.from_package', (['"""collectd/nginx"""'], {}), "('collectd/nginx')\n", (526, 544), False, 'from tests.helpers.metadata import Metadata\n'), ((589, 609), 'tests.helpers.util.run_service', 'run_service', (['"""nginx"""'], {}), "('nginx')\n", (600, 60... |
import re
from django.urls import path
from render_static.tests.views import TestView
class Unrecognized:
regex = re.compile('Im not normal')
class NotAPattern:
pass
urlpatterns = [
path('test/simple/', TestView.as_view(), name='bad'),
NotAPattern()
]
urlpatterns[0].pattern = Unrecognized()
| [
"render_static.tests.views.TestView.as_view",
"re.compile"
] | [((121, 148), 're.compile', 're.compile', (['"""Im not normal"""'], {}), "('Im not normal')\n", (131, 148), False, 'import re\n'), ((222, 240), 'render_static.tests.views.TestView.as_view', 'TestView.as_view', ([], {}), '()\n', (238, 240), False, 'from render_static.tests.views import TestView\n')] |
from math import hypot
n, w, h = (int(x) for x in input().split())
def fits_in_box(nums: list[int]) -> None:
longest = hypot(w, h)
for num in nums:
print('DA') if num <= longest else print('NE')
fits_in_box(int(input()) for _ in range(n))
| [
"math.hypot"
] | [((126, 137), 'math.hypot', 'hypot', (['w', 'h'], {}), '(w, h)\n', (131, 137), False, 'from math import hypot\n')] |
"""Hook specifications and containers."""
import collections
import enum
from typing import Optional, Mapping, Any
import pluggy # type: ignore
from repobee_plug import log
hookspec = pluggy.HookspecMarker(__package__)
hookimpl = pluggy.HookimplMarker(__package__)
class Status(enum.Enum):
"""Status codes enu... | [
"collections.namedtuple",
"pluggy.HookimplMarker",
"repobee_plug.log.warning",
"pluggy.HookspecMarker"
] | [((189, 223), 'pluggy.HookspecMarker', 'pluggy.HookspecMarker', (['__package__'], {}), '(__package__)\n', (210, 223), False, 'import pluggy\n'), ((235, 269), 'pluggy.HookimplMarker', 'pluggy.HookimplMarker', (['__package__'], {}), '(__package__)\n', (256, 269), False, 'import pluggy\n'), ((657, 724), 'collections.named... |
import datetime
import logging
import fcntl
import importlib
import os
import pkgutil
import sys
import multiprocessing as mp
import queue
import signal
import scitag
import scitag.settings
import scitag.plugins
import scitag.backends
import scitag.stun.services
from scitag.config import config
log = logging.getLogg... | [
"logging.getLogger",
"signal.signal",
"sys.exit",
"multiprocessing.Event",
"scitag.config.config.keys",
"multiprocessing.Process",
"scitag.stun.services.get_ext_ip",
"os.path.dirname",
"datetime.datetime.now",
"scitag.config.config.get",
"fcntl.lockf",
"importlib.reload",
"multiprocessing.Qu... | [((305, 332), 'logging.getLogger', 'logging.getLogger', (['"""scitag"""'], {}), "('scitag')\n", (322, 332), False, 'import logging\n'), ((384, 413), 'fcntl.lockf', 'fcntl.lockf', (['f', 'fcntl.LOCK_UN'], {}), '(f, fcntl.LOCK_UN)\n', (395, 413), False, 'import fcntl\n'), ((539, 560), 'scitag.config.config.get', 'config.... |
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(name="py-json-serialize",
version="0.10.0",
description = "json serialize library for Python 2 and 3",
long_description = long_description,
long_description_content_type="text/markdown",
url="ht... | [
"setuptools.setup"
] | [((99, 867), 'setuptools.setup', 'setup', ([], {'name': '"""py-json-serialize"""', 'version': '"""0.10.0"""', 'description': '"""json serialize library for Python 2 and 3"""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'url': '"""https://github.com/randydu/py-json-se... |
""" Backtracking ref impls
see https://leetcode.com/problems/permutations/discuss/18284/Backtrack-Summary%3A-General-Solution-for-10-Questions!!!!!!!!-Python-(Combination-Sum-Subsets-Permutation-Palindrome)
"""
import random
def subsets(arr):
def backtrack(tmp, start, end):
ret.append(tmp[:])
f... | [
"itertools.combinations",
"itertools.permutations",
"random.randint"
] | [((1336, 1357), 'random.randint', 'random.randint', (['(-5)', '(5)'], {}), '(-5, 5)\n', (1350, 1357), False, 'import random\n'), ((1484, 1514), 'itertools.combinations', 'itertools.combinations', (['arr', '(2)'], {}), '(arr, 2)\n', (1506, 1514), False, 'import itertools\n'), ((1897, 1927), 'itertools.permutations', 'it... |
"""Add triples to the graph database
The UWKGM project
:copyright: (c) 2020 Ichise Laboratory at NII & AIST
:author: <NAME>
"""
from typing import Tuple
from dorest.managers.struct import generic
from dorest.managers.struct.decorators import endpoint
from database.database.graph import default_graph_uri
@endpoint... | [
"dorest.managers.struct.generic.resolve",
"dorest.managers.struct.decorators.endpoint"
] | [((312, 329), 'dorest.managers.struct.decorators.endpoint', 'endpoint', (["['GET']"], {}), "(['GET'])\n", (320, 329), False, 'from dorest.managers.struct.decorators import endpoint\n'), ((590, 613), 'dorest.managers.struct.generic.resolve', 'generic.resolve', (['single'], {}), '(single)\n', (605, 613), False, 'from dor... |
# -*- coding: utf-8 -*-
import swarmmaster
from nose.tools import *
import unittest
sc = swarmmaster.SwarmClient(1)
class TestSwarmClient(unittest.TestCase):
"""Basic test cases."""
def test_sc_id (self):
assert sc.id == 1
def test_sc_writebuffer (self):
sc.tx_buffer.clear()
s... | [
"unittest.main",
"swarmmaster.SwarmClient"
] | [((93, 119), 'swarmmaster.SwarmClient', 'swarmmaster.SwarmClient', (['(1)'], {}), '(1)\n', (116, 119), False, 'import swarmmaster\n'), ((2996, 3011), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3009, 3011), False, 'import unittest\n')] |
import sys
sys.path.append("..")
from FeatureBuilder import FeatureBuilder
from Utils.Libraries.wvlib_light.lwvlib import WV
import Utils.Settings as Settings
class WordVectorFeatureBuilder(FeatureBuilder):
def __init__(self, featureSet, style=None):
FeatureBuilder.__init__(self, featureSet, style)
... | [
"sys.path.append",
"Utils.Libraries.wvlib_light.lwvlib.WV.load",
"FeatureBuilder.FeatureBuilder.__init__"
] | [((11, 32), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (26, 32), False, 'import sys\n'), ((264, 312), 'FeatureBuilder.FeatureBuilder.__init__', 'FeatureBuilder.__init__', (['self', 'featureSet', 'style'], {}), '(self, featureSet, style)\n', (287, 312), False, 'from FeatureBuilder import Featu... |
from django.urls import include, path
from example.core import views as core_views
urlpatterns = [
path("", core_views.index_django),
path("jinja/", core_views.index_jinja),
path("__reload__/", include("django_browser_reload.urls")),
]
| [
"django.urls.path",
"django.urls.include"
] | [((105, 138), 'django.urls.path', 'path', (['""""""', 'core_views.index_django'], {}), "('', core_views.index_django)\n", (109, 138), False, 'from django.urls import include, path\n'), ((144, 182), 'django.urls.path', 'path', (['"""jinja/"""', 'core_views.index_jinja'], {}), "('jinja/', core_views.index_jinja)\n", (148... |
from random import randint
import pygame
pygame.init()
pygame.time.set_timer(pygame.USEREVENT, 3000)
W = 400
H = 400
WHITE = (255, 255, 255)
CARS = ('sp_humans/Walk0000.png', 'sp_humans/Walk0001.png', 'sp_humans/Walk0005.png')
CARS_SURF = [] # для хранения готовых машин-поверхностей
# надо установить видео режим д... | [
"pygame.init",
"pygame.time.delay",
"pygame.event.get",
"pygame.sprite.Group",
"pygame.display.set_mode",
"pygame.sprite.Sprite.__init__",
"pygame.image.load",
"pygame.time.set_timer",
"pygame.display.update",
"random.randint"
] | [((41, 54), 'pygame.init', 'pygame.init', ([], {}), '()\n', (52, 54), False, 'import pygame\n'), ((55, 100), 'pygame.time.set_timer', 'pygame.time.set_timer', (['pygame.USEREVENT', '(3000)'], {}), '(pygame.USEREVENT, 3000)\n', (76, 100), False, 'import pygame\n'), ((347, 378), 'pygame.display.set_mode', 'pygame.display... |
import click
from graffan.library.analysis.targets import analyze_targets
from graffan.library.models.analysis import AnalysedIteration
from graffan.utilities.forcebalance import (
extract_target_parameters,
load_fb_force_field,
)
@click.command("analyse", help="Analyzes the output of a ForceBalance iteratio... | [
"click.option",
"graffan.utilities.forcebalance.load_fb_force_field",
"graffan.utilities.forcebalance.extract_target_parameters",
"graffan.library.analysis.targets.analyze_targets",
"click.command"
] | [((243, 329), 'click.command', 'click.command', (['"""analyse"""'], {'help': '"""Analyzes the output of a ForceBalance iteration."""'}), "('analyse', help=\n 'Analyzes the output of a ForceBalance iteration.')\n", (256, 329), False, 'import click\n'), ((326, 432), 'click.option', 'click.option', (['"""--iteration"""... |
from test_poetry import wikipedia
def test_random_page_use_given_language(mock_requests_get):
wikipedia.random_page(language="de")
| [
"test_poetry.wikipedia.random_page"
] | [((100, 136), 'test_poetry.wikipedia.random_page', 'wikipedia.random_page', ([], {'language': '"""de"""'}), "(language='de')\n", (121, 136), False, 'from test_poetry import wikipedia\n')] |
import bleach
import bleach_whitelist
from django.conf import settings
from rest_framework.pagination import PageNumberPagination
def sanitize(string):
# bleach doesn't handle None so let's not pass it
if string and getattr(settings, "RESPONSE_SANITIZE_USER_INPUT", True):
return bleach.clean(
... | [
"bleach.clean"
] | [((298, 440), 'bleach.clean', 'bleach.clean', (['string'], {'tags': 'bleach_whitelist.markdown_tags', 'attributes': 'bleach_whitelist.markdown_attrs', 'styles': 'bleach_whitelist.all_styles'}), '(string, tags=bleach_whitelist.markdown_tags, attributes=\n bleach_whitelist.markdown_attrs, styles=bleach_whitelist.all_s... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.lost_letter import lost_letter
def test_lost_letter():
"""Test module lost_letter.py by downloading
lost_letter.csv and testing shape of
e... | [
"shutil.rmtree",
"tempfile.mkdtemp",
"observations.r.lost_letter.lost_letter"
] | [((381, 399), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (397, 399), False, 'import tempfile\n'), ((422, 444), 'observations.r.lost_letter.lost_letter', 'lost_letter', (['test_path'], {}), '(test_path)\n', (433, 444), False, 'from observations.r.lost_letter import lost_letter\n'), ((503, 527), 'shutil.rm... |
#importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
import os
import pickle
import glob
import sys
class ParameterFinder:
def __init__(self, image, _h_channel_low=0, _h_channel_high=255, _l_channel_low=0, _l_channel_high=255,
... | [
"cv2.imshow",
"cv2.destroyAllWindows",
"numpy.arctan2",
"numpy.max",
"cv2.waitKey",
"cv2.blur",
"glob.glob",
"pickle.load",
"cv2.cvtColor",
"cv2.createTrackbar",
"cv2.imread",
"cv2.namedWindow",
"numpy.set_printoptions",
"cv2.imwrite",
"pickle.dump",
"numpy.power",
"cv2.destroyWindow... | [((16370, 16391), 'os.chdir', 'os.chdir', (['WORKING_DIR'], {}), '(WORKING_DIR)\n', (16378, 16391), False, 'import os\n'), ((16442, 16462), 'cv2.imread', 'cv2.imread', (['FILENAME'], {}), '(FILENAME)\n', (16452, 16462), False, 'import cv2\n'), ((16743, 16767), 'cv2.imshow', 'cv2.imshow', (['"""input"""', 'IMG'], {}), "... |
#
# Unicode escape format setting dialog for the following plugins:
# Unicode escape
# Unicode unescape
#
# Copyright (c) 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:
... | [
"tkinter.Tk",
"tkinter.Label",
"tkinter.ttk.Combobox"
] | [((2079, 2091), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (2089, 2091), False, 'import tkinter\n'), ((2226, 2276), 'tkinter.Label', 'tkinter.Label', (['root'], {'text': '"""Unicode escape format:"""'}), "(root, text='Unicode escape format:')\n", (2239, 2276), False, 'import tkinter\n'), ((2359, 2413), 'tkinter.ttk.... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-09-06 02:34
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('item', '0018_auto_20160906_... | [
"django.db.models.OneToOneField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.db.migrations.AlterModelOptions",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((1701, 1786), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""achievement"""', 'options': "{'ordering': ['name']}"}), "(name='achievement', options={'ordering': ['name']}\n )\n", (1729, 1786), False, 'from django.db import migrations, models\n'), ((1826, 1900), 'django.d... |
import os
from aztk.models.plugins.plugin_configuration import PluginConfiguration, PluginPort, PluginTargetRole
from aztk.models.plugins.plugin_file import PluginFile
dir_path = os.path.dirname(os.path.realpath(__file__))
class SparkUIProxyPlugin(PluginConfiguration):
def __init__(self):
super().__init_... | [
"os.path.realpath",
"aztk.models.plugins.plugin_configuration.PluginPort",
"os.path.join"
] | [((196, 222), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (212, 222), False, 'import os\n'), ((377, 415), 'aztk.models.plugins.plugin_configuration.PluginPort', 'PluginPort', ([], {'internal': '(9999)', 'public': '(True)'}), '(internal=9999, public=True)\n', (387, 415), False, 'from aztk... |
#!/usr/bin/env python
#=========================================================================
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
# License (GPL) version 3, as described at www.opensource.org.
# Copyright (C)2021 <NAME> <<EMAIL>>
#========================================================... | [
"builtins.int",
"BedReader.BedReader.hashBySubstrate",
"GffTranscriptReader.GffTranscriptReader",
"ProgramName.get"
] | [((2050, 2062), 'builtins.int', 'int', (['maxDist'], {}), '(maxDist)\n', (2053, 2062), False, 'from builtins import bytes, dict, int, list, object, range, str, ascii, chr, hex, input, next, oct, open, pow, round, super, filter, map, zip\n'), ((2074, 2095), 'GffTranscriptReader.GffTranscriptReader', 'GffTranscriptReader... |
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2
import numpy as np
#setting up picamera
camera = PiCamera()
camera.resolution = (640, 480)
camera.framerate = 24
rawCapture = PiRGBArray(camera, size=(640, 480))
time.sleep(0.1)
template = cv2.imread("assets/stop_sign.jpg",... | [
"cv2.rectangle",
"picamera.PiCamera",
"time.sleep",
"cv2.imshow",
"cv2.minMaxLoc",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.cvtColor",
"picamera.array.PiRGBArray",
"cv2.resize",
"cv2.matchTemplate",
"cv2.imread"
] | [((143, 153), 'picamera.PiCamera', 'PiCamera', ([], {}), '()\n', (151, 153), False, 'from picamera import PiCamera\n'), ((221, 256), 'picamera.array.PiRGBArray', 'PiRGBArray', (['camera'], {'size': '(640, 480)'}), '(camera, size=(640, 480))\n', (231, 256), False, 'from picamera.array import PiRGBArray\n'), ((257, 272),... |
import torch
import random
import torch.nn as nn
from abc import abstractmethod
from abc import ABCMeta
from torch import Tensor
from typing import Any
from typing import Dict
from typing import List
from typing import Tuple
from typing import Optional
from .losses import GANLoss
from .losses import GANTarget
from .... | [
"torch.no_grad",
"random.random",
"torch.cuda.amp.autocast"
] | [((3117, 3165), 'torch.cuda.amp.autocast', 'torch.cuda.amp.autocast', ([], {'enabled': 'trainer.use_amp'}), '(enabled=trainer.use_amp)\n', (3140, 3165), False, 'import torch\n'), ((3595, 3610), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3608, 3610), False, 'import torch\n'), ((3699, 3747), 'torch.cuda.amp.aut... |
import os
from dynaconf import Dynaconf # type: ignore
current_directory = os.path.dirname(os.path.realpath(__file__))
settings = Dynaconf(
envvar_prefix="PROMED",
settings_files=[
f"{current_directory}/settings.toml",
],
)
settings["DEBUG"] = True if settings.LOG_LEVEL == "DEBUG" else False
... | [
"os.path.realpath",
"dynaconf.Dynaconf"
] | [((135, 227), 'dynaconf.Dynaconf', 'Dynaconf', ([], {'envvar_prefix': '"""PROMED"""', 'settings_files': "[f'{current_directory}/settings.toml']"}), "(envvar_prefix='PROMED', settings_files=[\n f'{current_directory}/settings.toml'])\n", (143, 227), False, 'from dynaconf import Dynaconf\n'), ((95, 121), 'os.path.realp... |
import os
import sys
import errno
import importlib
import contextlib
# print("prepare Avalon Max Pipeline")
from pyblish import api as pyblish
from . import lib, workio
from ..lib import logger
from .. import api, io, schema, Session
from ..vendor import six
from ..vendor.Qt import QtCore, QtWidgets
from ..pipeline i... | [
"MaxPlus.NotificationManager.Register",
"MaxPlus.MenuManager.MenuExists",
"importlib.import_module",
"MaxPlus.INode.GetINodeByName",
"MaxPlus.MenuBuilder",
"pyblish.api.util.publish",
"pyblish.api.deregister_host",
"MaxPlus.GetQMaxMainWindow",
"MaxPlus.INodeList",
"os.path.dirname",
"pyblish.api... | [((966, 988), 'MaxPlus.GetQMaxMainWindow', 'MP.GetQMaxMainWindow', ([], {}), '()\n', (986, 988), True, 'import MaxPlus as MP\n'), ((1419, 1448), 'pyblish.api.register_host', 'pyblish.register_host', (['"""max_"""'], {}), "('max_')\n", (1440, 1448), True, 'from pyblish import api as pyblish\n'), ((2085, 2130), 'MaxPlus.... |
# -*- coding: utf-8 -*-
import logging
import sys
import requests
import backoff
import quandl
from ingestionDao import IngestionDaoItf
class IngestorItf( object ):
"""Abstract base class for ingestors,
the class provides a prototypical get data, and no fringes."""
def get_data( self ):
raise ... | [
"logging.getLogger",
"quandl.get",
"backoff.on_exception"
] | [((867, 987), 'backoff.on_exception', 'backoff.on_exception', (['backoff.expo', '(requests.exceptions.Timeout, requests.exceptions.ConnectionError)'], {'max_tries': '(3)'}), '(backoff.expo, (requests.exceptions.Timeout, requests.\n exceptions.ConnectionError), max_tries=3)\n', (887, 987), False, 'import backoff\n'),... |
#!/usr/bin/env python3
# Copyright (c) 2021 <NAME>
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
"""This module does comparison of two images"""
import argparse
import os
from io import BytesIO
from typing import Union, List, Tuple
from pathlib import Path
import numpy a... | [
"PIL.Image.fromarray",
"PIL.Image.open",
"emrtd_face_access.print_to_sg.SetInterval",
"argparse.ArgumentParser",
"pathlib.Path",
"io.BytesIO",
"os.path.join",
"os.path.isfile",
"numpy.array",
"face_recognition.face_distance",
"face_recognition.face_encodings",
"cv2.cv2.dnn.blobFromImage",
"c... | [((455, 468), 'emrtd_face_access.print_to_sg.SetInterval', 'SetInterval', ([], {}), '()\n', (466, 468), False, 'from emrtd_face_access.print_to_sg import SetInterval\n'), ((1153, 1202), 'cv2.cv2.dnn.readNetFromCaffe', 'cv2.dnn.readNetFromCaffe', (['config_file', 'model_file'], {}), '(config_file, model_file)\n', (1177,... |
#!/usr/bin/env python
# Author: by <NAME> on March 15, 2020
# Date: March 15, 2020
from matplotlib import pyplot
from pydoc import pager
from time import sleep
import argparse
import datetime as dt
import json
import matplotlib
import pandas as pd
import requests
import seaborn
import sys
import yaml
def main():
... | [
"pandas.read_csv",
"argparse.ArgumentParser",
"datetime.datetime.strptime",
"matplotlib.pyplot.style.use",
"requests.get",
"pydoc.pager",
"time.sleep",
"yaml.safe_load",
"sys.exit",
"seaborn.barplot",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((4822, 4835), 'pydoc.pager', 'pager', (['string'], {}), '(string)\n', (4827, 4835), False, 'from pydoc import pager\n'), ((5589, 5636), 'requests.get', 'requests.get', (['url'], {'headers': "{'User-Agent': 'XY'}"}), "(url, headers={'User-Agent': 'XY'})\n", (5601, 5636), False, 'import requests\n'), ((6972, 7020), 're... |
import sys
class Debugger(object):
"""Display debugging messages if toggled"""
def __init__(self, boolean):
self.report = boolean
self.indent = 0
def say(self, msg, indent=0, end='\n'):
self.indent = indent or self.indent
if self.report:
indent = self.indent * '\... | [
"sys.stderr.write"
] | [((378, 402), 'sys.stderr.write', 'sys.stderr.write', (['fmtmsg'], {}), '(fmtmsg)\n', (394, 402), False, 'import sys\n')] |
import os
import pandas as pd
if __name__ == "__main__":
print("In what directory shall we parse?")
to_dir = input(">>> ")
for root, dirs, files in os.walk(os.getcwd() + "/" + to_dir, topdown=False):
operating_dir = root
if "fort.58" in str(root):
if "strip_hefe... | [
"os.path.getsize",
"os.listdir",
"os.getcwd",
"pandas.read_fwf",
"os.remove"
] | [((541, 566), 'os.listdir', 'os.listdir', (['operating_dir'], {}), '(operating_dir)\n', (551, 566), False, 'import os\n'), ((183, 194), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (192, 194), False, 'import os\n'), ((340, 365), 'os.listdir', 'os.listdir', (['operating_dir'], {}), '(operating_dir)\n', (350, 365), False,... |
import sys
from dvc.progress import progress
try:
# NOTE: in Python3 raw_input() was renamed to input()
input = raw_input
except NameError:
pass
class Prompt(object):
def __init__(self):
self.default = None
def prompt(self, msg, default=False): # pragma: no cover
if self.defaul... | [
"sys.stdout.isatty",
"getpass.getpass"
] | [((912, 932), 'getpass.getpass', 'getpass.getpass', (['msg'], {}), '(msg)\n', (927, 932), False, 'import getpass\n'), ((383, 402), 'sys.stdout.isatty', 'sys.stdout.isatty', ([], {}), '()\n', (400, 402), False, 'import sys\n'), ((729, 748), 'sys.stdout.isatty', 'sys.stdout.isatty', ([], {}), '()\n', (746, 748), False, '... |
from flask import Flask, render_template, request
from chatterbot import ChatBot
import pypyodbc as odbc
import re
app = Flask(__name__)
CRMFBot = ChatBot("Chatterbot", storage_adapter="chatterbot.storage.SQLStorageAdapter")
@app.route("/")
def home():
return render_template("index.html")
@app.route("/get")
def g... | [
"flask.render_template",
"flask.request.args.get",
"pypyodbc.connect",
"flask.Flask",
"chatterbot.ChatBot",
"re.findall"
] | [((122, 137), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (127, 137), False, 'from flask import Flask, render_template, request\n'), ((148, 225), 'chatterbot.ChatBot', 'ChatBot', (['"""Chatterbot"""'], {'storage_adapter': '"""chatterbot.storage.SQLStorageAdapter"""'}), "('Chatterbot', storage_adapter='c... |
import logging
from os import path
from sys import exit
from typing import Any, Dict, List, Optional, Tuple, Union
import coloredlogs
import httpx
import praw
from util import Utility
log: logging.Logger = logging.getLogger(__name__)
coloredlogs.install(level="INFO", fmt="[%(asctime)s] %(message)s", datefmt="%I:%M:%... | [
"logging.getLogger",
"util.Utility.ReadFile",
"coloredlogs.install",
"util.Utility.Quote",
"util.Utility.NowISO",
"os.path.isfile",
"praw.Reddit",
"util.Utility.WriteFile",
"sys.exit",
"httpx.post"
] | [((209, 236), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (226, 236), False, 'import logging\n'), ((237, 328), 'coloredlogs.install', 'coloredlogs.install', ([], {'level': '"""INFO"""', 'fmt': '"""[%(asctime)s] %(message)s"""', 'datefmt': '"""%I:%M:%S"""'}), "(level='INFO', fmt='[%(asc... |
# pylint: disable=C0103
# pylint: disable=unnecessary-lambda
"""
This module illustates the humble object principal
whereby the business logic is
seperated from the external interfaces.
class CalendarClockDevice
This class is an implementation of a Tango Device.
No business logic exists in this class.
class C... | [
"tango.server.device_property",
"tango.server.run",
"tango.server.command",
"tango.server.attribute"
] | [((7098, 7147), 'tango.server.device_property', 'device_property', ([], {'dtype': '"""str"""', 'default_value': '"""UTC"""'}), "(dtype='str', default_value='UTC')\n", (7113, 7147), False, 'from tango.server import attribute, command, device_property, run\n'), ((7865, 7924), 'tango.server.attribute', 'attribute', ([], {... |
"""運動学関係
2次のマクローリン展開
"""
import sympy as sy
from sympy import sqrt
import sumi_maclaurin_2.P_0 as P_0
import sumi_maclaurin_2.P_1 as P_1
import sumi_maclaurin_2.P_2 as P_2
import sumi_maclaurin_2.R_0_0 as R_0_0
import sumi_maclaurin_2.R_0_1 as R_0_1
import sumi_maclaurin_2.R_0_2 as R_0_2
import sumi_maclaurin_2.R_0... | [
"sumi_maclaurin_2.R_0_0.f",
"sumi_maclaurin_2.R_0_1.f",
"sympy.Matrix",
"sympy.MatrixSymbol",
"sumi_maclaurin_2.R_0_2.f",
"sumi_maclaurin_2.P_1.f",
"sumi_maclaurin_2.P_0.f",
"sumi_maclaurin_2.P_2.f",
"sympy.diff",
"sympy.zeros"
] | [((1980, 2016), 'sympy.MatrixSymbol', 'sy.MatrixSymbol', (['"""q_large"""', '(3 * N)', '(1)'], {}), "('q_large', 3 * N, 1)\n", (1995, 2016), True, 'import sympy as sy\n'), ((2068, 2108), 'sympy.MatrixSymbol', 'sy.MatrixSymbol', (['"""q_dot_large"""', '(3 * N)', '(1)'], {}), "('q_dot_large', 3 * N, 1)\n", (2083, 2108), ... |
from typing import NoReturn
from ...base import BaseEstimator
import numpy as np
from numpy.linalg import det, inv
from scipy.stats import multivariate_normal
class LDA(BaseEstimator):
"""
Linear Discriminant Analysis (LDA) classifier
Attributes
----------
self.classes_ : np.ndarray of shape (n_c... | [
"numpy.unique",
"scipy.stats.multivariate_normal.pdf",
"numpy.log",
"numpy.array",
"numpy.zeros",
"numpy.linalg.inv",
"numpy.outer"
] | [((1651, 1683), 'numpy.unique', 'np.unique', (['y'], {'return_counts': '(True)'}), '(y, return_counts=True)\n', (1660, 1683), True, 'import numpy as np\n'), ((2212, 2246), 'numpy.zeros', 'np.zeros', (['(X.shape[1], X.shape[1])'], {}), '((X.shape[1], X.shape[1]))\n', (2220, 2246), True, 'import numpy as np\n'), ((2491, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 1 08:04:50 2019
@author: alexandradarmon
"""
import random
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from punctuation.config import options
from punctuation.visualisation.heatmap_functions import heatmap, annotate_he... | [
"matplotlib.pyplot.hist",
"matplotlib.pyplot.ylabel",
"numpy.array",
"matplotlib.pyplot.axvline",
"numpy.arange",
"numpy.histogram",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"webcolors.hex_to_rgb",
"numpy.linspace",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.ylim",
"matplotl... | [((1343, 1356), 'webcolors.hex_to_rgb', 'hex_to_rgb', (['i'], {}), '(i)\n', (1353, 1356), False, 'from webcolors import hex_to_rgb\n'), ((2515, 2536), 'numpy.arange', 'np.arange', (['(0)', '(1)', '(0.01)'], {}), '(0, 1, 0.01)\n', (2524, 2536), True, 'import numpy as np\n'), ((3412, 3437), 'numpy.arange', 'np.arange', (... |
'''# *************************************************************
# 2018
# *************************************************************
#
# CLIENT
#
# *************************************************************'''
# Import function from socket module
#... | [
"socket",
"socket.send",
"socket.recv",
"sys.exit",
"socket.gethostname"
] | [((709, 729), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (727, 729), False, 'import socket\n'), ((476, 496), 'socket.recv', 'socket.recv', (['bufsize'], {}), '(bufsize)\n', (487, 496), False, 'import socket\n'), ((662, 680), 'socket.send', 'socket.send', (['coded'], {}), '(coded)\n', (673, 680), Fals... |
# Copyright (c) 2021, M20Zero and contributors
# For license information, please see license.txt
import frappe
from frappe.model.document import Document
class Membership(Document):
def on_submit(self):
self.make_invoice()
def make_invoice(self):
self.invoice_entry(self.name,self.member,self.... | [
"frappe.utils.nowdate"
] | [((533, 555), 'frappe.utils.nowdate', 'frappe.utils.nowdate', ([], {}), '()\n', (553, 555), False, 'import frappe\n')] |
import argparse
import os
import numpy as np
import torch
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
from torchvision import transforms
from torchvision import datasets
from utils.lib import *
from utils.pgd_attack import *
from models.resnet import ResNet
def test(model, data... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"torch.load",
"os.path.join",
"torch.Tensor",
"torch.utils.data.TensorDataset",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.RandomCrop",
"numpy.array",
"torchvision.datasets.CIFAR10",
"torch.sum",
"torch.u... | [((813, 913), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate augmented training dataset and extract features"""'}), "(description=\n 'Generate augmented training dataset and extract features')\n", (836, 913), False, 'import argparse\n'), ((1467, 1506), 'os.path.join', 'os.pat... |
"""
Functions for explaining classifiers that use tabular data (matrices).
"""
import collections
import json
import copy
import numpy as np
import sklearn
import sklearn.preprocessing
from . import lime_base
from . import explanation
class TableDomainMapper(explanation.DomainMapper):
"""Maps feature ids to names,... | [
"numpy.random.normal",
"numpy.mean",
"numpy.random.choice",
"numpy.searchsorted",
"numpy.std",
"json.dumps",
"numpy.min",
"numpy.max",
"sklearn.preprocessing.StandardScaler",
"numpy.sum",
"numpy.zeros",
"numpy.array",
"collections.defaultdict",
"numpy.exp",
"numpy.argsort",
"copy.deepc... | [((2727, 2750), 'json.dumps', 'json.dumps', (['show_scaled'], {}), '(show_scaled)\n', (2737, 2750), False, 'import json\n'), ((7312, 7365), 'sklearn.preprocessing.StandardScaler', 'sklearn.preprocessing.StandardScaler', ([], {'with_mean': '(False)'}), '(with_mean=False)\n', (7348, 7365), False, 'import sklearn\n'), ((1... |
#!/usr/bin/python
import math
import time
import sys
import fcntl
from AtlasI2C import (
AtlasI2C
)
TIMEOUT = 60
def get_devices():
device = AtlasI2C()
device_address_list = device.list_i2c_devices()
device_list = []
for i in device_address_list:
device.set_i2c_address(i)
try... | [
"math.isclose",
"AtlasI2C.AtlasI2C",
"time.sleep"
] | [((152, 162), 'AtlasI2C.AtlasI2C', 'AtlasI2C', ([], {}), '()\n', (160, 162), False, 'from AtlasI2C import AtlasI2C\n'), ((1216, 1229), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1226, 1229), False, 'import time\n'), ((1325, 1368), 'math.isclose', 'math.isclose', (['current', 'sensor'], {'abs_tol': '(0.02)'}),... |
import copy
import logging
import threading
import entities as e
import networking as n
import physics as p
logger = logging.getLogger(__name__)
lock = threading.RLock()
class World:
ADD = 0x1
DELETE = 0x2
DIFF = 0x3
@staticmethod
def dummy():
return World()
@staticmethod
def ... | [
"logging.getLogger",
"entities.Entity.diff",
"copy.deepcopy",
"physics.Vector.random",
"physics.Vector",
"yaml.dump",
"entities.Cube.dummy",
"threading.RLock",
"yaml.load",
"entities.Entity.new",
"networking.w_byte",
"entities.Sphere.dummy",
"physics.random.uniform",
"physics.random.seed",... | [((119, 146), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (136, 146), False, 'import logging\n'), ((155, 172), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (170, 172), False, 'import threading\n'), ((4512, 4531), 'physics.random.seed', 'p.random.seed', (['(1337)'], {}), '(13... |
from decimal import Decimal
from PyQt5 import QtCore
from PyQt5.QtWidgets import QTreeWidget, QTreeWidgetItem, QHeaderView
class PlayerCharacterInventoryTreeWidget(QTreeWidget):
def __init__(self, CharacterWindow):
super().__init__()
# Store Parameters
self.CharacterWindow = CharacterWin... | [
"decimal.Decimal"
] | [((1893, 1908), 'decimal.Decimal', 'Decimal', (['"""0.01"""'], {}), "('0.01')\n", (1900, 1908), False, 'from decimal import Decimal\n'), ((2066, 2081), 'decimal.Decimal', 'Decimal', (['"""0.01"""'], {}), "('0.01')\n", (2073, 2081), False, 'from decimal import Decimal\n')] |
#! /usr/bin/env python3
# coding: utf-8
from datetime import datetime
from django.contrib.auth.models import User
from ..models import Training, Exercise, MovementsPerExercise, Movement, MovementSettings, Equipment, MovementSettingsPerMovementsPerExercise
class TestDatabase:
@staticmethod
def create():
... | [
"datetime.datetime",
"django.contrib.auth.models.User.objects.create_superuser",
"django.contrib.auth.models.User.objects.create_user"
] | [((367, 463), 'django.contrib.auth.models.User.objects.create_superuser', 'User.objects.create_superuser', ([], {'username': '"""admin_user"""', 'password': '"""<PASSWORD>"""', 'email': '"""<EMAIL>"""'}), "(username='admin_user', password='<PASSWORD>',\n email='<EMAIL>')\n", (396, 463), False, 'from django.contrib.a... |
#Used to log errors to a text file
import sys
sys.stderr = open("errlog.txt", "w")
try:
#Imports several custom functions in different files
from authorization import get_service
from matches import clear_duplicate_events
from matches import get_GosuGamer_matches
from matches import add_events
... | [
"matches.get_GosuGamer_matches",
"tkinter.ttk.Progressbar",
"matches.clear_duplicate_events",
"authorization.get_service",
"matches.add_events",
"tkinter.Button",
"tkinter.StringVar",
"tkinter.Tk",
"tkinter.Label",
"tkinter.ttk.Combobox",
"os.system",
"tkinter.Frame",
"customwidget.Table",
... | [((4403, 4410), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (4408, 4410), True, 'import tkinter as tk\n'), ((420, 456), 'os.system', 'os.system', (['"""install_dependencies.py"""'], {}), "('install_dependencies.py')\n", (429, 456), False, 'import os\n'), ((1080, 1096), 'tkinter.Frame', 'tk.Frame', (['master'], {}), '(mast... |
import os
from shutil import SameFileError, copyfile
from urllib.request import Request, urlopen
import markdown
from bs4 import BeautifulSoup as BS
from blogger_cli.converter.extractor import (
extract_and_write_static,
extract_main_and_meta_from_md,
get_summary_limit,
extract_topic,
replace_ext,... | [
"markdown.markdown",
"os.path.exists",
"blogger_cli.converter.extractor.extract_topic",
"blogger_cli.converter.extractor.replace_ext",
"os.path.join",
"blogger_cli.converter.extractor.extract_and_write_static",
"blogger_cli.converter.extractor.extract_main_and_meta_from_md",
"os.path.dirname",
"shut... | [((775, 818), 'blogger_cli.converter.extractor.extract_main_and_meta_from_md', 'extract_main_and_meta_from_md', (['ctx', 'md_data'], {}), '(ctx, md_data)\n', (804, 818), False, 'from blogger_cli.converter.extractor import extract_and_write_static, extract_main_and_meta_from_md, get_summary_limit, extract_topic, replace... |
import datetime
import time
def main(j, args, params, tags, tasklet):
doc = args.doc
id = args.getTag('id')
width = args.getTag('width')
height = args.getTag('height')
result = "{{jgauge width:%(width)s id:%(id)s height:%(height)s val:%(last24h)s start:0 end:%(total)s}}"
now = datetime.datetime... | [
"datetime.datetime.now",
"datetime.datetime.fromtimestamp"
] | [((303, 326), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (324, 326), False, 'import datetime\n'), ((558, 614), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (["firsteco[0]['lasttime']"], {}), "(firsteco[0]['lasttime'])\n", (589, 614), False, 'import datetime\n')] |
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import resolve, reverse
from ..forms import SignUpForm
from ..views import SignUpView
class SignUpFormTest(TestCase):
def test_form_has_fields(self):
"""Tests if the form contains all the necessary fields"""
... | [
"django.urls.resolve",
"django.contrib.auth.models.User.objects.exists",
"django.urls.reverse"
] | [((574, 591), 'django.urls.reverse', 'reverse', (['"""signup"""'], {}), "('signup')\n", (581, 591), False, 'from django.urls import resolve, reverse\n'), ((923, 951), 'django.urls.resolve', 'resolve', (['"""/accounts/signup/"""'], {}), "('/accounts/signup/')\n", (930, 951), False, 'from django.urls import resolve, reve... |
import threading
import fb
import json
import time
import requests
from bs4 import BeautifulSoup as bs
webhook = "https://discordapp.com/api/webhooks/<KEY>"
# bradburne (website)
# alba (fb)
# inchdairnie (email subscription)
# delmor (fb)
# premier let (email sub)
# braemore
with open('config.json') as data:
da... | [
"json.loads",
"requests.post",
"time.sleep",
"requests.get",
"json.load",
"threading.Thread",
"time.time"
] | [((325, 340), 'json.load', 'json.load', (['data'], {}), '(data)\n', (334, 340), False, 'import json\n'), ((1065, 1088), 'json.loads', 'json.loads', (['trimmedEnds'], {}), '(trimmedEnds)\n', (1075, 1088), False, 'import json\n'), ((1295, 1432), 'requests.post', 'requests.post', (['webhook'], {'json': "{'username': 'New ... |
#!/usr/bin/env python
"""
Remove overlap (+ extra if desired) from tandem duplications
around scaffold gaps.
"""
import sys
from argparse import ArgumentParser
from collections import defaultdict, namedtuple
from sonLib.bioio import fastaRead, fastaWrite
FalseDup = namedtuple('FalseDup', ['gapStart', 'gapEnd', 'dupSi... | [
"sonLib.bioio.fastaRead",
"collections.namedtuple",
"collections.defaultdict",
"argparse.ArgumentParser"
] | [((268, 325), 'collections.namedtuple', 'namedtuple', (['"""FalseDup"""', "['gapStart', 'gapEnd', 'dupSize']"], {}), "('FalseDup', ['gapStart', 'gapEnd', 'dupSize'])\n", (278, 325), False, 'from collections import defaultdict, namedtuple\n'), ((437, 454), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list... |
#!/usr/bin/env python
#
# check-tms
#
# DESCRIPTION:
# Plugin to test the old, but still used, TMS map tile API for basic
# functionality. Loads several tiles around the given centerpoint
# and verifies that they loaded OK.
#
# OUTPUT:
# plain text describing the abnormal condition encountered
#
# PLATFORMS:
... | [
"lxml.etree.fromstring",
"requests.get"
] | [((800, 822), 'requests.get', 'requests.get', (['root_url'], {}), '(root_url)\n', (812, 822), False, 'import requests\n'), ((838, 868), 'lxml.etree.fromstring', 'etree.fromstring', (['resp.content'], {}), '(resp.content)\n', (854, 868), False, 'from lxml import etree\n'), ((2723, 2745), 'requests.get', 'requests.get', ... |
from __future__ import annotations
import aiohttp
import datetime
import logging
from typing import Optional
from quart import current_app as app
logger = logging.getLogger("tsundoku")
class KitsuManager:
API_URL = "https://kitsu.io/api/edge/anime"
HEADERS = {
"Accept": "application/vnd.api+json",
... | [
"logging.getLogger",
"aiohttp.ClientSession",
"quart.current_app.db_pool.acquire",
"datetime.datetime.utcnow"
] | [((158, 187), 'logging.getLogger', 'logging.getLogger', (['"""tsundoku"""'], {}), "('tsundoku')\n", (175, 187), False, 'import logging\n'), ((7644, 7670), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (7668, 7670), False, 'import datetime\n'), ((1174, 1216), 'aiohttp.ClientSession', 'aiohttp... |
# Copyright (c) 2018, <NAME> <<EMAIL>>
# 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 conditions and ... | [
"re.sub",
"docutils.nodes.Text",
"docutils.nodes.strong",
"re.match"
] | [((2653, 2683), 're.sub', 're.sub', (['"""^[\\\\S]*?> """', '""""""', 'base'], {}), "('^[\\\\S]*?> ', '', base)\n", (2659, 2683), False, 'import re\n'), ((2844, 2864), 'docutils.nodes.Text', 'nodes.Text', (["(l + '\\n')"], {}), "(l + '\\n')\n", (2854, 2864), False, 'from docutils import nodes\n'), ((2885, 2899), 'docut... |
from flask import Flask
from faker import Faker
from faker.providers import company, job, person, geo
app = Flask(__name__)
@app.route('/')
def story():
fake = Faker()
mystory = "<html><body><p>In a(n) " + fake.company()
mystory = mystory + " a young "
mystory = mystory + fake.language_name()
... | [
"faker.Faker",
"flask.Flask"
] | [((110, 125), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (115, 125), False, 'from flask import Flask\n'), ((169, 176), 'faker.Faker', 'Faker', ([], {}), '()\n', (174, 176), False, 'from faker import Faker\n')] |
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='ts-microsoftgraph-python',
version='0.2.2',
description='API wrapper for Microsoft Graph written in Python',
long_description=read('README.md'),
url='htt... | [
"os.path.dirname"
] | [((87, 112), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (102, 112), False, 'import os\n')] |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 3.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from datetime impo... | [
"os.path.join",
"datetime.timedelta",
"os.environ.get",
"pathlib.Path"
] | [((789, 817), 'os.environ.get', 'os.environ.get', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (803, 817), False, 'import os\n'), ((3970, 4001), 'os.environ.get', 'os.environ.get', (['"""EMAIL_BACKEND"""'], {}), "('EMAIL_BACKEND')\n", (3984, 4001), False, 'import os\n'), ((4335, 4363), 'os.environ.get', 'os.environ.... |
# _______________________________________________________________________________________
# ___________________________________Welcome_____________________________________________
# _______________________________________________________________________________________
import pygame # Importing modul... | [
"pygame.mixer.music.play",
"pygame.init",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.update",
"pygame.display.set_icon",
"math.sqrt",
"pygame.mixer.Sound",
"pygame.display.set_caption",
"pygame.image.load",
"pygame.font.Font",
"pygame.mixer.music.load",
"random.randint"
] | [((404, 417), 'pygame.init', 'pygame.init', ([], {}), '()\n', (415, 417), False, 'import pygame\n'), ((742, 785), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(screenx, screeny)'], {}), '((screenx, screeny))\n', (765, 785), False, 'import pygame\n'), ((831, 870), 'pygame.display.set_caption', 'pygame.displa... |
import os
from dotenv import load_dotenv
from telegram import Bot, Update, InlineKeyboardMarkup, InlineKeyboardButton, ParseMode, ReplyKeyboardMarkup
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext, CallbackQueryHandler, ConversationHandler
from telegram.utils.request import R... | [
"telegram.utils.request.Request",
"os.getenv",
"common.logger.warning",
"telegram.Bot",
"common.logger.info",
"telegram.ext.MessageHandler",
"telegram.ext.CallbackQueryHandler",
"telegram.ext.CommandHandler",
"telegram.ext.Updater"
] | [((844, 914), 'common.logger.warning', 'logger.warning', (['"""Update "%s" caused error "%s\\""""', 'update', 'context.error'], {}), '(\'Update "%s" caused error "%s"\', update, context.error)\n', (858, 914), False, 'from common import logger, conversations\n'), ((1652, 1713), 'common.logger.info', 'logger.info', (['""... |
import torch
import random
from .utils import get_conf, encode_conf
class Mutations():
def __init__(self, search_space, prob_mutation=0.8, prob_resize=0.05, prob_swap=0.04, exploration_vs_exploitation=0.5):
n = len(search_space)
# general vars
self.exploration_vs_exploitation = exploration_... | [
"torch.tensor",
"torch.rand",
"torch.ones"
] | [((465, 478), 'torch.ones', 'torch.ones', (['n'], {}), '(n)\n', (475, 478), False, 'import torch\n'), ((1580, 1593), 'torch.rand', 'torch.rand', (['(2)'], {}), '(2)\n', (1590, 1593), False, 'import torch\n'), ((2556, 2569), 'torch.rand', 'torch.rand', (['(3)'], {}), '(3)\n', (2566, 2569), False, 'import torch\n'), ((35... |
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='genlab',
version='0.3',
description='Create a lab report',
long_description=long_des... | [
"os.path.join",
"os.path.dirname",
"setuptools.setup"
] | [((207, 667), 'setuptools.setup', 'setup', ([], {'name': '"""genlab"""', 'version': '"""0.3"""', 'description': '"""Create a lab report"""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'url': '"""https://github.com/IceArrow256/genlab"""', 'author': '"""IceArrow256"""'... |
import re
import string
from datetime import datetime
import nltk
from nltk.corpus import stopwords
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from nltk.stem import PorterStemmer
from nltk.tokenize import word_tokenize
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
linkPattern = ... | [
"re.sub",
"vaderSentiment.vaderSentiment.SentimentIntensityAnalyzer"
] | [((447, 476), 're.sub', 're.sub', (['linkPattern', '""""""', 'text'], {}), "(linkPattern, '', text)\n", (453, 476), False, 'import re\n'), ((761, 786), 're.sub', 're.sub', (['"""\\\\W+ """', '""""""', 'text'], {}), "('\\\\W+ ', '', text)\n", (767, 786), False, 'import re\n'), ((885, 913), 'vaderSentiment.vaderSentiment... |
import os
import numpy as np
import pandas as pd
from databroker.assets.handlers_base import HandlerBase
class APBBinFileHandler(HandlerBase):
"Read electrometer *.bin files"
def __init__(self, fpath):
# It's a text config file, which we don't store in the resources yet, parsing for now
fpat... | [
"pandas.DataFrame",
"numpy.fromfile",
"os.path.splitext",
"numpy.zeros"
] | [((892, 926), 'numpy.fromfile', 'np.fromfile', (['fpath'], {'dtype': 'np.int32'}), '(fpath, dtype=np.int32)\n', (903, 926), True, 'import numpy as np\n'), ((1187, 1239), 'numpy.zeros', 'np.zeros', (['(raw_data.shape[0], raw_data.shape[1] - 1)'], {}), '((raw_data.shape[0], raw_data.shape[1] - 1))\n', (1195, 1239), True,... |
import numpy as np
import pandas as pd
import sys
import re
# question type definition
S = 0 # [S, col, corr [,rate]]
MS = 1 # [MS, [cols,..], [corr,..] [,rate]]
Num = 2 # [Num, [cols,..], [corr,..] [,rate]]
SS = 3 # [SS, [start,end], [corr,...] [,rate]]
# the list of question type and reference
# [type, column, ... | [
"pandas.read_csv",
"re.compile",
"argparse.ArgumentParser",
"pandas.merge",
"numpy.sort",
"numpy.zeros",
"pandas.concat"
] | [((9321, 9347), 're.compile', 're.compile', (['""".*学群(.+学類).*"""'], {}), "('.*学群(.+学類).*')\n", (9331, 9347), False, 'import re\n'), ((2271, 2309), 'numpy.zeros', 'np.zeros', (['num_squestions'], {'dtype': 'np.int'}), '(num_squestions, dtype=np.int)\n', (2279, 2309), True, 'import numpy as np\n'), ((4017, 4055), 'numpy... |
"""Algorithmic methods for the selection of common blocks in DiffBlocks
- select_common_blocks
-
- segments_difference
"""
import re
import tempfile
import subprocess
from collections import defaultdict, OrderedDict
import numpy as np
from ..biotools import reverse_complement, sequence_to_record
def format_seq... | [
"collections.OrderedDict",
"subprocess.Popen",
"tempfile.mktemp",
"collections.defaultdict",
"re.finditer"
] | [((3982, 4004), 'tempfile.mktemp', 'tempfile.mktemp', (['""".fa"""'], {}), "('.fa')\n", (3997, 4004), False, 'import tempfile\n'), ((4212, 4522), 'subprocess.Popen', 'subprocess.Popen', (["['blastn', '-query', temp_fasta_path, '-subject', temp_fasta_path,\n '-perc_identity', '100', '-dust', 'no', '-evalue', '1000000... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import logging
import linecache
import copy
from string import Template
logger = logging.getLogger(__name__)
class ExtraDict(dict):
""" Creates a dict-like structure where we can store the new values of
variables, while keeping the old (initial) ones as ... | [
"logging.getLogger",
"string.Template",
"time.time",
"copy.deepcopy"
] | [((137, 164), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (154, 164), False, 'import logging\n'), ((644, 664), 'copy.deepcopy', 'copy.deepcopy', (['extra'], {}), '(extra)\n', (657, 664), False, 'import copy\n'), ((1068, 1100), 'copy.deepcopy', 'copy.deepcopy', (['self._extrabackup'], {... |
"""Generalized Gell-Mann matrices."""
from typing import Union
from scipy import sparse
import numpy as np
def gen_gell_mann(
ind_1: int, ind_2: int, dim: int, is_sparse: bool = False
) -> Union[np.ndarray, sparse.lil_matrix]:
r"""
Produce a generalized Gell-Mann operator [WikGM2]_.
Construct a :cod... | [
"scipy.sparse.lil_matrix",
"numpy.sqrt",
"numpy.ones",
"scipy.sparse.eye",
"numpy.append",
"numpy.zeros"
] | [((2791, 2820), 'scipy.sparse.lil_matrix', 'sparse.lil_matrix', (['(dim, dim)'], {}), '((dim, dim))\n', (2808, 2820), False, 'from scipy import sparse\n'), ((2437, 2452), 'scipy.sparse.eye', 'sparse.eye', (['dim'], {}), '(dim)\n', (2447, 2452), False, 'from scipy import sparse\n'), ((2488, 2522), 'numpy.sqrt', 'np.sqrt... |
# This Python file uses the following encoding: utf-8
from unittest import TestCase
from pandocfilters import Para, Str, Space, Span, Strong, RawInline, Emph, Header, DefinitionList, Plain
import json
import pandoc_numbering
from helper import init, createMetaList, createMetaMap, createMetaInlines, createListStr, c... | [
"helper.createListStr",
"pandocfilters.Space",
"pandocfilters.Span",
"pandocfilters.Str",
"helper.init",
"pandocfilters.RawInline",
"helper.createMetaInlines",
"helper.createMetaBool",
"helper.createMetaString",
"pandoc_numbering.numbering"
] | [((1734, 1740), 'helper.init', 'init', ([], {}), '()\n', (1738, 1740), False, 'from helper import init, createMetaList, createMetaMap, createMetaInlines, createListStr, createMetaString, createMetaBool\n'), ((1910, 1916), 'helper.init', 'init', ([], {}), '()\n', (1914, 1916), False, 'from helper import init, createMeta... |
# Copyright (C) 2019-2021, TomTom (http://tomtom.com).
#
# 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 o... | [
"asciidoxy.generator.filters.InsertionFilter"
] | [((2268, 2301), 'asciidoxy.generator.filters.InsertionFilter', 'InsertionFilter', ([], {'members': '"""Public"""'}), "(members='Public')\n", (2283, 2301), False, 'from asciidoxy.generator.filters import InsertionFilter\n'), ((2486, 2517), 'asciidoxy.generator.filters.InsertionFilter', 'InsertionFilter', ([], {'members'... |
from django.contrib import admin
from .models import Student,Adult
class AdultAdmin(admin.ModelAdmin):
search_fields = ['user__first_name', 'user__last_name','ID_Number' ,'id','user__username',]
list_display = ('user','id','ID_Number',)
class StudentAdmin(admin.ModelAdmin):
search_fields = ['user__first_n... | [
"django.contrib.admin.site.register"
] | [((418, 456), 'django.contrib.admin.site.register', 'admin.site.register', (['Adult', 'AdultAdmin'], {}), '(Adult, AdultAdmin)\n', (437, 456), False, 'from django.contrib import admin\n'), ((456, 498), 'django.contrib.admin.site.register', 'admin.site.register', (['Student', 'StudentAdmin'], {}), '(Student, StudentAdmi... |
import gooeypie as gp
from random import choice
app = gp.GooeyPieApp('Label widget')
align_options = ['left', 'center', 'right']
label_text = ['A short label',
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut ' \
'labore et dolore magna aliqua. U... | [
"gooeypie.Button",
"gooeypie.Label",
"gooeypie.Input",
"gooeypie.Textbox",
"gooeypie.LabelContainer",
"gooeypie.Radiogroup",
"gooeypie.Container",
"gooeypie.GooeyPieApp"
] | [((55, 85), 'gooeypie.GooeyPieApp', 'gp.GooeyPieApp', (['"""Label widget"""'], {}), "('Label widget')\n", (69, 85), True, 'import gooeypie as gp\n'), ((1043, 1081), 'gooeypie.LabelContainer', 'gp.LabelContainer', (['app', '"""Label widget"""'], {}), "(app, 'Label widget')\n", (1060, 1081), True, 'import gooeypie as gp\... |
# -*- coding: utf-8 -*-
""" this program takes as input the number of a bus station,
access the mabat.mot.gov.il web site, and retrieves the
bus line number and arrival time for each bus reaching the station"""
""" code and advice used in this program:
מידע על תחנה:
אם תשלח בקשת POST לכתובת הזאת:http://mabat.mot.... | [
"time.ctime",
"json.loads",
"sqlite3.connect",
"time.sleep",
"os.popen",
"time.time"
] | [((1167, 1202), 'sqlite3.connect', 'sqlite3.connect', (['"""linesInfo.sqlite"""'], {}), "('linesInfo.sqlite')\n", (1182, 1202), False, 'import sqlite3\n'), ((2022, 2033), 'time.time', 'time.time', ([], {}), '()\n', (2031, 2033), False, 'import time\n'), ((2050, 2071), 'time.ctime', 'time.ctime', (['timeAsked'], {}), '(... |
import usefulFunctions
#importing the other file in a program
#all the functions, variables of this file can be used in this file
print(usefulFunctions.roll_dice())
print(usefulFunctions.friends) | [
"usefulFunctions.roll_dice"
] | [((141, 168), 'usefulFunctions.roll_dice', 'usefulFunctions.roll_dice', ([], {}), '()\n', (166, 168), False, 'import usefulFunctions\n')] |
from django.conf.urls import url
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
url(r'^$', views.DashboardView.as_view(), name='home'),
url(r'^sa_dashboard/$', views.study_adviser_view, name='sa_dashboard'),
url(r'^dashboard/$', views.Dashb... | [
"django.conf.urls.static.static",
"django.conf.urls.url"
] | [((713, 776), 'django.conf.urls.static.static', 'static', (['settings.STATIC_URL'], {'document_root': 'settings.STATIC_ROOT'}), '(settings.STATIC_URL, document_root=settings.STATIC_ROOT)\n', (719, 776), False, 'from django.conf.urls.static import static\n'), ((212, 281), 'django.conf.urls.url', 'url', (['"""^sa_dashboa... |
from django.contrib import admin
from .models import Ticket
def set_tickets_open(modeladmin, request, queryset):
rows_updated = queryset.update(status='Open')
if rows_updated == 1:
modeladmin.message_user(request, 'Ticket successfully set to open.')
else:
modeladmin.message_user(
... | [
"django.contrib.admin.site.register"
] | [((1720, 1761), 'django.contrib.admin.site.register', 'admin.site.register', (['Ticket', 'TicketsAdmin'], {}), '(Ticket, TicketsAdmin)\n', (1739, 1761), False, 'from django.contrib import admin\n')] |
import matplotlib.widgets as mwidgets
class Slider(mwidgets.Slider):
"""Slider widget to select a value from a floating point range.
Parameters
----------
ax : :class:`~matplotlib.axes.Axes` instance
The parent axes for the widget
value_range : (float, float)
(min, max) value allo... | [
"numpy.sin",
"matplotlib.widgets.AxesWidget.__init__",
"matplotlib.pyplot.subplot2grid",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((3822, 3866), 'matplotlib.pyplot.subplot2grid', 'plt.subplot2grid', (['(10, 1)', '(0, 0)'], {'rowspan': '(8)'}), '((10, 1), (0, 0), rowspan=8)\n', (3838, 3866), True, 'import matplotlib.pyplot as plt\n'), ((3883, 3916), 'matplotlib.pyplot.subplot2grid', 'plt.subplot2grid', (['(10, 1)', '(9, 0)'], {}), '((10, 1), (9, ... |
# -*- coding: utf-8 -*-
from __future__ import print_function,division,absolute_import
import logging
log = logging.getLogger(__name__) # __name__ is "foo.bar" here
import numpy as np
import numbers
np.seterr(all='ignore')
def findSlice(array,lims):
start = np.ravel(np.argwhere(array>lims[0]))[0]
stop = np.rav... | [
"logging.getLogger",
"numpy.abs",
"numpy.digitize",
"numpy.asarray",
"numpy.squeeze",
"numpy.argwhere",
"numpy.nanmax",
"numpy.argmin",
"dualtree.dualtree.baseline",
"numpy.gradient",
"numpy.seterr"
] | [((109, 136), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (126, 136), False, 'import logging\n'), ((202, 225), 'numpy.seterr', 'np.seterr', ([], {'all': '"""ignore"""'}), "(all='ignore')\n", (211, 225), True, 'import numpy as np\n'), ((815, 833), 'numpy.asarray', 'np.asarray', (['value... |
import re
import sublime
import sublime_plugin
from Default.paragraph import *
from Default.paragraph import OldWrapLinesCommand as WrapLinesCommand
from . import jtextwrap as textwrap
class WrapLinesJustifiedCommand(WrapLinesCommand):
''' Same as parent, except using jtextwrap. '''
def __init__(self, *args, *... | [
"sublime.Region"
] | [((2809, 2827), 'sublime.Region', 'sublime.Region', (['pt'], {}), '(pt)\n', (2823, 2827), False, 'import sublime\n')] |
#!/usr/bin/env python2.7
import itertools
import sys
import re
from Bio import SeqIO
def grouper(iterable, n, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
args = [iter(iterable)] * n
return itertools.izip_longest(*args, fillvalue=fil... | [
"re.sub",
"itertools.izip_longest",
"Bio.SeqIO.parse",
"Bio.SeqIO.write"
] | [((277, 327), 'itertools.izip_longest', 'itertools.izip_longest', (['*args'], {'fillvalue': 'fillvalue'}), '(*args, fillvalue=fillvalue)\n', (299, 327), False, 'import itertools\n'), ((471, 502), 'Bio.SeqIO.parse', 'SeqIO.parse', (['sys.stdin', '"""fastq"""'], {}), "(sys.stdin, 'fastq')\n", (482, 502), False, 'from Bio... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018-2021 Accenture Technology
#
# 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
#... | [
"mercury.system.dict_util.MultiLevelDict"
] | [((903, 919), 'mercury.system.dict_util.MultiLevelDict', 'MultiLevelDict', ([], {}), '()\n', (917, 919), False, 'from mercury.system.dict_util import MultiLevelDict\n'), ((1228, 1248), 'mercury.system.dict_util.MultiLevelDict', 'MultiLevelDict', (['data'], {}), '(data)\n', (1242, 1248), False, 'from mercury.system.dict... |
# -*- coding: utf-8 -*-
from copy import deepcopy
# Import all the packages
import torch
from torch.autograd import Variable
import torch.nn as nn
import numpy as np
import torch.optim as optim
import torch.nn.functional as f# create a dummy data
import matplotlib.pyplot as plt
import networkx as nx
i... | [
"torch.multinomial",
"sklearn.metrics.auc",
"torch.exp",
"torch.cdist",
"torch.no_grad",
"torch.nn.PairwiseDistance",
"torch.zeros",
"torch.randn",
"torch.ones"
] | [((1218, 1249), 'torch.nn.PairwiseDistance', 'nn.PairwiseDistance', ([], {'p': '(2)', 'eps': '(0)'}), '(p=2, eps=0)\n', (1237, 1249), True, 'import torch.nn as nn\n'), ((1282, 1324), 'torch.ones', 'torch.ones', (['self.input_size'], {'device': 'device'}), '(self.input_size, device=device)\n', (1292, 1324), False, 'impo... |
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
m_f = np.load('objects/simulation_model_freq.npy')[:50]
m_p = np.load('objects/simulation_model_power.npy')[:50]
eeg_f = np.load('objects/real_eeg_freq.npy0.npy')[:50]
eeg_p = np.load('objects/real_eeg_power_0.npy')[:50]
plt.figure()
plt.se... | [
"matplotlib.pyplot.semilogy",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"numpy.load",
"matplotlib.pyplot.show"
] | [((53, 76), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (66, 76), True, 'import matplotlib.pyplot as plt\n'), ((301, 313), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (311, 313), True, 'import matplotlib.pyplot as plt\n'), ((314, 362), 'matplotlib.pyplot.semil... |
"""Types to match those in the API."""
from typing import Any, Dict, NewType, NamedTuple
LabelName = NewType('LabelName', str)
StateMachine = NewType('StateMachine', str)
State = NewType('State', str)
Metadata = Dict[str, Any]
LabelRef = NamedTuple('LabelRef', [
('name', LabelName),
('state_machine', StateM... | [
"typing.NamedTuple",
"typing.NewType"
] | [((103, 128), 'typing.NewType', 'NewType', (['"""LabelName"""', 'str'], {}), "('LabelName', str)\n", (110, 128), False, 'from typing import Any, Dict, NewType, NamedTuple\n'), ((144, 172), 'typing.NewType', 'NewType', (['"""StateMachine"""', 'str'], {}), "('StateMachine', str)\n", (151, 172), False, 'from typing import... |
#pylint: skip-file
"""
NOTE: This is a local copy of the readers module, taken from the
support-tools/timeseries repository.
Provides functions to read FTDC data from either an FTDC file or from
a file containing serverStatus JSON documents, one per line. Each
reader takes a filename argument and returns a generator t... | [
"collections.OrderedDict",
"json.loads",
"os.listdir",
"os.path.join",
"os.path.isdir",
"collections.defaultdict",
"struct.Struct",
"zlib.decompress"
] | [((958, 977), 'struct.Struct', 'struct.Struct', (['"""<i"""'], {}), "('<i')\n", (971, 977), False, 'import struct\n'), ((988, 1007), 'struct.Struct', 'struct.Struct', (['"""<I"""'], {}), "('<I')\n", (1001, 1007), False, 'import struct\n'), ((1017, 1036), 'struct.Struct', 'struct.Struct', (['"""<q"""'], {}), "('<q')\n",... |
""" test automol.zmatrix
"""
import automol
from automol.zmatrix.newzmat._bimol_ts import hydrogen_abstraction
from automol.zmatrix.newzmat._bimol_ts import addition
from automol.zmatrix.newzmat._bimol_ts import insertion
from automol.zmatrix.newzmat._bimol_ts import substitution
from automol.zmatrix.newzmat._unimol_t... | [
"automol.zmatrix.newzmat._util.shifted_standard_zmas_graphs",
"automol.zmatrix.newzmat._unimol_ts.hydrogen_migration",
"automol.zmatrix.newzmat._unimol_ts.ring_forming_scission",
"automol.zmatrix.newzmat._bimol_ts.substitution",
"automol.smiles.inchi",
"automol.zmatrix.newzmat._bimol_ts.hydrogen_abstracti... | [((2592, 2650), 'automol.zmatrix.newzmat._util.shifted_standard_zmas_graphs', 'shifted_standard_zmas_graphs', (['rct_zmas'], {'remove_stereo': '(True)'}), '(rct_zmas, remove_stereo=True)\n', (2620, 2650), False, 'from automol.zmatrix.newzmat._util import shifted_standard_zmas_graphs\n'), ((2685, 2743), 'automol.zmatrix... |
import torch
import torch.nn as nn
from torch.nn import functional as F
from .cross_entropy_with_uncertainty import CrossEntropyLossWithUncertainty
from .focal_loss import FocalLoss
from dataset import LabelMapper
def get_loss_fn(loss_fn_name,
device,
model_uncertainty,
... | [
"torch.nn.BCEWithLogitsLoss",
"torch.ones",
"torch.cuda.FloatTensor",
"torch.nn.functional.binary_cross_entropy_with_logits"
] | [((2480, 2513), 'torch.cuda.FloatTensor', 'torch.cuda.FloatTensor', (['p_weights'], {}), '(p_weights)\n', (2502, 2513), False, 'import torch\n'), ((2534, 2567), 'torch.cuda.FloatTensor', 'torch.cuda.FloatTensor', (['n_weights'], {}), '(n_weights)\n', (2556, 2567), False, 'import torch\n'), ((2907, 2992), 'torch.nn.func... |
# coding=utf-8
'''
accuracy:98%
'''
import tensorflow as tf
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
initial = tf.constant(0.1, shape=shape)
return tf.Variable(initial)
def conv2d(x, W):
return tf.nn.con... | [
"tensorflow.nn.conv2d",
"tensorflow.nn.max_pool",
"tensorflow.nn.bias_add",
"tensorflow.Variable",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.nn.l2_loss",
"tensorflow.global_variables_initializer",
"tensorflow.argmax",
"tensorflow.nn.lrn",
"tensorflow.nn.dropout",
"tensorflow.... | [((868, 926), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, WIDTH, HEIGHT, CHANNEL]'], {}), '(tf.float32, [None, WIDTH, HEIGHT, CHANNEL])\n', (882, 926), True, 'import tensorflow as tf\n'), ((931, 973), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, Y_SIZE]'], {}), '(tf.float3... |