code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from setuptools import setup, find_packages
setup(
name = "renewables_ninja_client",
version = "0.1.0",
description = ("Client for Renewables Ninja API."),
author = ["<NAME>"],
packages = find_packages(exclude=[
"docs", "tests", "examples",
"sandbox", "scripts"]),
install_requi... | [
"setuptools.find_packages"
] | [((209, 283), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['docs', 'tests', 'examples', 'sandbox', 'scripts']"}), "(exclude=['docs', 'tests', 'examples', 'sandbox', 'scripts'])\n", (222, 283), False, 'from setuptools import setup, find_packages\n')] |
# -*- coding: utf-8 -*-
# © 2016 <NAME>, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# #############################################################################
#
# <NAME> Sigep WEB
# Copyright (C) 2015 KMEE (http://www.kmee.com.br)
# @author: <NAME> <<EMAIL>>
# @auth... | [
"pysigep.utils._valida",
"PIL.Image.new",
"pysigep.send",
"os.path.join",
"io.BytesIO",
"os.path.dirname",
"pysigep._url",
"textwrap.wrap",
"base64.decodestring",
"io.StringIO",
"PIL.ImageDraw.ImageDraw"
] | [((1357, 1382), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1372, 1382), False, 'import os\n'), ((1396, 1442), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""data/fonts/arial.ttf"""'], {}), "(BASE_DIR, 'data/fonts/arial.ttf')\n", (1408, 1442), False, 'import os\n'), ((1458, 1512), 'os.... |
#*
#* Copyright (C) 2017-2019 Alibaba Group Holding Limited
#*
#* 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 ... | [
"os.path.join",
"os.path.realpath",
"onnx.TensorProto",
"numpy.testing.assert_almost_equal",
"onnx.load",
"onnx.numpy_helper.to_array"
] | [((831, 857), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (847, 857), False, 'import os\n'), ((880, 912), 'os.path.join', 'os.path.join', (['dir_path', '"""test_*"""'], {}), "(dir_path, 'test_*')\n", (892, 912), False, 'import os\n'), ((1054, 1079), 'onnx.load', 'onnx.load', (['model_pat... |
import sys, os
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.keras.callbacks import Callback, ReduceLROnPlateau, TerminateOnNaN, ModelCheckpoint
import tensorflow.keras.backend as K
import tensorflow as tf
import time
###### Callbacks
# Create a callback to compute time spent between 10th and 110t... | [
"time.time"
] | [((621, 632), 'time.time', 'time.time', ([], {}), '()\n', (630, 632), False, 'import time\n'), ((728, 739), 'time.time', 'time.time', ([], {}), '()\n', (737, 739), False, 'import time\n')] |
"""Unit tests for the metrics module."""
import pytest
from forest import metrics
def test_counter():
"""Test counter."""
counter = metrics.Counter()
counter.increase()
assert counter.count == 1
counter.increase(10)
assert counter.count == 11
counter.decrease()
assert c... | [
"forest.metrics.Histogram",
"forest.metrics.MetricRegistry",
"pytest.approx",
"forest.metrics.Counter"
] | [((143, 160), 'forest.metrics.Counter', 'metrics.Counter', ([], {}), '()\n', (158, 160), False, 'from forest import metrics\n'), ((469, 488), 'forest.metrics.Histogram', 'metrics.Histogram', ([], {}), '()\n', (486, 488), False, 'from forest import metrics\n'), ((1099, 1116), 'forest.metrics.Counter', 'metrics.Counter',... |
import importlib
import pytest
import yaml
import appmap._implementation
from appmap._implementation.env import Env
from appmap._implementation.recording import Recorder
def _data_dir(pytestconfig):
return pytestconfig.rootpath / 'appmap' / 'test' / 'data'
@pytest.fixture(name='data_dir')
def fixture_data_dir(py... | [
"pytest.fixture",
"appmap._implementation.env.Env.current.set",
"appmap._implementation.recording.Recorder",
"importlib.reload"
] | [((265, 296), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""data_dir"""'}), "(name='data_dir')\n", (279, 296), False, 'import pytest\n'), ((370, 406), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""with_data_dir"""'}), "(name='with_data_dir')\n", (384, 406), False, 'import pytest\n'), ((560, 570), 'appma... |
"""
animation.py
This script is used to procduce animations of population behaviour
over a range of changing conditions. For example, if we wanted to
see how a population would change as light was elevated and wind
kept constant, we could produce the animation and watch the
general trend. This was mostly useful for vi... | [
"numpy.radians",
"util.treatment.Treatment",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.clf",
"os.getcwd",
"os.chdir",
"matplotlib.pyplot.subplot",
"numpy.linspace",
"scipy.special.i0",
"numpy.cos",
"matplotlib.pyplot.tight_layout",
"numpy.degrees",
"util.mode... | [((1259, 1277), 'util.models.ReliabilityModel', 'ReliabilityModel', ([], {}), '()\n', (1275, 1277), False, 'from util.models import ReliabilityModel\n'), ((1333, 1355), 'os.chdir', 'os.chdir', (['"""frames/BWS"""'], {}), "('frames/BWS')\n", (1341, 1355), False, 'import os\n'), ((1651, 1668), 'numpy.radians', 'np.radian... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"pulumi.InvokeOptions",
"pulumi.runtime.invoke"
] | [((4180, 4215), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""compartmentId"""'}), "(name='compartmentId')\n", (4193, 4215), False, 'import pulumi\n'), ((4518, 4552), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""endpointType"""'}), "(name='endpointType')\n", (4531, 4552), False, 'import pulumi\n'), ((4764,... |
import struct
import scipy.io.wavfile as wf
import numpy
import pydub
# for i in range(wave_file.getnframes()):
# # read a single frame and advance to next frame
# current_frame = wave_file.readframes(1)
#
# # check for silence
# silent = True
# # wave frame samples are stored in little endian**... | [
"pyAudioAnalysis.audioSegmentation.mtFileClassification"
] | [((1079, 1180), 'pyAudioAnalysis.audioSegmentation.mtFileClassification', 'aS.mtFileClassification', (['"""data/scottish.wav"""', '"""data/svmSM"""', '"""svm"""', '(True)', '"""data/scottish.segments"""'], {}), "('data/scottish.wav', 'data/svmSM', 'svm', True,\n 'data/scottish.segments')\n", (1102, 1180), True, 'fro... |
import os
"""
# If you have multi-gpu, designate the number of GPU to use.
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "6"
"""
import argparse
import logging
from tqdm import tqdm # progress bar
import numpy as np
import matplotlib.pyplot as plt
from keras import optimizers
from... | [
"matplotlib.pyplot.imshow",
"keras.optimizers.Adam",
"os.listdir",
"segmentation_models.utils.set_trainable",
"argparse.ArgumentParser",
"keras.callbacks.ModelCheckpoint",
"keras.callbacks.ReduceLROnPlateau",
"tqdm.tqdm",
"os.path.join",
"logging.info",
"os.path.isdir",
"dataset.DataGenerator"... | [((3351, 3367), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(131)'], {}), '(131)\n', (3362, 3367), True, 'import matplotlib.pyplot as plt\n'), ((3372, 3391), 'matplotlib.pyplot.imshow', 'plt.imshow', (['imgs[0]'], {}), '(imgs[0])\n', (3382, 3391), True, 'import matplotlib.pyplot as plt\n'), ((3396, 3412), 'matplotli... |
from fastapi.security.api_key import APIKeyCookie, APIKeyHeader
API_KEY_NAME = "api_key"
cookie_scheme = APIKeyCookie(name="bgm-tv-auto-tracker", auto_error=False)
API_KEY_HEADER = APIKeyHeader(name="api-key", auto_error=False)
API_KEY_COOKIES = APIKeyCookie(name="api-key", auto_error=False)
| [
"fastapi.security.api_key.APIKeyCookie",
"fastapi.security.api_key.APIKeyHeader"
] | [((107, 165), 'fastapi.security.api_key.APIKeyCookie', 'APIKeyCookie', ([], {'name': '"""bgm-tv-auto-tracker"""', 'auto_error': '(False)'}), "(name='bgm-tv-auto-tracker', auto_error=False)\n", (119, 165), False, 'from fastapi.security.api_key import APIKeyCookie, APIKeyHeader\n'), ((183, 229), 'fastapi.security.api_key... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.labour import labour
def test_labour():
"""Test module labour.py by downloading
labour.csv and testing shape of
extracted data has 569 row... | [
"observations.r.labour.labour",
"tempfile.mkdtemp",
"shutil.rmtree"
] | [((356, 374), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (372, 374), False, 'import tempfile\n'), ((397, 414), 'observations.r.labour.labour', 'labour', (['test_path'], {}), '(test_path)\n', (403, 414), False, 'from observations.r.labour import labour\n'), ((473, 497), 'shutil.rmtree', 'shutil.rmtree', (... |
## Data Loader: TE-CCA zT Dataset
# <NAME> (<EMAIL>) 2021-03-12
#
from citrination_client import CitrinationClient, PifSystemReturningQuery
from citrination_client import DataQuery, DatasetQuery, Filter
from matminer.featurizers.base import MultipleFeaturizer
from matminer.featurizers import composition as cf
from pyma... | [
"matminer.featurizers.composition.ValenceOrbital",
"pandas.read_csv",
"citrination_client.CitrinationClient",
"sl_utils.setResDir",
"numpy.array",
"pandas.DataFrame",
"matminer.featurizers.composition.IonProperty",
"matminer.featurizers.composition.Stoichiometry",
"pymatgen.Composition",
"pandas.c... | [((764, 775), 'sl_utils.setResDir', 'setResDir', ([], {}), '()\n', (773, 775), False, 'from sl_utils import pifs2df, setResDir\n'), ((940, 962), 'numpy.array', 'np.array', (['[+1, -1, -1]'], {}), '([+1, -1, -1])\n', (948, 962), True, 'import numpy as np\n'), ((678, 692), 'pymatgen.Composition', 'Composition', (['c'], {... |
import requests
import json
from datetime import datetime
headers = {"Content-type": "application/json", "Accept": "text/plain"}
def addUser():
url = "http://10.194.223.134:5000/add_user"
data = {"username": "test_user"}
requests.post(url, data=json.dumps(data), headers=headers)
def addMessage():
url... | [
"datetime.datetime.now",
"json.dumps"
] | [((259, 275), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (269, 275), False, 'import json\n'), ((449, 463), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (461, 463), False, 'from datetime import datetime\n'), ((498, 514), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (508, 514), False... |
import unittest
from context import html2md
from assertions import assertEq
__author__ = 'alex'
class SpecialListsTest(unittest.TestCase):
def test_text_and_paragraph(self):
in_html = '''<ul>
<li>item 1</li>
<li>item 2
<p>item 2 paragraph</p>
<p>item 2 item 2</p>
</li>
<li>item 3</li>
</ul>'''
... | [
"unittest.main",
"context.html2md.html2md",
"unittest.TestLoader"
] | [((2488, 2503), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2501, 2503), False, 'import unittest\n'), ((435, 459), 'context.html2md.html2md', 'html2md.html2md', (['in_html'], {}), '(in_html)\n', (450, 459), False, 'from context import html2md\n'), ((775, 799), 'context.html2md.html2md', 'html2md.html2md', (['i... |
import math
import numpy as np
from pymoo.model.algorithm import Algorithm
from pymoo.model.duplicate import DefaultDuplicateElimination
from pymoo.model.individual import Individual
from pymoo.model.population import Population
class GeneticAlgorithm(Algorithm):
def __init__(self,
pop_size,
... | [
"pymoo.model.duplicate.DefaultDuplicateElimination",
"pymoo.model.individual.Individual",
"pymoo.model.population.Population"
] | [((530, 559), 'pymoo.model.duplicate.DefaultDuplicateElimination', 'DefaultDuplicateElimination', ([], {}), '()\n', (557, 559), False, 'from pymoo.model.duplicate import DefaultDuplicateElimination\n'), ((619, 631), 'pymoo.model.individual.Individual', 'Individual', ([], {}), '()\n', (629, 631), False, 'from pymoo.mode... |
#!/usr/local/bin/python3
print("send 3 non-overlapping ping fragments in all possible orders")
# |----|
# |----|
# |----|
import os
from addr import *
from scapy.all import *
permute=[]
permute.append([0,1,2])
permute.append([0,2,1])
permute.append([1,0,2])
permute.append([2,0,1])
permute.append([1,2... | [
"os.fork",
"os._exit",
"os.getpid"
] | [((354, 365), 'os.getpid', 'os.getpid', ([], {}), '()\n', (363, 365), False, 'import os\n'), ((975, 984), 'os.fork', 'os.fork', ([], {}), '()\n', (982, 984), False, 'import os\n'), ((1038, 1049), 'os._exit', 'os._exit', (['(0)'], {}), '(0)\n', (1046, 1049), False, 'import os\n')] |
from rimu import lineblocks, io, api
from typing import Dict
def test_render():
tests: Dict[str, str] = {
r'# foo': r'<h1>foo</h1>',
r'// foo': r'',
r'<image:foo|bar>': r'<img src="foo" alt="bar">',
r'<<#foo>>': r'<div id="foo"></div>',
r'.class #id "css"': r'',
r".... | [
"rimu.io.Writer",
"rimu.io.Reader",
"rimu.api.init",
"rimu.lineblocks.render"
] | [((493, 503), 'rimu.api.init', 'api.init', ([], {}), '()\n', (501, 503), False, 'from rimu import lineblocks, io, api\n'), ((552, 564), 'rimu.io.Reader', 'io.Reader', (['k'], {}), '(k)\n', (561, 564), False, 'from rimu import lineblocks, io, api\n'), ((582, 593), 'rimu.io.Writer', 'io.Writer', ([], {}), '()\n', (591, 5... |
import vcr
tap_vcr = vcr.VCR(
serializer='yaml',
cassette_library_dir='tests/fixtures/vcr_cassettes',
record_mode='new_episodes',
match_on=['uri', 'method'],
)
| [
"vcr.VCR"
] | [((22, 167), 'vcr.VCR', 'vcr.VCR', ([], {'serializer': '"""yaml"""', 'cassette_library_dir': '"""tests/fixtures/vcr_cassettes"""', 'record_mode': '"""new_episodes"""', 'match_on': "['uri', 'method']"}), "(serializer='yaml', cassette_library_dir=\n 'tests/fixtures/vcr_cassettes', record_mode='new_episodes', match_on=... |
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append("./../")
from swarm import Bird
class GraphMaker():
"""
"""
def __init__(self, env , birds, FIELD_SIZE ):
self.env= env
fig, ax = plt.subplots()
self.fig=fig
self.ax=ax
self.birds=birds
... | [
"matplotlib.pyplot.draw",
"matplotlib.pyplot.title",
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"sys.path.append",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.lege... | [((62, 86), 'sys.path.append', 'sys.path.append', (['"""./../"""'], {}), "('./../')\n", (77, 86), False, 'import sys\n'), ((2786, 2828), 'matplotlib.pyplot.scatter', 'plt.scatter', (['*locations'], {'color': 'colors', 's': '(5)'}), '(*locations, color=colors, s=5)\n', (2797, 2828), True, 'import matplotlib.pyplot as pl... |
#!/usr/bin/python
"""
FAOSTAT:
-------
Reads FAOSTAT JSON and creates datasets.
"""
import logging
from datetime import datetime, timedelta
from os import remove, rename
from os.path import basename, exists, getctime, join
from urllib.parse import urlsplit
from zipfile import ZipFile
from hdx.data.dataset import Da... | [
"logging.getLogger",
"os.path.exists",
"zipfile.ZipFile",
"hdx.data.showcase.Showcase",
"urllib.parse.urlsplit",
"os.rename",
"os.path.getctime",
"os.path.join",
"hdx.location.country.Country.get_country_name_from_iso3",
"hdx.data.dataset.Dataset",
"os.remove",
"datetime.datetime.now",
"date... | [((593, 620), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (610, 620), False, 'import logging\n'), ((5366, 5415), 'hdx.data.dataset.Dataset', 'Dataset', (["{'name': slugified_name, 'title': title}"], {}), "({'name': slugified_name, 'title': title})\n", (5373, 5415), False, 'from hdx.dat... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from time import timezone
from django.db import models
# Create your models here.
class UserInfo(models.Model):
user= models.CharField(max_length = 30)
pwd = models.CharField(max_length = 30)
# class Publisher(models.Model):
# name = models... | [
"django.db.models.CharField"
] | [((191, 222), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (207, 222), False, 'from django.db import models\n'), ((233, 264), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (249, 264), False, 'from django.db im... |
from hwt.synthesizer.unit import Unit
from hwt.interfaces.std import VectSignal
from hwt.hdl.types.struct import HStruct
from hwt.interfaces.utils import addClkRstn
class PrivateSignalsOfStructType(Unit):
def _declr(self):
addClkRstn(self)
self.a = VectSignal(8)
self.b = VectSignal(8)._m(... | [
"hwt.interfaces.std.VectSignal",
"hwt.synthesizer.utils.to_rtl_str",
"hwt.interfaces.utils.addClkRstn",
"hwt.hdl.types.struct.HStruct"
] | [((238, 254), 'hwt.interfaces.utils.addClkRstn', 'addClkRstn', (['self'], {}), '(self)\n', (248, 254), False, 'from hwt.interfaces.utils import addClkRstn\n'), ((272, 285), 'hwt.interfaces.std.VectSignal', 'VectSignal', (['(8)'], {}), '(8)\n', (282, 285), False, 'from hwt.interfaces.std import VectSignal\n'), ((340, 35... |
import json
import re
from urllib.parse import urljoin
import scrapy
from ponnobot.items import ProductItem
class DarazSpider(scrapy.Spider):
name = "daraz"
allowed_domains = ['daraz.com.bd']
BASE_URL = 'https://www.daraz.com.bd'
# HEADERS = {
# 'authority': 'my.daraz.com.bd',
# 'p... | [
"scrapy.Request",
"ponnobot.items.ProductItem",
"urllib.parse.urljoin",
"re.compile"
] | [((3268, 3281), 'ponnobot.items.ProductItem', 'ProductItem', ([], {}), '()\n', (3279, 3281), False, 'from ponnobot.items import ProductItem\n'), ((1886, 1946), 'scrapy.Request', 'scrapy.Request', ([], {'url': 'self.BASE_URL', 'callback': 'self.begin_parse'}), '(url=self.BASE_URL, callback=self.begin_parse)\n', (1900, 1... |
from gkdtex.wrap import parse
from gkdtex.interpreter import Interpreter, CBVFunction
from gkdtex.developer_utilities import *
import sys
src = r"""
\newcommand{\GKDCreateId}{\input{|"gkdmgr --op uuid --rt A"}}
\makeatletter
\newcommand*\GKDNewTemp[2]{
\@ifundefined{GKDTemp#1}{
\expandafter\newcommand\csname G... | [
"gkdtex.interpreter.Interpreter",
"gkdtex.wrap.parse"
] | [((1260, 1288), 'gkdtex.wrap.parse', 'parse', (['"""$ #\\\\1^{ #\\\\1#1 } $"""'], {}), "('$ #\\\\1^{ #\\\\1#1 } $')\n", (1265, 1288), False, 'from gkdtex.wrap import parse\n'), ((1307, 1320), 'gkdtex.interpreter.Interpreter', 'Interpreter', ([], {}), '()\n', (1318, 1320), False, 'from gkdtex.interpreter import Interpre... |
"""
Start local development server
"""
import argparse
import logging
import shlex
import subprocess
import webbrowser
from contextlib import suppress
from http.server import HTTPServer, SimpleHTTPRequestHandler
from pathlib import Path
from ssl import wrap_socket
from tempfile import NamedTemporaryFile
from threading ... | [
"logging.getLogger",
"argparse.ArgumentParser",
"pathlib.Path",
"shlex.split",
"ssl.wrap_socket",
"webbrowser.open",
"http.server.HTTPServer",
"contextlib.suppress",
"tempfile.NamedTemporaryFile",
"watchdog.observers.Observer"
] | [((1082, 1107), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1105, 1107), False, 'import argparse\n'), ((5076, 5095), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (5093, 5095), False, 'import logging\n'), ((5108, 5157), 'http.server.HTTPServer', 'HTTPServer', (['(address, port... |
from django.conf.urls import url
from .views import tracon2022_afterparty_participants_view, tracon2022_afterparty_summary_view
urlpatterns = [
url(
r'^events/(?P<event_slug>tracon2022)/labour/surveys/kaatoilmo/results.xlsx$',
tracon2022_afterparty_participants_view,
name='tracon2022_afte... | [
"django.conf.urls.url"
] | [((151, 330), 'django.conf.urls.url', 'url', (['"""^events/(?P<event_slug>tracon2022)/labour/surveys/kaatoilmo/results.xlsx$"""', 'tracon2022_afterparty_participants_view'], {'name': '"""tracon2022_afterparty_participants_view"""'}), "('^events/(?P<event_slug>tracon2022)/labour/surveys/kaatoilmo/results.xlsx$'\n , t... |
import re
import unittest
from faker import Faker
from faker.providers.bank.ru_RU import Provider as RuBank
class TestCreditCardProvider(unittest.TestCase):
def setUp(self):
self.fake = Faker(locale='en_US')
Faker.seed(0)
self.provider = self.fake.provider('faker.providers.credit_card')
... | [
"faker.Faker",
"faker.Faker.seed",
"re.match"
] | [((202, 223), 'faker.Faker', 'Faker', ([], {'locale': '"""en_US"""'}), "(locale='en_US')\n", (207, 223), False, 'from faker import Faker\n'), ((232, 245), 'faker.Faker.seed', 'Faker.seed', (['(0)'], {}), '(0)\n', (242, 245), False, 'from faker import Faker\n'), ((2431, 2445), 'faker.Faker', 'Faker', (['"""ru_RU"""'], {... |
#---- Python VM startup for LISTENERLISTENER_3_from_1 ---
import SSL_listener
incomingIP="localhost"
incomingPort=10031
incomingPrivateKeyFile="server.key"
incomingPublicKeyFile="server.crt"
outgoingIP="localhost"
outgoingPort=00000
outgoingPublicKeyFile="server.crt"
def startLISTENER_3_from_1():
incoming_ssl_Encryp... | [
"SSL_listener.SSL_listener"
] | [((329, 435), 'SSL_listener.SSL_listener', 'SSL_listener.SSL_listener', (['incomingIP', 'incomingPort', 'incomingPrivateKeyFile', 'incomingPublicKeyFile', '""""""'], {}), "(incomingIP, incomingPort, incomingPrivateKeyFile,\n incomingPublicKeyFile, '')\n", (354, 435), False, 'import SSL_listener\n')] |
"""
WSGI config for portfolify project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
import sys
from django.core.wsgi import get_wsgi_application
# only for dev/test
f... | [
"os.environ.setdefault",
"django.core.wsgi.get_wsgi_application",
"dotenv.load_dotenv"
] | [((379, 448), 'dotenv.load_dotenv', 'load_dotenv', (["('.env.backend.test' if TESTING else '.env.backend.local')"], {}), "('.env.backend.test' if TESTING else '.env.backend.local')\n", (390, 448), False, 'from dotenv import load_dotenv\n'), ((450, 520), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SET... |
import tm1637
import machine
import utime
disp = tm1637.TM1637(clk=machine.Pin(3), dio=machine.Pin(2))
adc = machine.ADC(4)
def display_mv(timer):
global adc, disp
mv = 0
N = 50
for k in range(N):
mv += 3300*adc.read_u16()/65535/N
disp.number(int(mv))
machine.Timer(freq=2, mode=machine.T... | [
"machine.Timer",
"machine.Pin",
"machine.ADC"
] | [((111, 125), 'machine.ADC', 'machine.ADC', (['(4)'], {}), '(4)\n', (122, 125), False, 'import machine\n'), ((284, 355), 'machine.Timer', 'machine.Timer', ([], {'freq': '(2)', 'mode': 'machine.Timer.PERIODIC', 'callback': 'display_mv'}), '(freq=2, mode=machine.Timer.PERIODIC, callback=display_mv)\n', (297, 355), False,... |
#
# journal/listener.py
#
# futaba - A Discord Mod bot for the Programming server
# Copyright (c) 2017-2020 <NAME>, <NAME>, jackylam5
#
# futaba is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it wil... | [
"logging.getLogger",
"pathlib.PurePath"
] | [((488, 515), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (505, 515), False, 'import logging\n'), ((661, 675), 'pathlib.PurePath', 'PurePath', (['path'], {}), '(path)\n', (669, 675), False, 'from pathlib import PurePath\n')] |
from django.http import Http404
from django.core import exceptions
from rest_framework import status
from rest_framework.generics import RetrieveUpdateAPIView
from rest_framework.permissions import (
IsAuthenticatedOrReadOnly, IsAuthenticated
)
from rest_framework.response import Response
from rest_framework.vie... | [
"rest_framework.response.Response"
] | [((1073, 1130), 'rest_framework.response.Response', 'Response', (['serializer.data'], {'status': 'status.HTTP_201_CREATED'}), '(serializer.data, status=status.HTTP_201_CREATED)\n', (1081, 1130), False, 'from rest_framework.response import Response\n'), ((1434, 1486), 'rest_framework.response.Response', 'Response', (['s... |
try:
import bpy
from bpy.types import WindowManager, AddonPreferences
from bpy.props import StringProperty, EnumProperty
in_blender = True
except ImportError as e:
in_blender = False
if in_blender:
from batchd import client
batchd_client = None
batchd_queues = []
batchd_types = []
... | [
"bpy.utils.unregister_class",
"bpy.props.StringProperty",
"bpy.path.abspath",
"batchd.client.Client",
"bpy.props.EnumProperty",
"bpy.ops.file.pack_all",
"bpy.utils.register_class",
"bpy.context.user_preferences.addons.get"
] | [((622, 686), 'batchd.client.Client', 'client.Client', (['addon.manager_url', 'addon.username', 'addon.password'], {}), '(addon.manager_url, addon.username, addon.password)\n', (635, 686), False, 'from batchd import client\n'), ((1829, 1903), 'bpy.props.StringProperty', 'StringProperty', ([], {'name': '"""batchd manage... |
from __future__ import unicode_literals
import os, sys, subprocess, ast
from nbconvert.preprocessors import Preprocessor
from holoviews.core import Dimensioned, Store
from holoviews.ipython.preprocessors import OptsMagicProcessor, OutputMagicProcessor
from holoviews.ipython.preprocessors import StripMagicsProcessor
fr... | [
"os.path.exists",
"os.listdir",
"sys.exit",
"os.makedirs",
"holoviews.util.command.export_to_python",
"subprocess.Popen",
"holoviews.ipython.preprocessors.OptsMagicProcessor",
"holoviews.ipython.preprocessors.StripMagicsProcessor",
"matplotlib.pyplot.switch_backend",
"os.path.join",
"holoviews.i... | [((419, 444), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (437, 444), True, 'import matplotlib.pyplot as plt\n'), ((6100, 6141), 'holoviews.util.command.export_to_python', 'export_to_python', (['filename', 'preprocessors'], {}), '(filename, preprocessors)\n', (6116, 6141)... |
import os
# getting path so you can run the script python3 App_init, python3 .
if os.getcwd()[-8:] != "App_init":
default_path = "App_init/"
print(default_path)
else:
default_path = ""
# reading all built in modules
default_modules = open(f"{default_path}default_modules.txt", "r").readlines()
for a, i in ... | [
"os.getcwd"
] | [((83, 94), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (92, 94), False, 'import os\n')] |
import serial
import io
import MySQLdb
device = '/dev/ttyACM1'
#ser = serial.Serial('/dev/ttyACM1', 9600)
arduino = serial.Serial(device, 9600)
#dataTemp = arduino.readline()
temp = 5
motorPos = 50
hIndex = 4
i = 0
while(i<3):
dataIndicator = arduino.readline()
indicator = dataIndicator.decode().strip()
... | [
"MySQLdb.connect",
"serial.Serial"
] | [((119, 146), 'serial.Serial', 'serial.Serial', (['device', '(9600)'], {}), '(device, 9600)\n', (132, 146), False, 'import serial\n'), ((999, 1057), 'MySQLdb.connect', 'MySQLdb.connect', (['"""localhost"""', '"""root"""', '"""password"""', '"""tempdb"""'], {}), "('localhost', 'root', 'password', 'tempdb')\n", (1014, 10... |
import time
from typing import Optional
from pollect.core import Helper
from pollect.core.ValueSet import ValueSet, Value
from pollect.sources.Source import Source
class HttpSource(Source):
status_code: Optional[int] = None
def __init__(self, config):
super().__init__(config)
self.url = conf... | [
"pollect.core.Helper.get_url",
"pollect.core.ValueSet.Value",
"time.time",
"pollect.core.ValueSet.ValueSet"
] | [((473, 483), 'pollect.core.ValueSet.ValueSet', 'ValueSet', ([], {}), '()\n', (481, 483), False, 'from pollect.core.ValueSet import ValueSet, Value\n'), ((548, 633), 'pollect.core.Helper.get_url', 'Helper.get_url', (['self.url'], {'timeout': 'self.timeout', 'expected_status': 'self.status_code'}), '(self.url, timeout=s... |
from datetime import datetime
from enum import Enum, auto
import re
guard_id_regex = re.compile(r'#\d+')
class Record():
def __init__(self, record_string):
self.timestamp = datetime.strptime(record_string[1:17], '%Y-%m-%d %H:%M')
guard_id = guard_id_regex.search(record_string)
self.guard_... | [
"datetime.datetime.strptime",
"re.compile"
] | [((86, 105), 're.compile', 're.compile', (['"""#\\\\d+"""'], {}), "('#\\\\d+')\n", (96, 105), False, 'import re\n'), ((188, 244), 'datetime.datetime.strptime', 'datetime.strptime', (['record_string[1:17]', '"""%Y-%m-%d %H:%M"""'], {}), "(record_string[1:17], '%Y-%m-%d %H:%M')\n", (205, 244), False, 'from datetime impor... |
from rest_framework import serializers
class ProductSerializer(serializers.Serializer):
product = serializers.ListField(
child=serializers.CharField(max_length=200))
| [
"rest_framework.serializers.CharField"
] | [((141, 178), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (162, 178), False, 'from rest_framework import serializers\n')] |
# Export the contents of AviSys files SIGHTING.DAT and FNotes.DAT to CSV format
# Author: <NAME> <<EMAIL>>
# Version: 1.2 3 April 2021
import sys
import csv
import ctypes
# Input files
DATA_FILE = 'SIGHTING.DAT'
MASTER_FILE = 'MASTER.AVI'
PLACES_FILE = 'PLACES.AVI'
NOTE_INDEX = 'FNotes.IX'
NOTE_FILE = 'FNotes.DAT'
AS... | [
"csv.DictWriter",
"sys.exc_info",
"ctypes.WinDLL"
] | [((14091, 14137), 'ctypes.WinDLL', 'ctypes.WinDLL', (['"""kernel32"""'], {'use_last_error': '(True)'}), "('kernel32', use_last_error=True)\n", (14104, 14137), False, 'import ctypes\n'), ((20665, 20706), 'csv.DictWriter', 'csv.DictWriter', (['CSV'], {'fieldnames': 'csvFields'}), '(CSV, fieldnames=csvFields)\n', (20679, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
# Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved.
# Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries.
# Other trademarks may be trademarks of their respective owners.
#
# Licensed under the Apache License, Ver... | [
"logging.getLogger",
"subprocess.Popen",
"io.StringIO",
"io.TextIOWrapper"
] | [((988, 1015), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1005, 1015), False, 'import logging\n'), ((1165, 1300), 'subprocess.Popen', 'subprocess.Popen', (["['powershell', '-outputformat', 'XML', '-command', '' + cmd + '']"], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE'}... |
from rest_framework import serializers
from djoser.serializers import UserSerializer
from math import cos, asin, sqrt, pi
from accounts.models import User
from .models import Localization
class UserInfoSerializer(UserSerializer):
class Meta:
model = User
exclude = ('email', 'password', 'is_superu... | [
"rest_framework.serializers.DateTimeField",
"rest_framework.serializers.ValidationError",
"math.sqrt",
"math.cos",
"rest_framework.serializers.CharField"
] | [((633, 723), 'rest_framework.serializers.DateTimeField', 'serializers.DateTimeField', ([], {'format': '"""%Y-%m-%d %H:%m"""', 'input_formats': 'None', 'read_only': '(True)'}), "(format='%Y-%m-%d %H:%m', input_formats=None,\n read_only=True)\n", (658, 723), False, 'from rest_framework import serializers\n'), ((741, ... |
import qcodes as qc
from qdev_wrappers.sweep_functions import _do_measurement, _do_measurement_single, \
_select_plottables
def measure(meas_param, do_plots=True):
"""
Function which measures the specified parameter and optionally
plots the results.
Args:
meas_param: parameter to measure
... | [
"qcodes.Measure",
"qdev_wrappers.sweep_functions._select_plottables",
"qdev_wrappers.sweep_functions._do_measurement_single",
"qdev_wrappers.sweep_functions._do_measurement"
] | [((544, 566), 'qcodes.Measure', 'qc.Measure', (['meas_param'], {}), '(meas_param)\n', (554, 566), True, 'import qcodes as qc\n'), ((585, 615), 'qdev_wrappers.sweep_functions._select_plottables', '_select_plottables', (['meas_param'], {}), '(meas_param)\n', (603, 615), False, 'from qdev_wrappers.sweep_functions import _... |
import os.path
import os
import numpy
from . import common, cgen
"""
References
https://github.com/scikit-learn/scikit-learn/blob/15a949460dbf19e5e196b8ef48f9712b72a3b3c3/sklearn/covariance/_empirical_covariance.py#L297
https://github.com/scikit-learn/scikit-learn/blob/15a949460dbf19e5e196b8ef48f9712b72a3b3c3/skl... | [
"numpy.zeros",
"os.path.basename"
] | [((942, 965), 'numpy.zeros', 'numpy.zeros', ([], {'shape': 'size'}), '(shape=size)\n', (953, 965), False, 'import numpy\n'), ((4073, 4095), 'os.path.basename', 'os.path.basename', (['file'], {}), '(file)\n', (4089, 4095), False, 'import os\n')] |
from db_connection import DbConnection
import random
def load():
db_conn = DbConnection('profiles')
db_conn.execute("drop table if exists profiles")
db_conn.execute("create table profiles (id integer PRIMARY KEY, name text not null, skillset text not null, connection_weight integer not null)")
names_for_prof... | [
"random.sample",
"db_connection.DbConnection",
"random.randint"
] | [((78, 102), 'db_connection.DbConnection', 'DbConnection', (['"""profiles"""'], {}), "('profiles')\n", (90, 102), False, 'from db_connection import DbConnection\n'), ((616, 644), 'random.sample', 'random.sample', (['all_skills', '(4)'], {}), '(all_skills, 4)\n', (629, 644), False, 'import random\n'), ((669, 690), 'rand... |
import cv2
# used to scale down the video resolution
# the repo doesn't include vid 480x360 file,
# but you can get if from https://www.youtube.com/watch?v=FtutLA63Cp8
cap = cv2.VideoCapture('bad_apple_480x360.mp4')
fourcc = cv2.VideoWriter_fourcc(*'MP4V')
out = cv2.VideoWriter('bad_apple_48x36.mp4', four... | [
"cv2.VideoWriter",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.VideoWriter_fourcc",
"cv2.resize"
] | [((184, 225), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""bad_apple_480x360.mp4"""'], {}), "('bad_apple_480x360.mp4')\n", (200, 225), False, 'import cv2\n'), ((238, 269), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'MP4V'"], {}), "(*'MP4V')\n", (260, 269), False, 'import cv2\n'), ((277, 337), 'cv2.VideoWr... |
#!/usr/bin/env python3
import rospy
from std_msgs.msg import Int32
n = 0
def cb(message):
global n
n = message.data
rospy.init_node('nabe')
sub = rospy.Subscriber('rand_number', Int32, cb)
pub = rospy.Publisher('atu', Int32, queue_size=1)
rate = rospy.Rate(1)
while not rospy.is_shutdown():
if n % 3 == 0... | [
"rospy.Subscriber",
"rospy.is_shutdown",
"rospy.init_node",
"rospy.Rate",
"rospy.Publisher"
] | [((128, 151), 'rospy.init_node', 'rospy.init_node', (['"""nabe"""'], {}), "('nabe')\n", (143, 151), False, 'import rospy\n'), ((158, 200), 'rospy.Subscriber', 'rospy.Subscriber', (['"""rand_number"""', 'Int32', 'cb'], {}), "('rand_number', Int32, cb)\n", (174, 200), False, 'import rospy\n'), ((207, 250), 'rospy.Publish... |
from fuzzy_asteroids.util import Scenario
import numpy as np
# "Simple" Scenarios --------------------------------------------------------------------------------------------------#
# Threat priority tests
threat_test_1 = Scenario(
name="threat_test_1",
asteroid_states=[{"position": (0, 300), "angle": -90.0, ... | [
"numpy.linspace",
"numpy.cos",
"numpy.sin",
"numpy.meshgrid",
"fuzzy_asteroids.util.Scenario"
] | [((224, 430), 'fuzzy_asteroids.util.Scenario', 'Scenario', ([], {'name': '"""threat_test_1"""', 'asteroid_states': "[{'position': (0, 300), 'angle': -90.0, 'speed': 40}, {'position': (700, \n 300), 'angle': 0.0, 'speed': 0}]", 'ship_state': "{'position': (600, 300)}", 'seed': '(0)'}), "(name='threat_test_1', asteroi... |
from django.db import models
# class Game(models.Model):
# name = models.CharField(max_length=200)
#
# def __str__(self):
# return self.name
class Movie(models.Model):
imdb_id = models.CharField(max_length=200, null=True, blank=True)
name = models.CharField(max_length=200, null=True, blank=... | [
"django.db.models.FloatField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((203, 258), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'null': '(True)', 'blank': '(True)'}), '(max_length=200, null=True, blank=True)\n', (219, 258), False, 'from django.db import models\n'), ((270, 325), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)... |
# Generated by Django 4.0.3 on 2022-03-15 03:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('front_end', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='especies',
old_name='Nome_Po... | [
"django.db.migrations.RenameField"
] | [((230, 329), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""especies"""', 'old_name': '"""Nome_Popular"""', 'new_name': '"""Nome_popular"""'}), "(model_name='especies', old_name='Nome_Popular',\n new_name='Nome_popular')\n", (252, 329), False, 'from django.db import migrations... |
import json
import os
import sys
import time
from os import path as osp
from pathlib import Path
from shutil import copyfile
import numpy as np
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.utils.data import DataLoader
from tqdm import tqdm
from model_temporal import LSTMSeqNetwork, B... | [
"model_temporal.BilinearLSTMSeqNetwork",
"model_temporal.LSTMSeqNetwork",
"utils.MSEAverageMeter",
"numpy.array",
"torch.nn.MSELoss",
"model_temporal.TCNSeqNetwork",
"torch.cuda.is_available",
"numpy.linalg.norm",
"metric.compute_absolute_trajectory_error",
"numpy.arange",
"os.remove",
"os.pat... | [((1238, 1295), 'torch.multiprocessing.set_sharing_strategy', 'torch.multiprocessing.set_sharing_strategy', (['"""file_system"""'], {}), "('file_system')\n", (1280, 1295), False, 'import torch\n'), ((853, 875), 'os.listdir', 'os.listdir', (["(path + '/')"], {}), "(path + '/')\n", (863, 875), False, 'import os\n'), ((32... |
# coding=utf-8
"""
Definition of constants.
"""
from xbmcswift2.plugin import Plugin
PLUGIN = Plugin()
| [
"xbmcswift2.plugin.Plugin"
] | [((95, 103), 'xbmcswift2.plugin.Plugin', 'Plugin', ([], {}), '()\n', (101, 103), False, 'from xbmcswift2.plugin import Plugin\n')] |
from scipy.misc import imread,imshow
import chaosencrypt as cenc
import numpy as np
from chaosencrypt.discrete_pisarchik import bitexpand,bitreduce
# Read image
print('Loading image...')
im_org = imread('../image.jpg')
# Downsample
im = im_org[::3,::3,:].copy()
# Key
key = {'a':3.8,'n':10,'r':3,'bits':32}
# Encryp... | [
"numpy.abs",
"chaosencrypt.encrypt",
"chaosencrypt.discrete_pisarchik.bitreduce",
"numpy.max",
"scipy.misc.imread",
"numpy.zeros",
"numpy.concatenate",
"numpy.min",
"chaosencrypt.decrypt"
] | [((198, 220), 'scipy.misc.imread', 'imread', (['"""../image.jpg"""'], {}), "('../image.jpg')\n", (204, 220), False, 'from scipy.misc import imread, imshow\n'), ((381, 424), 'chaosencrypt.encrypt', 'cenc.encrypt', (['im', 'key', '"""discrete_pisarchik"""'], {}), "(im, key, 'discrete_pisarchik')\n", (393, 424), True, 'im... |
"""
A whole file dedicated to parsing __version__ in all it's weird possible ways
1) Only acts on source, no file handling.
2) some functions for *by line*
3) some functions for *by file*
4) Handle quotes
5) Handle whitespace
6) Handle version as tuple
"""
import ast
import re
from typing import Any, Optional, T... | [
"ast.parse",
"re.search"
] | [((2585, 2671), 're.search', 're.search', (['(\'^\' + version_token + \' = [\\\'\\\\"]([^\\\'\\\\"]*)[\\\'\\\\"]\')', 'file_source', 're.M'], {}), '(\'^\' + version_token + \' = [\\\'\\\\"]([^\\\'\\\\"]*)[\\\'\\\\"]\', file_source,\n re.M)\n', (2594, 2671), False, 'import re\n'), ((942, 968), 'ast.parse', 'ast.parse... |
import copy
import itertools
import wsgiref.util
from oslo_config import cfg
from oslo_log import log
from oslo_serialization import jsonutils
from oslo_utils import importutils
import routes.middleware
import six
import webob.dec
import webob.exc
from wsgi_basic import exception
from wsgi_basic.common import authori... | [
"wsgi_basic.common.dependency.requires",
"wsgi_basic.exception.ValidationError",
"wsgi_basic.exception.NotFound",
"oslo_serialization.jsonutils.dumps",
"six.text_type",
"wsgi_basic.common.utils.get_token_ref",
"wsgi_basic.exception.UnexpectedError",
"oslo_log.log.getLogger"
] | [((428, 451), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (441, 451), False, 'from oslo_log import log\n'), ((2934, 2980), 'wsgi_basic.common.dependency.requires', 'dependency.requires', (['"""token_api"""', '"""policy_api"""'], {}), "('token_api', 'policy_api')\n", (2953, 2980), Fals... |
import math
from gluon import URL, SPAN
class Paginater():
"""
Adapted from http://web2py.com/books/default/chapter/29/14/other-recipes#Pagination
"""
item_limits = [6, 12, 25, 50, 100]
def __init__(self, request, query_set, db):
self._request = request
self._query_s... | [
"gluon.SPAN",
"math.floor"
] | [((3501, 3521), 'math.floor', 'math.floor', (['division'], {}), '(division)\n', (3511, 3521), False, 'import math\n'), ((2591, 2690), 'gluon.SPAN', 'SPAN', ([], {'_class': "('text-info glyphicon glyphicon-arrow-' + ('down' if self.order_reverse else\n 'up'))"}), "(_class='text-info glyphicon glyphicon-arrow-' + ('do... |
import logging
import os
import pathlib
import requests
import shutil
from typing import Dict, List, Optional, Union
from PIL import Image, UnidentifiedImageError
from mir import scm
# project
def project_root() -> str:
root = str(pathlib.Path(__file__).parent.parent.parent.absolute())
return root
# mir r... | [
"os.path.exists",
"PIL.Image.open",
"os.makedirs",
"pathlib.Path",
"mir.scm.Scm",
"logging.warning",
"os.path.join",
"requests.get",
"os.path.isfile",
"os.path.dirname",
"shutil.copyfile",
"os.path.isdir",
"logging.info"
] | [((2734, 2770), 'os.makedirs', 'os.makedirs', (['out_root'], {'exist_ok': '(True)'}), '(out_root, exist_ok=True)\n', (2745, 2770), False, 'import os\n'), ((2789, 2823), 'os.path.join', 'os.path.join', (['out_root', 'sub_folder'], {}), '(out_root, sub_folder)\n', (2801, 2823), False, 'import os\n'), ((2828, 2867), 'os.m... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Load in the data
df = pd.read_csv("results.txt", header=None)
df.columns = ["poison_perc", "success_rate", "auc"]
# Plot the data
plt.plot(df['poison_perc'], df['success_rate'], label="Success rate")
plt.plot(df['poison_perc'], df['auc'], label=... | [
"pandas.read_csv",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((96, 135), 'pandas.read_csv', 'pd.read_csv', (['"""results.txt"""'], {'header': 'None'}), "('results.txt', header=None)\n", (107, 135), True, 'import pandas as pd\n'), ((205, 274), 'matplotlib.pyplot.plot', 'plt.plot', (["df['poison_perc']", "df['success_rate']"], {'label': '"""Success rate"""'}), "(df['poison_perc']... |
#!/usr/bin/env python3
# Usage: python SESGenerator.py <target_configuration>.json <output_directory>
#
# <target_configuration>.json is a json file generated from CMake on the form:
# {
# "target": {
# "name": "light_control_client_nrf52832_xxAA_s132_5.0.0",
# "sources": "main.c;provisioner.c;..",... | [
"json.loads",
"collections.namedtuple",
"jinja2.Template",
"shutil.copyfile",
"json.load",
"os.path.relpath"
] | [((2111, 2154), 'collections.namedtuple', 'namedtuple', (['"""DataRegion"""', "['start', 'size']"], {}), "('DataRegion', ['start', 'size'])\n", (2121, 2154), False, 'from collections import namedtuple\n'), ((2165, 2229), 'collections.namedtuple', 'namedtuple', (['"""Target"""', "['name', 'includes', 'defines', 'sources... |
from django import template
from django.db.models import Count
from django.utils.safestring import mark_safe
import markdown
from ..models import Post
register = template.Library()
####
# Register as simple tags
####
# A simple template tag that returns the number of posts published so far.=
@register.simple_tag
d... | [
"django.db.models.Count",
"markdown.markdown",
"django.template.Library"
] | [((164, 182), 'django.template.Library', 'template.Library', ([], {}), '()\n', (180, 182), False, 'from django import template\n'), ((1439, 1462), 'markdown.markdown', 'markdown.markdown', (['text'], {}), '(text)\n', (1456, 1462), False, 'import markdown\n'), ((824, 841), 'django.db.models.Count', 'Count', (['"""commen... |
from PyQt5.QtWidgets import QWidget, QHBoxLayout
from pyqtgraph import GraphicsLayoutWidget
import pyqtgraph as pg
class VideoWidget(QWidget):
def __init__(self, parent=None):
super().__init__(parent=parent)
self.layout = QHBoxLayout(self)
# Settings for the image
self.imv = pg.Ima... | [
"pyqtgraph.ImageView",
"PyQt5.QtWidgets.QHBoxLayout"
] | [((243, 260), 'PyQt5.QtWidgets.QHBoxLayout', 'QHBoxLayout', (['self'], {}), '(self)\n', (254, 260), False, 'from PyQt5.QtWidgets import QWidget, QHBoxLayout\n'), ((314, 328), 'pyqtgraph.ImageView', 'pg.ImageView', ([], {}), '()\n', (326, 328), True, 'import pyqtgraph as pg\n')] |
from midiutil.MidiFile import MIDIFile
import os
def _create_midi_mapping():
""" Create a dictionary that maps note name to midi note integer """
middle_c = 60
notes = "c", "c#", "d", "d#", "e", "f", "f#", "g", "g#", "a", "a#", "b"
equiv = (("c#", "db"), ("d#", "eb"),
("f#", "gb"... | [
"os.system",
"os.mkdir"
] | [((4254, 4305), 'os.system', 'os.system', (["('start %s' % (self.path + self.filename))"], {}), "('start %s' % (self.path + self.filename))\n", (4263, 4305), False, 'import os\n'), ((3631, 3645), 'os.mkdir', 'os.mkdir', (['path'], {}), '(path)\n', (3639, 3645), False, 'import os\n')] |
#!/usr/bin/env python3
# pylint: disable=too-many-lines
"""
Provides a stdin/stdout based protocol to safely dispatch commands and return their
results over any connection that forwards both stdin/stdout, as well as some other
needed remote system related utilities.
"""
import errno as sys_errno
import hashlib
import... | [
"os.setresuid",
"os.getuid",
"os.chown",
"stat.S_IMODE",
"sys.exit",
"stat.S_ISLNK",
"typing.get_origin",
"os.setresgid",
"stat.S_ISDIR",
"stat.S_ISFIFO",
"pwd.getpwnam",
"subprocess.run",
"stat.S_ISBLK",
"typing.NewType",
"os.chmod",
"os.umask",
"os.path.isdir",
"os.getgid",
"ty... | [((633, 645), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (640, 645), False, 'from typing import IO, Any, Type, TypeVar, Callable, Optional, Union, NamedTuple, NewType, cast\n'), ((652, 671), 'typing.NewType', 'NewType', (['"""i32"""', 'int'], {}), "('i32', int)\n", (659, 671), False, 'from typing import... |
# -*- coding: utf-8 -*-
import logging
from django import db
from django.conf import settings
from django.core.management import call_command, BaseCommand, CommandError
from django.utils.module_loading import import_string
from django_orghierarchy.models import Organization
from django.db import transaction
from e... | [
"logging.getLogger",
"events.models.Language.objects.update_or_create"
] | [((456, 483), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (473, 483), False, 'import logging\n'), ((1438, 1495), 'events.models.Language.objects.update_or_create', 'Language.objects.update_or_create', ([], {'id': "i['id']", 'defaults': 'i'}), "(id=i['id'], defaults=i)\n", (1471, 1495),... |
from hashtable import HashTable
class Set:
def __init__(self, elements=None):
"""Initialize this new set and add the given elements"""
self.hash_set = HashTable()
if elements is not None:
for element in elements:
self.add(element)
def size(self):
"... | [
"hashtable.HashTable"
] | [((173, 184), 'hashtable.HashTable', 'HashTable', ([], {}), '()\n', (182, 184), False, 'from hashtable import HashTable\n')] |
from afterpay.attribute_getter import AttributeGetter
from afterpay.exceptions import AfterpayError
class Merchant(AttributeGetter):
"""
Merchant object
Attributes:
redirectConfirmUrl: The consumer is redirected to this URL when the payment process is completed.
redirectCancelUrl: The cons... | [
"afterpay.attribute_getter.AttributeGetter.__init__",
"afterpay.exceptions.AfterpayError"
] | [((828, 870), 'afterpay.attribute_getter.AttributeGetter.__init__', 'AttributeGetter.__init__', (['self', 'attributes'], {}), '(self, attributes)\n', (852, 870), False, 'from afterpay.attribute_getter import AttributeGetter\n'), ((590, 675), 'afterpay.exceptions.AfterpayError', 'AfterpayError', (['"""Cannot initialize ... |
# -*- coding: utf-8 -*-
import logging
import uuid
from gettext import gettext
from py4j.compat import bytearray2
from urllib.parse import urlparse
from limonero.py4j_init import create_gateway
WRONG_HDFS_CONFIG = gettext(
"Limonero HDFS access not correctly configured (see "
"config 'dfs.client.use.datanode.... | [
"logging.getLogger",
"limonero.py4j_init.create_gateway",
"urllib.parse.urlparse",
"uuid.uuid4",
"gettext.gettext",
"py4j.compat.bytearray2"
] | [((216, 330), 'gettext.gettext', 'gettext', (['"""Limonero HDFS access not correctly configured (see config \'dfs.client.use.datanode.hostname\')"""'], {}), '(\n "Limonero HDFS access not correctly configured (see config \'dfs.client.use.datanode.hostname\')"\n )\n', (223, 330), False, 'from gettext import gettex... |
from selenium import webdriver
from webdriver_manager.opera import OperaDriverManager
from webdriver_setup.driver import DriverBase
class OperaDriver(DriverBase):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def create_driver(self, **kwargs):
"""Create Opera webdriver
... | [
"selenium.webdriver.Opera",
"webdriver_manager.opera.OperaDriverManager"
] | [((638, 692), 'selenium.webdriver.Opera', 'webdriver.Opera', ([], {'executable_path': 'driver_path'}), '(executable_path=driver_path, **kwargs)\n', (653, 692), False, 'from selenium import webdriver\n'), ((560, 611), 'webdriver_manager.opera.OperaDriverManager', 'OperaDriverManager', ([], {'cache_valid_range': 'cache_t... |
import math
import os
import tempfile
from contextlib import contextmanager
from soap import logger
from soap.common.cache import cached
from soap.expression import operators, OutputVariableTuple
from soap.semantics.error import IntegerInterval, ErrorSemantics
flopoco_command_map = {
'IntAdder': ('{wi}', ),
... | [
"soap.logger.error",
"sh.echo",
"os.path.join",
"os.path.splitext",
"os.path.split",
"tempfile.mktemp",
"os.path.dirname",
"math.log",
"sh.mkdir",
"os.path.abspath",
"sh.flopoco",
"sh.cd"
] | [((1548, 1573), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1563, 1573), False, 'import os\n'), ((1589, 1624), 'os.path.join', 'os.path.join', (['directory', '"""luts.pkl"""'], {}), "(directory, 'luts.pkl')\n", (1601, 1624), False, 'import os\n'), ((1641, 1681), 'os.path.join', 'os.path.j... |
# -*- coding: utf-8 -*-
from coralquant.models.odl_model import BS_Stock_Basic, BS_SZ50_Stocks, TS_Stock_Basic, TS_TradeCal
from coralquant.spider.bs_stock_basic import get_stock_basic
from coralquant import logger
from datetime import date, datetime, timedelta
from sqlalchemy import MetaData
from coralquant.database i... | [
"coralquant.logger.Logger",
"coralquant.models.orm_model.TaskTable",
"coralquant.database.session_scope",
"sqlalchemy.MetaData",
"coralquant.models.orm_model.TaskTable.del_with_task",
"datetime.datetime.now",
"sqlalchemy.distinct",
"coralquant.models.odl_model.BS_Stock_Basic.code.in_"
] | [((568, 578), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (576, 578), False, 'from sqlalchemy import MetaData\n'), ((2890, 2919), 'coralquant.models.orm_model.TaskTable.del_with_task', 'TaskTable.del_with_task', (['task'], {}), '(task)\n', (2913, 2919), False, 'from coralquant.models.orm_model import TaskTable... |
from tensorboardX import SummaryWriter
class Logger:
def __init__(self, log_dir):
self.env_name = 'Pong-v0'
# TensorBoard
self.writer = SummaryWriter(log_dir=log_dir)
# Episode Values
self.ep = 0
self.ep_rewards = []
self.ep_max_reward = 0.0
self.ep... | [
"tensorboardX.SummaryWriter"
] | [((167, 197), 'tensorboardX.SummaryWriter', 'SummaryWriter', ([], {'log_dir': 'log_dir'}), '(log_dir=log_dir)\n', (180, 197), False, 'from tensorboardX import SummaryWriter\n')] |
from __future__ import print_function
import os
import shutil
import pyNastran
from pyNastran.utils import print_bad_path
pkg_path = pyNastran.__path__[0]
def create_rst_from_ipython_notebooks():
#curdir = os.getcwd()
notebook_dir = os.path.join(pkg_path, '..', 'docs', 'quick_start', 'demo')
pydocs_dir =... | [
"os.path.exists",
"os.listdir",
"os.rename",
"os.path.join",
"os.path.splitext",
"os.chdir",
"os.path.basename",
"os.system",
"pyNastran.utils.print_bad_path",
"os.remove"
] | [((244, 303), 'os.path.join', 'os.path.join', (['pkg_path', '""".."""', '"""docs"""', '"""quick_start"""', '"""demo"""'], {}), "(pkg_path, '..', 'docs', 'quick_start', 'demo')\n", (256, 303), False, 'import os\n'), ((321, 385), 'os.path.join', 'os.path.join', (['pkg_path', '""".."""', '"""docs"""', '"""html_docs"""', '... |
import pygame
import pygame_gui
from rules_python.python.runfiles import runfiles
class GeneratorWindow(pygame_gui.elements.ui_window.UIWindow):
def __init__(self, position, ui_manager, generator):
super().__init__(pygame.Rect(position, (320, 120)), ui_manager,
window_display_tit... | [
"pygame.image.load",
"rules_python.python.runfiles.runfiles.Create",
"pygame.Rect"
] | [((1446, 1463), 'rules_python.python.runfiles.runfiles.Create', 'runfiles.Create', ([], {}), '()\n', (1461, 1463), False, 'from rules_python.python.runfiles import runfiles\n'), ((230, 263), 'pygame.Rect', 'pygame.Rect', (['position', '(320, 120)'], {}), '(position, (320, 120))\n', (241, 263), False, 'import pygame\n')... |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | [
"itertools.filterfalse",
"Bio.SeqIO.parse",
"Bio.SeqIO.write",
"re.compile"
] | [((687, 738), 're.compile', 're.compile', (['"""^[ABCDGHKMNRSTVWXYU]+$"""', 're.IGNORECASE'], {}), "('^[ABCDGHKMNRSTVWXYU]+$', re.IGNORECASE)\n", (697, 738), False, 'import re\n'), ((952, 980), 'Bio.SeqIO.parse', 'SeqIO.parse', (['handle', '"""fasta"""'], {}), "(handle, 'fasta')\n", (963, 980), False, 'from Bio import ... |
"""
This script contains the code implementing my version of the Boids artificial
life programme.
"""
# ---------------------------------- Imports ----------------------------------
# Allow imports from parent folder
import sys, os
sys.path.insert(0, os.path.abspath('..'))
# Standard library imports
impor... | [
"boids_core.generate_values.noisy_lattice",
"math.sqrt",
"delauney_triangulation.triangulation_core.triangulation.triangulate",
"numpy.asarray",
"boids_core.generate_values.random",
"boids_core.generate_values.lattice",
"math.atan2",
"delauney_triangulation.triangulation_core.linear_algebra.list_divid... | [((261, 282), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (276, 282), False, 'import sys, os\n'), ((2460, 2501), 'math.sqrt', 'sqrt', (['(self.vel[0] ** 2 + self.vel[1] ** 2)'], {}), '(self.vel[0] ** 2 + self.vel[1] ** 2)\n', (2464, 2501), False, 'from math import atan2, sqrt\n'), ((2546, 2577... |
# Copyright 2021 Softwerks LLC
#
# 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... | [
"flask.g.redis.smembers",
"flask.g.redis.hget",
"flask.g.redis.srem",
"flask.g.redis.hgetall",
"flask.g.redis.delete",
"flask.g.redis.hset",
"time.time",
"dataclasses.field",
"flask.session.clear",
"flask.g.redis.pipeline"
] | [((812, 841), 'dataclasses.field', 'dataclasses.field', ([], {'init': '(False)'}), '(init=False)\n', (829, 841), False, 'import dataclasses\n'), ((874, 903), 'dataclasses.field', 'dataclasses.field', ([], {'init': '(False)'}), '(init=False)\n', (891, 903), False, 'import dataclasses\n'), ((1481, 1553), 'flask.g.redis.h... |
# -*- coding: UTF-8 -*-
"""
opencv实现人脸识别
参考:
1、https://github.com/opencv/opencv/tree/master/data/haarcascades
2、http://www.cnblogs.com/hanson1/p/7105265.html
"""
import cv2
def detect_face(image):
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
'''
# 获取人脸识别训练数据
对于人脸特征的一些描述,opencv在读取完数据后很据训练中的样品数据,... | [
"cv2.rectangle",
"cv2.CascadeClassifier",
"cv2.cvtColor"
] | [((213, 252), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'], {}), '(image, cv2.COLOR_BGR2GRAY)\n', (225, 252), False, 'import cv2\n'), ((464, 526), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""./haarcascade_frontalface_default.xml"""'], {}), "('./haarcascade_frontalface_default.xml')\n", (... |
#!/usr/bin/env python3
import datetime
import os
import warnings
import numpy as np
import scipy.interpolate as si
import matplotlib as mpl
from matplotlib.backends import backend_pdf
import matplotlib.pyplot as plt
from .utils import aia_raster
from .utils import cli
from .utils import eis
from .utils import num
f... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"numpy.nanmean",
"numpy.array",
"numpy.nanmin",
"os.path.exists",
"numpy.savez",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.max",
"numpy.nanmax",
"numpy.min",
"warnings.warn",
"numpy.meshgrid",
"numpy.abs",
"numpy.nanstd",
"... | [((14319, 14335), 'numpy.max', 'np.max', (['x_margin'], {}), '(x_margin)\n', (14325, 14335), True, 'import numpy as np\n'), ((14351, 14367), 'numpy.max', 'np.max', (['y_margin'], {}), '(y_margin)\n', (14357, 14367), True, 'import numpy as np\n'), ((15480, 15532), 'numpy.sqrt', 'np.sqrt', (['((x_max - x_cen) ** 2 + (y_m... |
import unittest
from unittest.mock import patch, Mock
from payments.domain.paypal_payment import PaypalPayment
class TestPaypal(unittest.TestCase):
@patch("paypalrestsdk.Payment", return_value=Mock(links=[Mock(rel="approval_url", href="url")],
id="PAYID-123",... | [
"payments.domain.paypal_payment.PaypalPayment",
"unittest.mock.Mock"
] | [((627, 719), 'payments.domain.paypal_payment.PaypalPayment', 'PaypalPayment', (['payment_id', 'amount', 'currency', 'payment_status', 'created_at', 'payment_details'], {}), '(payment_id, amount, currency, payment_status, created_at,\n payment_details)\n', (640, 719), False, 'from payments.domain.paypal_payment impo... |
"""Defines useful types and utilities for working with bytestrings."""
from __future__ import annotations
import zlib
from abc import abstractmethod, ABCMeta
from collections.abc import Iterable, Sequence
from io import BytesIO
from itertools import chain
from typing import cast, final, Any, Final, TypeVar, SupportsB... | [
"itertools.chain",
"zlib.adler32",
"io.BytesIO",
"typing.cast",
"typing.TypeVar"
] | [((646, 686), 'typing.TypeVar', 'TypeVar', (['"""MaybeBytesT"""'], {'bound': 'MaybeBytes'}), "('MaybeBytesT', bound=MaybeBytes)\n", (653, 686), False, 'from typing import cast, final, Any, Final, TypeVar, SupportsBytes, Union, Protocol\n'), ((1439, 1456), 'zlib.adler32', 'zlib.adler32', (["b''"], {}), "(b'')\n", (1451,... |
#A template for when we actually build the model.
import numpy as np
from sklearn.model_selection import train_test_split
from tensorflow.keras.layers import Dense, LSTM, Dropout
from tensorflow.keras import Sequential
categories = [] #List out category string names here
reproducibility = 7 #Constant seed for reproduci... | [
"sklearn.model_selection.train_test_split",
"tensorflow.keras.Sequential",
"numpy.random.seed"
] | [((327, 358), 'numpy.random.seed', 'np.random.seed', (['reproducibility'], {}), '(reproducibility)\n', (341, 358), True, 'import numpy as np\n'), ((451, 518), 'sklearn.model_selection.train_test_split', 'train_test_split', (['x', 'y'], {'test_size': '(0.2)', 'random_state': 'reproducibility'}), '(x, y, test_size=0.2, r... |
# Create FastText model using from raw train data
import fastText
TRAIN_FILE = './datasets/raw_data/tweets.train'
su_model = fastText.train_supervised(input=TRAIN_FILE, wordNgrams=3)
su_model.save_model('model_sentiment.bin') | [
"fastText.train_supervised"
] | [((127, 184), 'fastText.train_supervised', 'fastText.train_supervised', ([], {'input': 'TRAIN_FILE', 'wordNgrams': '(3)'}), '(input=TRAIN_FILE, wordNgrams=3)\n', (152, 184), False, 'import fastText\n')] |
# Generated by Django 3.1.12 on 2021-06-13 04:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('media', '0009_auto_20210611_1441'),
]
operations = [
migrations.RemoveField(
model_name='collection',
name='media_i... | [
"django.db.migrations.RemoveField",
"django.db.models.ManyToManyField"
] | [((234, 300), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""collection"""', 'name': '"""media_item"""'}), "(model_name='collection', name='media_item')\n", (256, 300), False, 'from django.db import migrations, models\n'), ((447, 541), 'django.db.models.ManyToManyField', 'models.M... |
import warnings
no_pandas_warning = "Pandas/Numpy is not available. Support for 'dataframe' mode is disabled."
no_redis_warning = "Redis dependencies not available. Support for caching is disabled."
try:
import pandas as pd
import numpy as np
except ModuleNotFoundError:
pd = None
np = None
warning... | [
"warnings.warn"
] | [((313, 345), 'warnings.warn', 'warnings.warn', (['no_pandas_warning'], {}), '(no_pandas_warning)\n', (326, 345), False, 'import warnings\n')] |
import json
import rospy
from std_msgs.msg import String
from handlers.handler import Handler
from mapping.command_panel import CommandPanel
from mapping.resistance import Resistance
class ReadLettersHandler(Handler):
def initialize(self):
self.sub = rospy.Subscriber('letters', String, self.read_letters)... | [
"mapping.resistance.Resistance",
"mapping.command_panel.CommandPanel",
"rospy.Subscriber",
"json.loads"
] | [((266, 320), 'rospy.Subscriber', 'rospy.Subscriber', (['"""letters"""', 'String', 'self.read_letters'], {}), "('letters', String, self.read_letters)\n", (282, 320), False, 'import rospy\n'), ((478, 492), 'mapping.command_panel.CommandPanel', 'CommandPanel', ([], {}), '()\n', (490, 492), False, 'from mapping.command_pa... |
"""
@author: buechner_m <<EMAIL>>
"""
import sys
sys.path.append('..') # To allow importing from neighbouring folder
import simulation.materials as materials
import logging
logger = logging.getLogger(__name__)
class Grating(object):
"""
Parent class for gratings.
Parameters
==========
pitch: g... | [
"logging.getLogger",
"simulation.materials.shift_to_height",
"simulation.materials.height_to_absorption",
"simulation.materials.absorption_to_height",
"sys.path.append",
"simulation.materials.height_to_shift"
] | [((50, 71), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (65, 71), False, 'import sys\n'), ((184, 211), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (201, 211), False, 'import logging\n'), ((1811, 1884), 'simulation.materials.height_to_shift', 'materials.height_... |
from copy import deepcopy
from typing import Dict, Iterable, List, Optional, Tuple, Union
import fastjsonschema
from ..shared.exceptions import ActionException, DatastoreException, EventStoreException
from ..shared.handlers.base_handler import BaseHandler
from ..shared.interfaces.write_request_element import WriteReq... | [
"fastjsonschema.compile",
"copy.deepcopy"
] | [((663, 1157), 'fastjsonschema.compile', 'fastjsonschema.compile', (["{'$schema': schema_version, 'title': 'Schema for action API', 'description':\n 'An array of actions.', 'type': 'array', 'items': {'type': 'object',\n 'properties': {'action': {'description':\n 'Name of the action to be performed on the serve... |
import unittest as ut
from tests._utils._timer import Timer
from drivelink import cached
#from Process import freeze_support
def uncachedFib(a):
if a in [0, 1]:
return a
if a < 0:
raise Exception("Reverse fibonacci sequence not implemented.")
return uncachedFib(a - 1) + uncachedFib(a - 2)... | [
"unittest.main",
"tests._utils._timer.Timer"
] | [((2660, 2669), 'unittest.main', 'ut.main', ([], {}), '()\n', (2667, 2669), True, 'import unittest as ut\n'), ((2153, 2160), 'tests._utils._timer.Timer', 'Timer', ([], {}), '()\n', (2158, 2160), False, 'from tests._utils._timer import Timer\n'), ((2235, 2242), 'tests._utils._timer.Timer', 'Timer', ([], {}), '()\n', (22... |
from billy.scrape.actions import Rule, BaseCategorizer
# These are regex patterns that map to action categories.
_categorizer_rules = (
Rule((r'\(Ayes (?P<yes_votes>\d+)\.\s+Noes\s+'
r'(?P<no_votes>\d+)\.( Page \S+\.)?\)')),
Rule(r'^Introduced', 'bill:introduced'),
Rule(r'(?i)Referred to (?P<... | [
"billy.scrape.actions.Rule"
] | [((143, 243), 'billy.scrape.actions.Rule', 'Rule', (['"""\\\\(Ayes (?P<yes_votes>\\\\d+)\\\\.\\\\s+Noes\\\\s+(?P<no_votes>\\\\d+)\\\\.( Page \\\\S+\\\\.)?\\\\)"""'], {}), "(\n '\\\\(Ayes (?P<yes_votes>\\\\d+)\\\\.\\\\s+Noes\\\\s+(?P<no_votes>\\\\d+)\\\\.( Page \\\\S+\\\\.)?\\\\)'\n )\n", (147, 243), False, 'from ... |
# -*- coding: utf-8 -*-
from __future__ import with_statement, unicode_literals
import pytest
from ziggurat_foundations.models.services.group_permission import GroupPermissionService
from ziggurat_foundations.models.services.group_resource_permission import (
GroupResourcePermissionService,
)
from ziggurat_founda... | [
"ziggurat_foundations.models.services.group_permission.GroupPermissionService.by_group_and_perm",
"ziggurat_foundations.models.services.resource.ResourceService.perms_for_user",
"ziggurat_foundations.permissions.PermissionTuple",
"ziggurat_foundations.tests.add_resource_b",
"ziggurat_foundations.tests.conft... | [((1237, 1257), 'ziggurat_foundations.tests.add_user', 'add_user', (['db_session'], {}), '(db_session)\n', (1245, 1257), False, 'from ziggurat_foundations.tests import add_user, check_one_in_other, add_resource, add_resource_b, add_group, BaseTestCase\n'), ((1280, 1340), 'ziggurat_foundations.models.services.user.UserS... |
from flask import Flask
from flask import render_template
import datetime as dt
import json
import jinja2 as j2
import requests
import argparse
import os
import feedparser
from pathlib import Path
class OpenWeatherAPI():
url = j2.Template('https://api.openweathermap.org/data/2.5/onecall?lat={{lat}}&lon={{lon}}&ap... | [
"flask.render_template",
"datetime.datetime.fromtimestamp",
"pathlib.Path",
"feedparser.parse",
"flask.Flask",
"jinja2.Template"
] | [((714, 730), 'flask.Flask', 'Flask', (['"""ws-eink"""'], {}), "('ws-eink')\n", (719, 730), False, 'from flask import Flask\n'), ((233, 363), 'jinja2.Template', 'j2.Template', (['"""https://api.openweathermap.org/data/2.5/onecall?lat={{lat}}&lon={{lon}}&appid={{api_key}}&units={{units}}"""'], {}), "(\n 'https://api.... |
from flask import Flask
def create_app():
app = Flask(__name__)
#Rotas
from app.controllers.main.rotas import main
#Registrar Blueprint
app.register_blueprint(main)
return app
| [
"flask.Flask"
] | [((53, 68), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (58, 68), False, 'from flask import Flask\n')] |
import rules
# ------------predicates------------
# Processus
@rules.predicate
def is_process_manager(user, processus):
return processus.proc_manager == user
@rules.predicate
def is_process_upper_mgt(user, processus):
bu = processus.business_unit
return bu.bu_manager == user
# Activités
@rules.predic... | [
"rules.add_rule",
"rules.add_perm"
] | [((3577, 3625), 'rules.add_rule', 'rules.add_rule', (['"""change_risque"""', 'is_risk_creator'], {}), "('change_risque', is_risk_creator)\n", (3591, 3625), False, 'import rules\n'), ((3652, 3699), 'rules.add_rule', 'rules.add_rule', (['"""verify_risk"""', 'is_risk_verifier'], {}), "('verify_risk', is_risk_verifier)\n",... |
import os
import uuid
import requests_mock
import zeep
def read_file(file_name, folder="wsdl_ims"):
file = os.path.join(os.path.dirname(os.path.realpath(__file__)), folder, file_name)
with open(file) as f:
return f.read()
def test_find_customer():
with requests_mock.mock() as m:
m.get(... | [
"os.path.realpath",
"requests_mock.mock",
"zeep.settings.Settings",
"uuid.uuid4"
] | [((279, 299), 'requests_mock.mock', 'requests_mock.mock', ([], {}), '()\n', (297, 299), False, 'import requests_mock\n'), ((144, 170), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (160, 170), False, 'import os\n'), ((731, 767), 'zeep.settings.Settings', 'zeep.settings.Settings', ([], {'st... |
"""
Entry Point
"""
import asyncio
from dotplug.main import main
from dotplug.console import ncurses
def _main():
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
with ncurses():
asyncio.run(main())
input("")
| [
"dotplug.console.ncurses",
"dotplug.main.main",
"uvloop.EventLoopPolicy"
] | [((170, 194), 'uvloop.EventLoopPolicy', 'uvloop.EventLoopPolicy', ([], {}), '()\n', (192, 194), False, 'import uvloop\n'), ((206, 215), 'dotplug.console.ncurses', 'ncurses', ([], {}), '()\n', (213, 215), False, 'from dotplug.console import ncurses\n'), ((237, 243), 'dotplug.main.main', 'main', ([], {}), '()\n', (241, 2... |
#coding:utf-8
from mininet.net import Mininet
from mininet.topo import LinearTopo
from mininet.cli import CLI
# from eventlet import greenthread
import argparse
import threading
import re
from time import sleep
import logging
logger = logging.getLogger(__name__)
logger.setLevel(level = logging.INFO)
handler = loggin... | [
"logging.getLogger",
"argparse.ArgumentParser",
"logging.Formatter",
"mininet.cli.CLI",
"mininet.topo.LinearTopo",
"logging.FileHandler",
"mininet.net.Mininet"
] | [((238, 265), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (255, 265), False, 'import logging\n'), ((314, 348), 'logging.FileHandler', 'logging.FileHandler', (['"""hahalog.txt"""'], {}), "('hahalog.txt')\n", (333, 348), False, 'import logging\n'), ((392, 465), 'logging.Formatter', 'logg... |
#!/usr/bin/env python3
import collections
import datetime
import glob
import html
import re
import sys
# this is a mess right now, feel free to make it less bad if you feel like it
try:
# python 3.7+
datetime.datetime.fromisoformat
except AttributeError:
# not fully correct, but good enough for this use case
adjt... | [
"collections.OrderedDict",
"markdown.Markdown",
"collections.namedtuple",
"re.compile",
"datetime.datetime.fromisoformat",
"re.sub",
"html.escape",
"glob.glob"
] | [((643, 715), 'collections.namedtuple', 'collections.namedtuple', (['"""Entry"""', "['timestamp', 'dead', 'type', 'fields']"], {}), "('Entry', ['timestamp', 'dead', 'type', 'fields'])\n", (665, 715), False, 'import collections\n'), ((725, 815), 'collections.namedtuple', 'collections.namedtuple', (['"""Member"""', "['na... |
# -*- coding: utf-8 -*-
"""
============================================================================
Authors:
<NAME> and <NAME>*
*Department of Informatics
Universidad Nacional de San Antonio Abad del Cusco (UNSAAC) - Perú
============================================================================
"""
# Python... | [
"numpy.sum",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1903, 1917), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1915, 1917), True, 'import matplotlib.pyplot as plt\n'), ((2959, 2969), 'matplotlib.pyplot.grid', 'plt.grid', ([], {}), '()\n', (2967, 2969), True, 'import matplotlib.pyplot as plt\n'), ((2970, 2980), 'matplotlib.pyplot.show', 'plt.show', ... |
import os.path as osp
import os
import pylab as plt
import gc
import argparse
from utils import read_image
parser = argparse.ArgumentParser(description='Plot rank-5 results of S-ReID, SP-ReID and SSP-ReID')
parser.add_argument('-d', '--dataset', type=str, default='market1501')
# Architecture
parser.add_argument('-a... | [
"pylab.axis",
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"os.makedirs",
"utils.read_image",
"os.path.join",
"pylab.close",
"pylab.figure",
"gc.collect",
"pylab.imshow"
] | [((119, 214), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Plot rank-5 results of S-ReID, SP-ReID and SSP-ReID"""'}), "(description=\n 'Plot rank-5 results of S-ReID, SP-ReID and SSP-ReID')\n", (142, 214), False, 'import argparse\n'), ((522, 550), 'pylab.figure', 'plt.figure', ([], ... |