code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.db import models
from datetime import datetime
from crum import get_current_user
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
class ConnectionRequest(models.Model):
initiator = models.ForeignK... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.BooleanField",
"datetime.datetime.now",
"django.db.models.PositiveIntegerField",
"crum.get_current_user",
"django.db.models.DateTimeField",
"django.contrib.contenttypes.fields.GenericFo... | [((305, 467), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""profiles.UserProfile"""'], {'null': '(True)', 'blank': '(True)', 'editable': '(False)', 'on_delete': 'models.CASCADE', 'related_name': '"""initiated_connection_requests"""'}), "('profiles.UserProfile', null=True, blank=True, editable=\n False, o... |
#!/usr/bin/env python3
# quirks:
# doesn't redefine the 'import base64' of https://docs.python.org/3/library/base64.html
import sys
sys.stderr.write("base64.py: error: not implemented\n")
sys.exit(2) # exit 2 from rejecting usage
# copied from: git clone https://github.com/pelavarre/pybashish.git
| [
"sys.stderr.write",
"sys.exit"
] | [((135, 190), 'sys.stderr.write', 'sys.stderr.write', (['"""base64.py: error: not implemented\n"""'], {}), "('base64.py: error: not implemented\\n')\n", (151, 190), False, 'import sys\n'), ((191, 202), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (199, 202), False, 'import sys\n')] |
from django.core.urlresolvers import reverse
import factory
import factory.fuzzy
from .. import models
from nodeconductor.structure.tests import factories as structure_factories
class PlanFactory(factory.DjangoModelFactory):
class Meta(object):
model = models.Plan
name = factory.Sequence(lambda n: '... | [
"factory.SubFactory",
"factory.fuzzy.FuzzyFloat",
"factory.Sequence",
"django.core.urlresolvers.reverse"
] | [((292, 332), 'factory.Sequence', 'factory.Sequence', (["(lambda n: 'plan%s' % n)"], {}), "(lambda n: 'plan%s' % n)\n", (308, 332), False, 'import factory\n'), ((345, 379), 'factory.fuzzy.FuzzyFloat', 'factory.fuzzy.FuzzyFloat', (['(0)', '(20000)'], {}), '(0, 20000)\n', (369, 379), False, 'import factory\n'), ((804, 83... |
"""
ASGI config for majestic-monolith-django project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
ENV = os.environ.g... | [
"os.environ.setdefault",
"django.core.asgi.get_asgi_application",
"os.environ.get"
] | [((308, 338), 'os.environ.get', 'os.environ.get', (['"""ENV"""', '"""local"""'], {}), "('ENV', 'local')\n", (322, 338), False, 'import os\n'), ((339, 434), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', 'f"""majestic-monolith-django.settings.{ENV}"""'], {}), "('DJANGO_SETTINGS_MODUL... |
import random
import cv2
from torchvision import transforms
import torchvision.transforms.functional as ttf
from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
import os
import PIL
def makecon():
path1 = "./dataset/DRIVE/test/1st_manual/"
path2 = "./dataset/DRIVE/... | [
"numpy.array",
"PIL.Image.fromarray",
"PIL.Image.open"
] | [((706, 731), 'PIL.Image.open', 'PIL.Image.open', (['img1_path'], {}), '(img1_path)\n', (720, 731), False, 'import PIL\n'), ((756, 781), 'PIL.Image.open', 'PIL.Image.open', (['img2_path'], {}), '(img2_path)\n', (770, 781), False, 'import PIL\n'), ((1313, 1327), 'numpy.array', 'np.array', (['img1'], {}), '(img1)\n', (13... |
import time
from seleniumbase import BaseCase
import cv2
class ComponentsTest(BaseCase):
def test_basic(self):
# open the app and take a screenshot
self.open(
"https://share.streamlit.io/raahoolkumeriya/\
whatsapp-chat-streamlit/main/app.py")
time.sleep(10) #... | [
"cv2.countNonZero",
"time.sleep",
"cv2.split",
"cv2.subtract",
"cv2.imread"
] | [((303, 317), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (313, 317), False, 'import time\n'), ((596, 662), 'cv2.imread', 'cv2.imread', (['"""visual_baseline/test_basic/first_test/screenshot.png"""'], {}), "('visual_baseline/test_basic/first_test/screenshot.png')\n", (606, 662), False, 'import cv2\n'), ((696,... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""=================================================================
@Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3
@File : LC-2028-Find-Missing-Observations.py
@Author : [YuweiYin](https://github.com/YuweiYin)
@Date : 2022-03-27
=========================... | [
"time.process_time"
] | [((3538, 3557), 'time.process_time', 'time.process_time', ([], {}), '()\n', (3555, 3557), False, 'import time\n'), ((3616, 3635), 'time.process_time', 'time.process_time', ([], {}), '()\n', (3633, 3635), False, 'import time\n')] |
from sklearn.externals import joblib
import numpy as np
np.random.seed(1337)
def gen_data(pos, neg, niter=100):
n = pos.shape[0]
nn = neg.shape[0]
pos_lst = []
neg_lst = []
for i in range(niter):
idx_pos = np.random.choice(range(n), size=n * 2, replace=True)
idx_neg = np.random.ch... | [
"sklearn.externals.joblib.load",
"numpy.random.seed",
"sklearn.externals.joblib.dump"
] | [((57, 77), 'numpy.random.seed', 'np.random.seed', (['(1337)'], {}), '(1337)\n', (71, 77), True, 'import numpy as np\n'), ((487, 517), 'sklearn.externals.joblib.load', 'joblib.load', (['"""data/sg_div.pkl"""'], {}), "('data/sg_div.pkl')\n", (498, 517), False, 'from sklearn.externals import joblib\n'), ((526, 550), 'skl... |
from litex.soc.integration.soc_core import mem_decoder
from litex.soc.integration.soc_sdram import *
from liteeth.common import convert_ip
from liteeth.core import LiteEthUDPIPCore
from liteeth.frontend.etherbone import LiteEthEtherbone
from liteeth.mac import LiteEthMAC
from liteeth.phy import LiteEthPHY
from target... | [
"targets.arty.base.SoC.__init__",
"liteeth.core.LiteEthUDPIPCore",
"liteeth.frontend.etherbone.LiteEthEtherbone"
] | [((672, 721), 'targets.arty.base.SoC.__init__', 'BaseSoC.__init__', (['self', 'platform', '*args'], {}), '(self, platform, *args, **kwargs)\n', (688, 721), True, 'from targets.arty.base import SoC as BaseSoC\n'), ((1194, 1323), 'liteeth.core.LiteEthUDPIPCore', 'LiteEthUDPIPCore', ([], {'phy': 'self.ethphy', 'mac_addres... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 22 17:00:38 2020
@author: thales
"""
"""production rules for Colada"""
import copy
import msg
import word_lists
import lib
import lexer
import parser_combinator as c
from parser_combinator import (Parse, ParseError,
... | [
"parser_combinator.synonymize",
"parser_combinator.next_word",
"parser_combinator.balanced",
"parser_combinator.singularize",
"copy.copy",
"parser_combinator.can_wordify",
"parser_combinator.first_word",
"parser_combinator.Parse",
"parser_combinator.ParseError",
"parser_combinator.update",
"pars... | [((6469, 6484), 'parser_combinator.next_value', 'next_value', (['""","""'], {}), "(',')\n", (6479, 6484), False, 'from parser_combinator import Parse, ParseError, first_word, first_phrase, next_word, next_phrase, next_value\n'), ((6497, 6512), 'parser_combinator.next_value', 'next_value', (['""";"""'], {}), "(';')\n", ... |
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Generates C++ code representing structured data objects from schema.org
This script generates C++ objects based on a JSON+LD schema file. Blink uses the
g... | [
"os.path.realpath",
"os.path.join",
"argparse.ArgumentParser",
"jinja2.PackageLoader"
] | [((462, 488), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (478, 488), False, 'import os\n'), ((642, 706), 'os.path.join', 'os.path.join', (['_current_dir', "*([os.pardir] * 2 + ['third_party'])"], {}), "(_current_dir, *([os.pardir] * 2 + ['third_party']))\n", (654, 706), False, 'import o... |
#!/usr/bin/python
DOCUMENTATION = '''
---
module: jmsierra.oracle.user
short_description: Manage users/schemas in an Oracle database
description:
- Manage users/schemas in an Oracle database
- Can be run locally on the controlmachine or on a remote host
version_added: "0.2.0"
options:
hostname:
des... | [
"cx_Oracle.connect",
"cx_Oracle.makedsn"
] | [((15699, 15755), 'cx_Oracle.connect', 'cx_Oracle.connect', (['wallet_connect'], {'mode': 'cx_Oracle.SYSDBA'}), '(wallet_connect, mode=cx_Oracle.SYSDBA)\n', (15716, 15755), False, 'import cx_Oracle\n'), ((15838, 15871), 'cx_Oracle.connect', 'cx_Oracle.connect', (['wallet_connect'], {}), '(wallet_connect)\n', (15855, 15... |
import json
from twisted.logger import Logger
from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.wamp import ApplicationSession
from autobahn.twisted.wamp import ApplicationRunner
from bokeh.client import push_session
from bokeh.plotting import figure, curdoc
from bokeh.models.widgets import Pan... | [
"json.loads",
"bokeh.models.Range1d",
"autobahn.twisted.wamp.ApplicationRunner",
"numpy.array",
"autobahn.twisted.wamp.ApplicationSession.__init__",
"pandas.DataFrame",
"bokeh.plotting.curdoc"
] | [((4273, 4339), 'autobahn.twisted.wamp.ApplicationRunner', 'ApplicationRunner', ([], {'url': 'u"""ws://localhost:55058/ws"""', 'realm': 'u"""realm1"""'}), "(url=u'ws://localhost:55058/ws', realm=u'realm1')\n", (4290, 4339), False, 'from autobahn.twisted.wamp import ApplicationRunner\n'), ((492, 533), 'autobahn.twisted.... |
from __future__ import division, absolute_import, print_function
import unittest
import numpy.testing as testing
import numpy as np
import healpy as hp
import healsparse
class CoverageMapTestCase(unittest.TestCase):
def test_coverage_map_float(self):
"""
Test coverage_map functionality for floats... | [
"numpy.testing.assert_warns",
"healsparse.utils.check_sentinel",
"numpy.testing.assert_array_almost_equal",
"numpy.unique",
"healsparse.HealSparseMap",
"numpy.ones",
"healsparse.HealSparseMap.make_empty",
"healpy.nside2npix",
"unittest.main"
] | [((5839, 5854), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5852, 5854), False, 'import unittest\n'), ((750, 827), 'healsparse.HealSparseMap', 'healsparse.HealSparseMap', ([], {'healpix_map': 'full_map', 'nside_coverage': 'nside_coverage'}), '(healpix_map=full_map, nside_coverage=nside_coverage)\n', (774, 827)... |
# -*- coding: utf-8 -*-
"""
Spyder Editor
DATE:19/04/2020
Information theory and coding
Title:(7,4) systematic cyclic codes Encoder
Author:<NAME>
17BEC02
IIIT Dharwad
"""
######################### ENCODER ######################################################
import numpy as np
import pandas as pd
... | [
"numpy.polymul",
"numpy.polydiv",
"numpy.polyadd",
"numpy.poly1d",
"numpy.mod"
] | [((583, 596), 'numpy.poly1d', 'np.poly1d', (['ip'], {}), '(ip)\n', (592, 596), True, 'import numpy as np\n'), ((603, 619), 'numpy.poly1d', 'np.poly1d', (['gen_p'], {}), '(gen_p)\n', (612, 619), True, 'import numpy as np\n'), ((719, 747), 'numpy.polymul', 'np.polymul', (['[1, 0, 0, 0]', 'ip'], {}), '([1, 0, 0, 0], ip)\n... |
#!/usr/bin/env python
# This is largely adopted from https://github.com/enode-engineering/tesla-oauth2
import base64
import hashlib
import os
import sys
import re
import random
import time
import argparse
import json
from urllib.parse import parse_qs
import requests
MAX_ATTEMPTS = 7
CLIENT_ID = "81527cff06843c8634fd... | [
"hashlib.sha256",
"requests.Session",
"base64.urlsafe_b64encode",
"os.urandom",
"time.sleep",
"urllib.parse.parse_qs",
"time.time",
"re.search"
] | [((709, 723), 'os.urandom', 'os.urandom', (['(86)'], {}), '(86)\n', (719, 723), False, 'import os\n'), ((9549, 9567), 'requests.Session', 'requests.Session', ([], {}), '()\n', (9565, 9567), False, 'import requests\n'), ((2050, 2068), 'requests.Session', 'requests.Session', ([], {}), '()\n', (2066, 2068), False, 'import... |
import re
from bs4 import BeautifulSoup
class HtmlExtractor:
header_regex = re.compile("^h[1-6]{1}$")
excluded_headings = [
"Tell us whether you accept cookies"
]
@classmethod
def extract_headings(cls, html):
soup = BeautifulSoup(html, 'html5lib')
matches = soup.find_all(c... | [
"bs4.BeautifulSoup",
"re.compile"
] | [((82, 107), 're.compile', 're.compile', (['"""^h[1-6]{1}$"""'], {}), "('^h[1-6]{1}$')\n", (92, 107), False, 'import re\n'), ((255, 286), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html5lib"""'], {}), "(html, 'html5lib')\n", (268, 286), False, 'from bs4 import BeautifulSoup\n')] |
# Generated by Django 3.0.4 on 2020-03-30 13:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('paint', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='delivers',
name='Delivery... | [
"django.db.models.CharField"
] | [((349, 470), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('1', 'DELIVERED'), ('2', 'NOT DELIVERED')]", 'max_length': '(50)', 'verbose_name': '"""Delivery Status"""'}), "(choices=[('1', 'DELIVERED'), ('2', 'NOT DELIVERED')],\n max_length=50, verbose_name='Delivery Status')\n", (365, 470), Fa... |
from sqlalchemy import func
from app import db
class Category(db.Model):
__tablename__ = 'category'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
parent_id = db.Column(db.Integer, db.ForeignKey('category.id'), nullable=True)
last_updated = db.Column(db.DateTime(timezone... | [
"sqlalchemy.func.now",
"app.db.backref",
"app.db.Column",
"app.db.ForeignKey",
"app.db.DateTime"
] | [((116, 155), 'app.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (125, 155), False, 'from app import db\n'), ((167, 187), 'app.db.Column', 'db.Column', (['db.String'], {}), '(db.String)\n', (176, 187), False, 'from app import db\n'), ((368, 404), 'app.db.Colum... |
# Copyright 2019 AT&T Intellectual Property. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | [
"paramiko.RSAKey.from_private_key_file",
"io.BytesIO",
"yaml.load",
"robot.libraries.BuiltIn.BuiltIn",
"copy.deepcopy",
"ONAPLibrary.Utilities.Utilities",
"json.dump"
] | [((1196, 1207), 'ONAPLibrary.Utilities.Utilities', 'Utilities', ([], {}), '()\n', (1205, 1207), False, 'from ONAPLibrary.Utilities import Utilities\n'), ((1231, 1240), 'robot.libraries.BuiltIn.BuiltIn', 'BuiltIn', ([], {}), '()\n', (1238, 1240), False, 'from robot.libraries.BuiltIn import BuiltIn\n'), ((1569, 1583), 'y... |
from .geohash_base import encode, bbox, expand
from .distance_metrics import distance, dimensions
from math import sqrt
from shapely.geometry import Polygon
from shapely.ops import unary_union
# Note: (lat, lon) are essentially in the (y, x) format in the cartesian plane.
# shapely works with/assumes coordinates in ... | [
"shapely.geometry.Polygon",
"shapely.ops.unary_union",
"math.sqrt"
] | [((499, 526), 'math.sqrt', 'sqrt', (['(a[0] ** 2 + a[1] ** 2)'], {}), '(a[0] ** 2 + a[1] ** 2)\n', (503, 526), False, 'from math import sqrt\n'), ((1041, 1062), 'shapely.ops.unary_union', 'unary_union', (['polygons'], {}), '(polygons)\n', (1052, 1062), False, 'from shapely.ops import unary_union\n'), ((892, 907), 'shap... |
""" PyMarkowitz command line utility """
import argparse as ap
from matplotlib.pyplot import show, style
from markowitz.parser import from_file
from markowitz.loader import Loader
from markowitz import consumme_window
def build_arg_parser():
""" Argument Parser """
parser = ap.ArgumentParser(
prog=... | [
"argparse.ArgumentParser",
"markowitz.loader.Loader",
"markowitz.consumme_window",
"matplotlib.pyplot.style.use",
"markowitz.parser.from_file",
"matplotlib.pyplot.show"
] | [((288, 456), 'argparse.ArgumentParser', 'ap.ArgumentParser', ([], {'prog': '"""PyMarkowitz"""', 'description': '"""Display Assets and Portfolio Graphs from Layout Files"""', 'usage': '"""%(prog)s [options] LAYOUT INPUT [INPUT...]"""'}), "(prog='PyMarkowitz', description=\n 'Display Assets and Portfolio Graphs from ... |
import json
import os
import sys
from glob import glob
from tasks.utils import *
TASK = sys.argv[1]
MODEL = sys.argv[2]
METHOD = sys.argv[3]
SPECIAL_METRICS = {
'cb' : 'f1',
'mrpc' : 'f1',
'cola' : 'matthews_correlation',
'stsb' : 'combined_score'
}
METRIC = "accuracy"
if TASK in SPECIAL_METRICS:
... | [
"glob.glob"
] | [((380, 455), 'glob.glob', 'glob', (['f"""./checkpoints/{TASK}-{MODEL}-search{METHOD}/*/predict_results.json"""'], {}), "(f'./checkpoints/{TASK}-{MODEL}-search{METHOD}/*/predict_results.json')\n", (384, 455), False, 'from glob import glob\n')] |
# -*- coding: utf-8 -*-
from django.db.models.signals import post_save, post_delete
from .models import Menu, MenuItem
def menu_change_handler(sender, instance, **kwargs):
instance.delete_cache_data()
post_save.connect(menu_change_handler, Menu)
post_save.connect(menu_change_handler, MenuItem)
post_delete.conne... | [
"django.db.models.signals.post_save.connect",
"django.db.models.signals.post_delete.connect"
] | [((209, 253), 'django.db.models.signals.post_save.connect', 'post_save.connect', (['menu_change_handler', 'Menu'], {}), '(menu_change_handler, Menu)\n', (226, 253), False, 'from django.db.models.signals import post_save, post_delete\n'), ((254, 302), 'django.db.models.signals.post_save.connect', 'post_save.connect', ([... |
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
import cv2
from detection_functions.feature_extraction import *
from toolbox.draw_on_image import *
from detection_functions.sliding_window import *
# Define a function to extract features from a single image window
# This function... | [
"numpy.copy",
"numpy.array",
"numpy.int",
"numpy.concatenate",
"cv2.cvtColor",
"cv2.GaussianBlur",
"numpy.zeros_like"
] | [((7344, 7363), 'numpy.array', 'np.array', (['bbox_list'], {}), '(bbox_list)\n', (7352, 7363), True, 'import numpy as np\n'), ((7723, 7742), 'numpy.array', 'np.array', (['bbox_list'], {}), '(bbox_list)\n', (7731, 7742), True, 'import numpy as np\n'), ((854, 866), 'numpy.copy', 'np.copy', (['img'], {}), '(img)\n', (861,... |
from django.urls import reverse
from django.utils import timezone
from faker import Faker
from test_plus import TestCase
from forum.categories.models import Category, CategoryQuerySet
from forum.comments.tests.utils import make_comment
from forum.threads.models import Thread, ThreadFollowership, ThreadRevision
fake ... | [
"forum.comments.tests.utils.make_comment",
"forum.threads.models.ThreadFollowership.objects.toggle",
"faker.Faker",
"django.utils.timezone.now",
"forum.categories.models.Category.objects.create"
] | [((322, 329), 'faker.Faker', 'Faker', ([], {}), '()\n', (327, 329), False, 'from faker import Faker\n'), ((458, 526), 'forum.categories.models.Category.objects.create', 'Category.objects.create', ([], {'title': '"""progromming group"""', 'description': '"""NA"""'}), "(title='progromming group', description='NA')\n", (4... |
import sys
import semver
from dulwich import porcelain
from dulwich.client import get_transport_and_path
from dulwich.objectspec import parse_reftuples
with porcelain.open_repo_closing(".") as repo:
latest_version = None
latest_version_ref = None
for ref in repo.refs.as_dict(b"refs/tags"):
if re... | [
"semver.compare",
"dulwich.porcelain.open_repo_closing",
"dulwich.client.get_transport_and_path"
] | [((160, 192), 'dulwich.porcelain.open_repo_closing', 'porcelain.open_repo_closing', (['"""."""'], {}), "('.')\n", (187, 192), False, 'from dulwich import porcelain\n'), ((730, 798), 'dulwich.client.get_transport_and_path', 'get_transport_and_path', (['"""git://github.com/godfoder/dulwitch_selfref"""'], {}), "('git://gi... |
import dash
import dash_table
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import dash_dangerously_set_inner_html
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate
import plotly.express as px
import plotly.graph... | [
"dash_html_components.Button",
"io.BytesIO",
"dash.dependencies.Input",
"preprocess.preprocess_corpus",
"helpers.get_sentiment",
"helpers.cleaned_reviews_dataframe",
"dash_bootstrap_components.Col",
"dash_html_components.Div",
"dash.Dash",
"reviewmodel.ReviewLDA",
"plotly.express.scatter",
"da... | [((645, 747), 'dash.Dash', 'dash.Dash', (['__name__'], {'suppress_callback_exceptions': '(True)', 'external_stylesheets': 'external_stylesheets'}), '(__name__, suppress_callback_exceptions=True, external_stylesheets\n =external_stylesheets)\n', (654, 747), False, 'import dash\n'), ((3208, 3240), 'base64.b64decode', ... |
"""Microbe Directory tool module."""
from app.extensions import mongoDB
from app.tool_results.modules import SampleToolResultModule
from app.tool_results.models import ToolResult
class MicrobeDirectoryToolResult(ToolResult): # pylint: disable=too-few-public-methods
"""Microbe Directory result type."""
#... | [
"app.extensions.mongoDB.DynamicField"
] | [((372, 407), 'app.extensions.mongoDB.DynamicField', 'mongoDB.DynamicField', ([], {'required': '(True)'}), '(required=True)\n', (392, 407), False, 'from app.extensions import mongoDB\n'), ((429, 464), 'app.extensions.mongoDB.DynamicField', 'mongoDB.DynamicField', ([], {'required': '(True)'}), '(required=True)\n', (449,... |
# import os & csv
import os
import csv
# csv path
csvpath = os.path.join("Resources","election_data.csv")
# lists
count = 0
candidatelist = []
unique_candidate = []
vote_count = []
vote_percent = []
# open csv
with open(csvpath, newline="") as csvfile:
csvreader = csv.re... | [
"os.path.join",
"csv.reader"
] | [((74, 120), 'os.path.join', 'os.path.join', (['"""Resources"""', '"""election_data.csv"""'], {}), "('Resources', 'election_data.csv')\n", (86, 120), False, 'import os\n'), ((314, 348), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""","""'}), "(csvfile, delimiter=',')\n", (324, 348), False, 'import csv\n')] |
import math
import copy
import warnings
import numpy as np
from itertools import product
from analysis.abstract_interpretation import AbstractInterpretation
import parse.parse_format_text as parse_format_text
from solver import Range, Array
from utils import OVERFLOW_LIMIT, UNDERFLOW_LIMIT, resolve_type
turn_on_bool ... | [
"math.floor",
"solver.Range",
"numpy.int32",
"numpy.log",
"math.sqrt",
"math.log",
"numpy.array",
"copy.deepcopy",
"analysis.abstract_interpretation.AbstractInterpretation",
"numpy.arange",
"numpy.reshape",
"itertools.product",
"numpy.tanh",
"numpy.max",
"numpy.exp",
"numpy.linspace",
... | [((1708, 1757), 'solver.Range', 'Range', ([], {'left': '(-OVERFLOW_LIMIT)', 'right': 'OVERFLOW_LIMIT'}), '(left=-OVERFLOW_LIMIT, right=OVERFLOW_LIMIT)\n', (1713, 1757), False, 'from solver import Range, Array\n'), ((1934, 1947), 'numpy.array', 'np.array', (['ans'], {}), '(ans)\n', (1942, 1947), True, 'import numpy as n... |
"""Create an icosphere from convex regular polyhedron.
Adapted from:
https://gist.github.com/AbhilashReddyM/aed58c60438bf4c313831718013ce48f
Thank you <NAME> (abhilashreddy.com)!
Original authorship:
Author: <NAME>
(<EMAIL> where cu=columbia.edu) (github.com/wgm2111)
copyright (c) 2010
liscence: BSD style
Modifie... | [
"numpy.mean",
"numpy.sqrt",
"matplotlib.tri.Triangulation",
"numpy.tensordot",
"numpy.min",
"numpy.max",
"numpy.inner",
"numpy.array",
"numpy.zeros",
"numpy.empty_like",
"numpy.arctan2",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin",
"numpy.arange"
] | [((1175, 1220), 'numpy.empty_like', 'numpy.empty_like', (['self.triangles'], {'dtype': 'float'}), '(self.triangles, dtype=float)\n', (1191, 1220), False, 'import numpy\n'), ((1596, 1614), 'numpy.array', 'numpy.array', (['edges'], {}), '(edges)\n', (1607, 1614), False, 'import numpy\n'), ((1667, 1708), 'numpy.empty_like... |
import vnmrjpy as vj
import unittest
import numpy as np
import glob
from vnmrjpy.func import concatenate
from vnmrjpy.core.utils import FitViewer3D
from nibabel.viewers import OrthoSlicer3D
import copy
def load_data():
b0dir = vj.config['dataset_dir'] + '/parameterfit/b0/gems'
seqlist = sorted(glob.glob(b0... | [
"vnmrjpy.read_fid",
"nibabel.viewers.OrthoSlicer3D",
"vnmrjpy.func.concatenate",
"vnmrjpy.func.make_fieldmap",
"glob.glob"
] | [((601, 623), 'vnmrjpy.func.concatenate', 'concatenate', (['varr_list'], {}), '(varr_list)\n', (612, 623), False, 'from vnmrjpy.func import concatenate\n'), ((735, 799), 'vnmrjpy.func.make_fieldmap', 'vj.func.make_fieldmap', (['varr'], {'method': '"""triple_echo"""', 'selfmask': '(True)'}), "(varr, method='triple_echo'... |
import time
import threading
from typing import Any, Iterable
from collections import deque
class Queue:
def __init__(self):
self.mutex = threading.Lock()
self.condition = threading.Condition(self.mutex)
self.queue = deque()
@property
def is_empty(self) -> bool:
return len... | [
"collections.deque",
"threading.Lock",
"time.sleep",
"threading.Thread",
"threading.Condition"
] | [((1456, 1500), 'threading.Thread', 'threading.Thread', ([], {'target': 'consumer', 'args': '(q,)'}), '(target=consumer, args=(q,))\n', (1472, 1500), False, 'import threading\n'), ((1520, 1564), 'threading.Thread', 'threading.Thread', ([], {'target': 'producer', 'args': '(q,)'}), '(target=producer, args=(q,))\n', (1536... |
from utils.test_split import TestSplitter
if __name__ == "__main__":
PARAMS = {
"BASE_DATA_DIR": "./data/metadata",
"NUM_K_FOLDS": 5,
"SEED": 42,
"STRATIFY_COL": "agecat",
"OUTPUT_PATH": "./data/metadata",
}
TestSplitter(PARAMS).get_no_leakage_trainval_test_splits()
| [
"utils.test_split.TestSplitter"
] | [((261, 281), 'utils.test_split.TestSplitter', 'TestSplitter', (['PARAMS'], {}), '(PARAMS)\n', (273, 281), False, 'from utils.test_split import TestSplitter\n')] |
import json
import time
import copy
import checkpoint as loader
import argparse
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
from torch.autograd import Variable
from torch import nn,optim
import torch
import torchvision
import torch.nn.functional as F
from torch import nn
from PIL impor... | [
"numpy.clip",
"torch.exp",
"torch.from_numpy",
"numpy.array",
"torch.cuda.is_available",
"torch.nn.functional.softmax",
"argparse.ArgumentParser",
"seaborn.color_palette",
"checkpoint",
"torchvision.transforms.ToTensor",
"torchvision.transforms.Resize",
"numpy.transpose",
"matplotlib.pyplot.... | [((784, 815), 'numpy.array', 'np.array', (['[0.485, 0.456, 0.406]'], {}), '([0.485, 0.456, 0.406])\n', (792, 815), True, 'import numpy as np\n'), ((826, 857), 'numpy.array', 'np.array', (['[0.229, 0.224, 0.225]'], {}), '([0.229, 0.224, 0.225])\n', (834, 857), True, 'import numpy as np\n'), ((992, 1012), 'numpy.clip', '... |
# Generated by Django 3.0.5 on 2020-05-11 01:56
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | [
"django.db.models.EmailField",
"django.db.models.OneToOneField",
"django.db.models.ManyToManyField",
"django.db.models.AutoField",
"django.db.models.ImageField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((247, 304), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (278, 304), False, 'from django.db import migrations, models\n'), ((440, 533), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
"""Wrapper to get an interactive shell on nc-based call backs
Also provide some zos and ssh pivoting specific commands"""
import argparse
import sys
import logging
from cmd import Cmd
from zosutils import StdIOtranscoder
class WrappingShell(Cmd):
"""Use StdIOtranscoder to get a trans-coded shell interface.
... | [
"logging.basicConfig",
"argparse.ArgumentParser",
"logging.info",
"zosutils.StdIOtranscoder",
"cmd.Cmd.preloop",
"cmd.Cmd.__init__"
] | [((3880, 3919), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (3899, 3919), False, 'import logging\n'), ((3956, 4057), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Wraps a CLI program stdin/stdout in an encoding converter"""'})... |
from persistence.models.models_base import Base
from sqlalchemy import Column, Integer, String
class Nst(Base):
__tablename__ = 'nst'
id = Column(String(40), primary_key=True)
name = Column(String(16))
template = Column(String(10000))
| [
"sqlalchemy.String"
] | [((157, 167), 'sqlalchemy.String', 'String', (['(40)'], {}), '(40)\n', (163, 167), False, 'from sqlalchemy import Column, Integer, String\n'), ((205, 215), 'sqlalchemy.String', 'String', (['(16)'], {}), '(16)\n', (211, 215), False, 'from sqlalchemy import Column, Integer, String\n'), ((239, 252), 'sqlalchemy.String', '... |
import scipy.io
import numpy as np
import os
import random
import json
import pdb
def split_voxel_then_image(cls):
# , 'depth_render_{}'.format(cls[7:])
root = os.path.abspath('.')
in_dir = os.path.join(root, '../input/3dprnn/depth_map')
pre_match_id_file = os.path.join(in_dir, '../random_sample_id_mu... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"numpy.array",
"os.path.abspath"
] | [((170, 190), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (185, 190), False, 'import os\n'), ((204, 251), 'os.path.join', 'os.path.join', (['root', '"""../input/3dprnn/depth_map"""'], {}), "(root, '../input/3dprnn/depth_map')\n", (216, 251), False, 'import os\n'), ((276, 331), 'os.path.join', 'o... |
import pytube
vid = pytube.YouTube('https://www.youtube.com/watch?v=9bZkp7q19f0')
stream = vid.streams.get_by_itag(251)
stream.download() | [
"pytube.YouTube"
] | [((20, 81), 'pytube.YouTube', 'pytube.YouTube', (['"""https://www.youtube.com/watch?v=9bZkp7q19f0"""'], {}), "('https://www.youtube.com/watch?v=9bZkp7q19f0')\n", (34, 81), False, 'import pytube\n')] |
import argparse
import multiprocessing
import os
import sys
_NUM_CPUS = multiprocessing.cpu_count()
import tensorflow as tf
import tqdm
import datasets
def _bytes_feature(value):
"""Returns a bytes_list from a string / byte."""
_bytes = value if not (isinstance(value, str) and sys.version_info[0] == 3) \
... | [
"tensorflow.round",
"tensorflow.equal",
"tensorflow.shape",
"datasets.Generic",
"tensorflow.io.read_file",
"tensorflow.logging.set_verbosity",
"multiprocessing.cpu_count",
"tensorflow.train.Int64List",
"tensorflow.control_dependencies",
"sys.exit",
"sys.stdin.read",
"tensorflow.cast",
"os.pa... | [((73, 100), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (98, 100), False, 'import multiprocessing\n'), ((1359, 1397), 'tensorflow.constant', 'tf.constant', (['[0, 0, 0]'], {'dtype': 'tf.int32'}), '([0, 0, 0], dtype=tf.int32)\n', (1370, 1397), True, 'import tensorflow as tf\n'), ((1412, ... |
import pytest
from molecules import *
def test_valid_molecule_success():
assert isinstance(Protein('ProteinA'), Protein)
assert isinstance(Protein('ProteinB', 'ARND'), Protein)
assert isinstance(Ribo('free'), Ribo)
assert isinstance(MRNA('mRNA1'), MRNA)
assert isinstance(MRNA('mRNA2', 'ACU'), MR... | [
"pytest.raises",
"pytest.main"
] | [((2659, 2693), 'pytest.main', 'pytest.main', (["['test_molecules.py']"], {}), "(['test_molecules.py'])\n", (2670, 2693), False, 'import pytest\n'), ((370, 395), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError)\n', (383, 395), False, 'import pytest\n'), ((441, 466), 'pytest.raises', 'pytest.raises'... |
#!/usr/bin/env python3
'''__main__.py'''
# Internal Libraries
import os
import sys
import tempfile
# Included Libraries
import auto_editor
import auto_editor.vanparse as vanparse
import auto_editor.utils.func as usefulfunctions
from auto_editor.utils.progressbar import ProgressBar
from auto_editor.utils.func import ... | [
"auto_editor.utils.func.human_readable_time",
"auto_editor.validate_input.valid_input",
"platform.release",
"sys.exit",
"auto_editor.ffwrapper.FFmpeg",
"auto_editor.utils.log.Timer",
"os.listdir",
"platform.system",
"os.path.isdir",
"os.mkdir",
"auto_editor.vanparse.ArgumentParser",
"auto_edit... | [((13016, 13557), 'auto_editor.vanparse.ArgumentParser', 'vanparse.ArgumentParser', (['"""Auto-Editor"""', 'auto_editor.version'], {'description': '"""\nAuto-Editor is an automatic video/audio creator and editor. By default, it will detect silence and create a new video with those sections cut out. By changing some of ... |
""" fivethirtyeight baseball puzzle
This code computes exact runs-scored probabilities, using the
negative binomial distribution and convolutions of the runs-scored
distributions
"""
import argparse
import numpy as np
import pandas as pd
from collections import defaultdict
from scipy.stats import distributions
from f... | [
"numpy.sqrt",
"argparse.ArgumentParser",
"collections.defaultdict",
"functools.partial",
"copy.deepcopy",
"pandas.DataFrame"
] | [((4194, 4219), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4217, 4219), False, 'import argparse\n'), ((652, 711), 'functools.partial', 'partial', (['distributions.nbinom.pmf'], {'n': '(3)', 'p': 'self.failure_prob'}), '(distributions.nbinom.pmf, n=3, p=self.failure_prob)\n', (659, 711), Fa... |
# generate an input file containing the structure of a two-level graph
# first line is the number of domains
# next n lines are the number of webpages in each domain
# other lines are links represented in "A B C D" form where A is source's domain, B is source's name, C is destination's domain, and D is destination's na... | [
"random.randint"
] | [((950, 967), 'random.randint', 'randint', (['(0)', '(n - 1)'], {}), '(0, n - 1)\n', (957, 967), False, 'from random import randint\n'), ((1036, 1053), 'random.randint', 'randint', (['(0)', '(n - 1)'], {}), '(0, n - 1)\n', (1043, 1053), False, 'from random import randint\n'), ((613, 640), 'random.randint', 'randint', (... |
import requests
from bs4 import BeautifulSoup
import re
URL = 'https://kwork.ru/projects?c=15'
HEADERS = {"user-agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)"
"Chrome/83.0.4103.106 Safari/537.36", "accept": "*/*"}
def get_html(url, params=N... | [
"bs4.BeautifulSoup",
"re.sub",
"requests.get"
] | [((335, 384), 'requests.get', 'requests.get', (['url'], {'headers': 'HEADERS', 'params': 'params'}), '(url, headers=HEADERS, params=params)\n', (347, 384), False, 'import requests\n'), ((440, 474), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (453, 474), False, '... |
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth.models import User
from datetime import datetime
from http import HTTPStatus
from .forms import CheckoutForm, CouponForm, RefundForm, PaymentForm
from .models import Item, OrderItem, Address, Payment, Coupon, Order, Refund
class... | [
"datetime.datetime.now",
"django.contrib.auth.models.User.objects.create",
"django.urls.reverse"
] | [((403, 441), 'django.contrib.auth.models.User.objects.create', 'User.objects.create', ([], {'username': '"""Tester"""'}), "(username='Tester')\n", (422, 441), False, 'from django.contrib.auth.models import User\n'), ((6178, 6207), 'django.urls.reverse', 'reverse', (['"""core:order-summary"""'], {}), "('core:order-summ... |
import disnake as discord
from disnake.ext import commands
from datetime import datetime
from api.server import base, main
class OnMemberUnBan(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_member_unban(self, guild, user):
if base.gui... | [
"disnake.ext.commands.Cog.listener",
"api.server.main.get_lang",
"api.server.base.guild",
"datetime.datetime.utcnow"
] | [((226, 249), 'disnake.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (247, 249), False, 'from disnake.ext import commands\n'), ((312, 329), 'api.server.base.guild', 'base.guild', (['guild'], {}), '(guild)\n', (322, 329), False, 'from api.server import base, main\n'), ((698, 715), 'datetime.date... |
from math import ceil
from math import log2
from math import floor
mod = int(1e9+7)
def fast_exp(x, exp):
ans = 1
base = x
while exp:
if exp & 1:
ans *= base
base *= base
base %= mod
ans %= mod
exp >>= 1
return ans
n, k = [int(x) for x in input().s... | [
"math.log2"
] | [((395, 402), 'math.log2', 'log2', (['n'], {}), '(n)\n', (399, 402), False, 'from math import log2\n'), ((352, 363), 'math.log2', 'log2', (['(n + 1)'], {}), '(n + 1)\n', (356, 363), False, 'from math import log2\n')] |
from naoqi import ALProxy
# Once the Nao is up, press its power button in his chest and Nao will
# announce his IP. put that below.
NAO_IP="192.168.1.7" # <YOUR_NAO_IP> or nao.local
tts = ALProxy("ALTextToSpeech", NAO_IP, 9559)
tts.say("Hello, world!")
| [
"naoqi.ALProxy"
] | [((192, 231), 'naoqi.ALProxy', 'ALProxy', (['"""ALTextToSpeech"""', 'NAO_IP', '(9559)'], {}), "('ALTextToSpeech', NAO_IP, 9559)\n", (199, 231), False, 'from naoqi import ALProxy\n')] |
from .session import ClientSession
from .endpoints import (
LiveEndpointsMixin,
VREndpointsMixin,
RoomEndpointsMixin,
UserEndpointsMixin,
OtherEndpointsMixin
)
from json import JSONDecodeError
import time
from showroom.api.utils import get_csrf_token
from requests.exceptions import HTTPError
import ... | [
"logging.getLogger",
"showroom.api.utils.get_csrf_token",
"time.time"
] | [((507, 543), 'logging.getLogger', 'logging.getLogger', (['"""showroom.client"""'], {}), "('showroom.client')\n", (524, 543), False, 'import logging\n'), ((2051, 2073), 'showroom.api.utils.get_csrf_token', 'get_csrf_token', (['r.text'], {}), '(r.text)\n', (2065, 2073), False, 'from showroom.api.utils import get_csrf_to... |
from src.core.validations import delete_product_order_validation as validate
class DeleteProduct_Order:
def __init__(self, product_order_repository):
self.product_order_repository = product_order_repository
def delete_product_order(self, product_order_id):
invalid_inputs = validate(product_o... | [
"src.core.validations.delete_product_order_validation"
] | [((302, 345), 'src.core.validations.delete_product_order_validation', 'validate', ([], {'product_order_id': 'product_order_id'}), '(product_order_id=product_order_id)\n', (310, 345), True, 'from src.core.validations import delete_product_order_validation as validate\n')] |
from django.db import models
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
email = models.EmailField(verbose_name='email', max_length=100, unique=True)
phone = models.CharField(null=True, max_length=50)
# add fields you would like to update in database
REQUIRED_FIELDS ... | [
"django.db.models.EmailField",
"django.db.models.DateField",
"django.db.models.TimeField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.DecimalField",
"django.db.models.CharField"
] | [((121, 189), 'django.db.models.EmailField', 'models.EmailField', ([], {'verbose_name': '"""email"""', 'max_length': '(100)', 'unique': '(True)'}), "(verbose_name='email', max_length=100, unique=True)\n", (138, 189), False, 'from django.db import models\n'), ((202, 244), 'django.db.models.CharField', 'models.CharField'... |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"upvote.gae.datastore.utils.GetNoOpFuture",
"google.appengine.ext.ndb.get_multi_async",
"webapp2.Route",
"upvote.gae.datastore.models.binary.Blockable.get_by_id",
"google.appengine.ext.ndb.Key",
"upvote.gae.datastore.models.event.Event.query",
"upvote.gae.datastore.models.vote.Vote.GetKey",
"logging.i... | [((2265, 2325), 'google.appengine.ext.ndb.get_multi_async', 'ndb.get_multi_async', (['(event.blockable_key for event in events)'], {}), '(event.blockable_key for event in events)\n', (2284, 2325), False, 'from google.appengine.ext import ndb\n'), ((6906, 6953), 'upvote.gae.datastore.models.binary.Blockable.get_by_id', ... |
# Generated by Django 3.2.11 on 2022-03-25 08:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('common', '0016_auto_20220215_1721'),
('staff', '0004_servicerequest'),
]
operations = [
migrations... | [
"django.db.models.ForeignKey"
] | [((419, 565), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'related_name': '"""default_facility"""', 'to': '"""common.facility"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.SET_NULL, related_... |
"""Some examples of simple plots."""
import matplotlib.pyplot as plt
from tailored import get_data
db = get_data()
## A simple heatmap of the sea surface temperature
db.load(time=0)
fig, ax = plt.subplots()
im = db.imshow(ax, 'SST', time_idx=0)
im.add_colorbar()
im.set_labels()
## We loop over time to create... | [
"tailored.get_data",
"matplotlib.pyplot.subplots"
] | [((107, 117), 'tailored.get_data', 'get_data', ([], {}), '()\n', (115, 117), False, 'from tailored import get_data\n'), ((199, 213), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (211, 213), True, 'import matplotlib.pyplot as plt\n'), ((376, 390), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {})... |
#!../../../../virtualenv/bin/python3
# -*- coding: utf-8 -*-
# NB: The shebang line above assumes you've installed a python virtual environment alongside your working copy of the
# <4most-4gp-scripts> git repository. It also only works if you invoke this python script from the directory where it
# is located. If these... | [
"logging.basicConfig",
"logging.getLogger",
"fourgp_speclib.SpectrumLibrarySqlite",
"argparse.ArgumentParser",
"os.path.join",
"os.path.split",
"astropy.io.fits.open",
"os.path.abspath",
"numpy.zeros_like",
"glob.glob"
] | [((1024, 1061), 'os.path.join', 'os_path.join', (['our_path', '"""../../../.."""'], {}), "(our_path, '../../../..')\n", (1036, 1061), True, 'from os import path as os_path\n'), ((1096, 1140), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (1119, 1140),... |
from os import path
from django.core.management.base import BaseCommand
from uwsgiconf.sysinit import get_config, TYPE_SYSTEMD
from uwsgiconf.utils import Finder
from ...toolbox import SectionMutator
class Command(BaseCommand):
help = 'Generates configuration files for Systemd, Upstart, etc.'
def add_argu... | [
"uwsgiconf.utils.Finder.python",
"os.path.join"
] | [((1546, 1582), 'os.path.join', 'path.join', (['mutator.dir_base', 'command'], {}), '(mutator.dir_base, command)\n', (1555, 1582), False, 'from os import path\n'), ((1603, 1618), 'uwsgiconf.utils.Finder.python', 'Finder.python', ([], {}), '()\n', (1616, 1618), False, 'from uwsgiconf.utils import Finder\n')] |
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
df = pd.read_csv('../data/model_128x4_64_64_2.csv', index_col=None)
#df = pd.read_csv('../data/model_20x5_30x4_42_7_2.csv', index_col=None)
df.columns = ['agent', 'rate']
df['x100'] = range(0, len(df))
plt.figure(figsize=(14,6))
fig = sns.line... | [
"seaborn.lineplot",
"matplotlib.pyplot.figure",
"pandas.read_csv",
"matplotlib.pyplot.show"
] | [((81, 143), 'pandas.read_csv', 'pd.read_csv', (['"""../data/model_128x4_64_64_2.csv"""'], {'index_col': 'None'}), "('../data/model_128x4_64_64_2.csv', index_col=None)\n", (92, 143), True, 'import pandas as pd\n'), ((279, 306), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(14, 6)'}), '(figsize=(14, 6))\n... |
# Matrix, a simple programming language
# (c) 2022 <NAME>
# License: MIT, see License.md
# Version: 20220319110719
from operator import index
from sys import stderr
from sly import Parser
from .Lexer import MatrixLexer
from .Node import ParseNode
class MatrixParser(Parser):
# debugfile = "parser.out"
toke... | [
"sys.stderr.write"
] | [((1313, 1370), 'sys.stderr.write', 'stderr.write', (['"""MatrixParser: Parse error in input. EOF\n"""'], {}), "('MatrixParser: Parse error in input. EOF\\n')\n", (1325, 1370), False, 'from sys import stderr\n'), ((1002, 1108), 'sys.stderr.write', 'stderr.write', (['f"""MatrixParser: Syntax error at line {lineno}, toke... |
from sqlalchemy.engine import create_engine
from sqlalchemy.orm import sessionmaker
engine = create_engine('mysql+pymysql://root:root@10.16.76.245:3306/coffee')
Session = sessionmaker(bind=engine)
session = Session()
session.execute('INSERT demo5(name) VALUES(:Name)', params={'Name': 'Trans1'})
session.execut... | [
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.engine.create_engine"
] | [((97, 164), 'sqlalchemy.engine.create_engine', 'create_engine', (['"""mysql+pymysql://root:root@10.16.76.245:3306/coffee"""'], {}), "('mysql+pymysql://root:root@10.16.76.245:3306/coffee')\n", (110, 164), False, 'from sqlalchemy.engine import create_engine\n'), ((176, 201), 'sqlalchemy.orm.sessionmaker', 'sessionmaker'... |
# encoding:utf-8
from flask import Flask
from routes import my_blueprint
app = Flask(__name__)
# register our blueprints
app.register_blueprint(my_blueprint, url_prefix='/api/v1')
| [
"flask.Flask"
] | [((80, 95), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (85, 95), False, 'from flask import Flask\n')] |
import turing
import turing.batch
import turing.batch.config
import turing.router.config.router_config
from turing.router.config.route import Route
from turing.router.config.router_config import RouterConfig
from turing.router.config.router_version import RouterStatus
from turing.router.config.resource_request import R... | [
"turing.router.config.traffic_rule.HeaderTrafficRuleCondition",
"turing.router.config.router_config.RouterConfig",
"turing.router.config.route.Route",
"turing.router.config.common.env_var.EnvVar",
"turing.set_project",
"turing.router.config.log_config.LogConfig",
"turing.Router.get",
"fire.Fire",
"t... | [((859, 885), 'turing.set_url', 'turing.set_url', (['turing_api'], {}), '(turing_api)\n', (873, 885), False, 'import turing\n'), ((890, 917), 'turing.set_project', 'turing.set_project', (['project'], {}), '(project)\n', (908, 917), False, 'import turing\n'), ((4800, 5171), 'turing.router.config.experiment_config.Experi... |
# This example is written for the new interface
import StateModeling as stm
import numpy as np
import matplotlib.pyplot as plt
import fetch_data
import pandas as pd
import tensorflow as tf
basePath = r"C:\Users\pi96doc\Documents\Programming\PythonScripts\StateModeling"
if False:
data = fetch_data.DataFetcher().fet... | [
"fetch_data.DataFetcher",
"StateModeling.Model",
"StateModeling.cumulate",
"tensorflow.reduce_sum",
"numpy.array",
"numpy.sum",
"pandas.read_excel",
"numpy.load",
"numpy.save"
] | [((1521, 1532), 'StateModeling.Model', 'stm.Model', ([], {}), '()\n', (1530, 1532), True, 'import StateModeling as stm\n'), ((376, 427), 'pandas.read_excel', 'pd.read_excel', (["(basePath + '\\\\Examples\\\\bev_lk.xlsx')"], {}), "(basePath + '\\\\Examples\\\\bev_lk.xlsx')\n", (389, 427), True, 'import pandas as pd\n'),... |
import numpy as np
import tensorflow as tf
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import functional_ops
from tensorflow.python.ops import array_ops
from tensorflow.python.framework import ops
from gpflow import settings
float_type = settings.float_type
jitter_level = settings.jitter
cla... | [
"tensorflow.shape",
"tensorflow.python.ops.functional_ops.scan",
"tensorflow.concat",
"numpy.linspace",
"tensorflow.sqrt",
"tensorflow.python.framework.ops.convert_to_tensor",
"tensorflow.python.ops.math_ops.cast",
"tensorflow.python.ops.array_ops.concat",
"tensorflow.python.ops.functional_ops.foldl... | [((400, 434), 'numpy.linspace', 'np.linspace', (['(0)', 'total_time', 'nsteps'], {}), '(0, total_time, nsteps)\n', (411, 434), True, 'import numpy as np\n'), ((523, 591), 'tensorflow.python.framework.ops.convert_to_tensor', 'ops.convert_to_tensor', (['self.ts'], {'preferred_dtype': 'float_type', 'name': '"""t"""'}), "(... |
import os
import tensorflow as tf
import tensorflow_io as tfio
class Dataset:
DATASET_SIZE = 2000
IMAGE_SIZE = 227
PREFETCH_SIZE = 32
def __init__(self, dicom_path: str, batch_size=512):
list_ds = tf.data.Dataset.list_files(os.path.join(dicom_path, "*.dcm"), shuffle=False)
list_ds = ... | [
"tensorflow.io.read_file",
"os.path.join",
"tensorflow_io.image.decode_dicom_image",
"tensorflow.image.resize"
] | [((906, 927), 'tensorflow.io.read_file', 'tf.io.read_file', (['path'], {}), '(path)\n', (921, 927), True, 'import tensorflow as tf\n'), ((942, 980), 'tensorflow_io.image.decode_dicom_image', 'tfio.image.decode_dicom_image', (['dcm_img'], {}), '(dcm_img)\n', (971, 980), True, 'import tensorflow_io as tfio\n'), ((252, 28... |
# scipy.special.comb, perm...
# https://www.codewars.com/kata/616c7698ccceda004b58e4bb/solutions/python
from math import factorial
def nth_perm(n,d):
n=n%factorial(d) or d
digits=list(map(str,range(d)))
for i in range(n-1):
try: i=next(i for i in range(d-2,-1,-1) if digits[i]<digits[i+1])
... | [
"math.factorial"
] | [((160, 172), 'math.factorial', 'factorial', (['d'], {}), '(d)\n', (169, 172), False, 'from math import factorial\n')] |
import numpy as np
class ReplayMemory(object):
def __init__(self, max_size, obs_dim, act_dim):
self.max_size = int(max_size)
self.obs = np.zeros((max_size, ) + obs_dim, dtype='float32')
self.action = np.zeros((max_size, act_dim), dtype='float32')
self.reward = np.zeros((max_size,)... | [
"numpy.zeros",
"numpy.random.randint"
] | [((159, 207), 'numpy.zeros', 'np.zeros', (['((max_size,) + obs_dim)'], {'dtype': '"""float32"""'}), "((max_size,) + obs_dim, dtype='float32')\n", (167, 207), True, 'import numpy as np\n'), ((231, 277), 'numpy.zeros', 'np.zeros', (['(max_size, act_dim)'], {'dtype': '"""float32"""'}), "((max_size, act_dim), dtype='float3... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('activities', '0006_auto_20170419_1506'),
]
operations = [
migrations.RemoveField(
model_name='activity',
... | [
"django.db.migrations.RemoveField",
"django.db.models.TextField"
] | [((254, 325), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""activity"""', 'name': '"""positive_feedback"""'}), "(model_name='activity', name='positive_feedback')\n", (276, 325), False, 'from django.db import migrations, models\n'), ((484, 557), 'django.db.models.TextField', 'mode... |
import json
import os
from pathlib import Path
import logging
def read_json(loc : str):
'''
:param loc: path to file
:return: yaml converted to a dictionary
'''
with open(loc) as f:
data = json.load(f)
return data
def write_json(data, loc):
with open(loc, 'w') as json_file:
... | [
"os.path.exists",
"pathlib.Path.home",
"os.getcwd",
"os.chdir",
"os.mkdir",
"json.load",
"logging.info",
"json.dump"
] | [((396, 407), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (405, 407), False, 'import os\n'), ((461, 480), 'os.chdir', 'os.chdir', (['home_path'], {}), '(home_path)\n', (469, 480), False, 'import os\n'), ((517, 530), 'os.chdir', 'os.chdir', (['cwd'], {}), '(cwd)\n', (525, 530), False, 'import os\n'), ((597, 608), 'os.ge... |
"""URL Configuration"""
from django.urls import path
from . import views
urlpatterns = [
path('', views.word_transform, name='word_transform'),
]
| [
"django.urls.path"
] | [((96, 149), 'django.urls.path', 'path', (['""""""', 'views.word_transform'], {'name': '"""word_transform"""'}), "('', views.word_transform, name='word_transform')\n", (100, 149), False, 'from django.urls import path\n')] |
"""
Copyright (c) 2021, Electric Power Research Institute
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 li... | [
"EnergyTier.Tier",
"requests.get",
"xlsxwriter.Workbook",
"Period.tostring",
"pandas.read_excel",
"os.startfile",
"Period.Period",
"pprint.pprint"
] | [((1989, 2035), 'requests.get', 'requests.get', ([], {'url': 'self.URL', 'params': 'self.PARAMS'}), '(url=self.URL, params=self.PARAMS)\n', (2001, 2035), False, 'import requests\n'), ((3955, 3996), 'requests.get', 'requests.get', ([], {'url': 'self.URL', 'params': 'params'}), '(url=self.URL, params=params)\n', (3967, 3... |
import scrapy
import pickle
import os
import ast
from urllib import parse
from scrapy.selector import Selector
class YunnanSpider(scrapy.Spider):
name = "Yunnan"
if not os.path.exists("../../data/HTML_pk/%s" % name):
os.makedirs("../../data/HTML_pk/%s" % name)
if not os.path.exists("../../data/tex... | [
"os.path.exists",
"pickle.dump",
"os.makedirs"
] | [((179, 225), 'os.path.exists', 'os.path.exists', (["('../../data/HTML_pk/%s' % name)"], {}), "('../../data/HTML_pk/%s' % name)\n", (193, 225), False, 'import os\n'), ((235, 278), 'os.makedirs', 'os.makedirs', (["('../../data/HTML_pk/%s' % name)"], {}), "('../../data/HTML_pk/%s' % name)\n", (246, 278), False, 'import o... |
import json
import os
import warnings
import click
from lektor.i18n import get_default_lang
from lektor.i18n import is_valid_language
from lektor.project import Project
def echo_json(data):
click.echo(json.dumps(data, indent=2).rstrip())
def pruneflag(cli):
return click.option(
"--prune/--no-prune... | [
"lektor.i18n.get_default_lang",
"click.UsageError",
"lektor.i18n.is_valid_language",
"click.make_pass_decorator",
"lektor.project.Project.from_path",
"click.option",
"json.dumps",
"os.environ.get",
"lektor.project.Project.discover",
"warnings.warn",
"click.BadParameter",
"click.Group.get_comma... | [((3995, 4042), 'click.make_pass_decorator', 'click.make_pass_decorator', (['Context'], {'ensure': '(True)'}), '(Context, ensure=True)\n', (4020, 4042), False, 'import click\n'), ((279, 409), 'click.option', 'click.option', (['"""--prune/--no-prune"""'], {'default': '(True)', 'help': '"""Controls if old artifacts shoul... |
import os
# we are using the model already trained
#https://github.com/davisking/dlib-models
def pose_predictor_model_location():
return os.path.join(os.path.dirname(__file__), "models/shape_predictor_68_face_landmarks.dat")
def pose_predictor_five_point_model_location():
return os.path.join(os.path.dirname(_... | [
"os.path.dirname"
] | [((155, 180), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (170, 180), False, 'import os\n'), ((303, 328), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (318, 328), False, 'import os\n'), ((441, 466), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__... |
import os
import numpy as np
import matplotlib.pyplot as plt
import PIL
import cv2
import scipy.stats
import torch
import torch.nn as nn
from torch import optim
from torch.autograd.variable import Variable
import torch.nn.functional as F
from skimage.util import montage
from time import time
import warnings
warnings.... | [
"numpy.sqrt",
"torch.max",
"torch.sqrt",
"numpy.log",
"torch.exp",
"numpy.array",
"skimage.util.montage",
"torch.cuda.is_available",
"torch.sum",
"torch.nn.functional.softmax",
"os.listdir",
"torch.nn.LSTM",
"numpy.where",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.sta... | [((311, 344), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (334, 344), False, 'import warnings\n'), ((352, 377), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (375, 377), False, 'import torch\n'), ((2792, 2836), 'numpy.load', 'np.load', (['hp.da... |
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import csv
import math
from haversine import haversine, Unit
from define import *
"""def haversine(c0, c1):
... | [
"csv.writer",
"csv.reader",
"haversine.haversine"
] | [((1016, 1065), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""","""', 'quotechar': '"""\'"""'}), '(csvfile, delimiter=\',\', quotechar="\'")\n', (1026, 1065), False, 'import csv\n'), ((1359, 1378), 'csv.writer', 'csv.writer', (['outfile'], {}), '(outfile)\n', (1369, 1378), False, 'import csv\n'), ((1540, 1... |
"""Database stuff.
:author: <NAME>
"""
import sys
from datetime import datetime
from pathlib import Path
from typing import Any, Tuple
import arrow
import click
from flask import Flask, current_app, g
from flask.cli import with_appcontext
from openpyxl import load_workbook
from sqlalchemy import create_engine
from sq... | [
"mngt.models.Base.metadata.create_all",
"datetime.datetime",
"pathlib.Path",
"openpyxl.load_workbook",
"datetime.datetime.utcnow",
"sqlalchemy.create_engine",
"sqlalchemy.orm.Session",
"click.echo",
"click.Path",
"flask.g.pop",
"sys.exit",
"click.command"
] | [((9775, 9799), 'click.command', 'click.command', (['"""init-db"""'], {}), "('init-db')\n", (9788, 9799), False, 'import click\n'), ((9934, 9958), 'click.command', 'click.command', (['"""seed-db"""'], {}), "('seed-db')\n", (9947, 9958), False, 'import click\n'), ((11417, 11449), 'click.command', 'click.command', (['"""... |
# --------------
# Importing header files
import numpy as np
# Path of the file has been stored in variable called 'path'
data=np.genfromtxt(path, delimiter=",", skip_header=1)
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Code starts here
census = np.concatenate((data, new_record))
# ------... | [
"numpy.mean",
"numpy.std",
"numpy.max",
"numpy.array",
"numpy.sum",
"numpy.concatenate",
"numpy.min",
"numpy.argmin",
"numpy.genfromtxt"
] | [((132, 181), 'numpy.genfromtxt', 'np.genfromtxt', (['path'], {'delimiter': '""","""', 'skip_header': '(1)'}), "(path, delimiter=',', skip_header=1)\n", (145, 181), True, 'import numpy as np\n'), ((275, 309), 'numpy.concatenate', 'np.concatenate', (['(data, new_record)'], {}), '((data, new_record))\n', (289, 309), True... |
from __future__ import division
import numpy as np
__author__ = '<NAME>'
__license__ = '''Copyright (c) 2014-2017, The IceCube Collaboration
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
... | [
"numpy.sin",
"numpy.zeros",
"numpy.sqrt",
"numpy.cos"
] | [((1359, 1371), 'numpy.sqrt', 'np.sqrt', (['x12'], {}), '(x12)\n', (1366, 1371), True, 'import numpy as np\n'), ((1393, 1405), 'numpy.sqrt', 'np.sqrt', (['x13'], {}), '(x13)\n', (1400, 1405), True, 'import numpy as np\n'), ((1427, 1439), 'numpy.sqrt', 'np.sqrt', (['x23'], {}), '(x23)\n', (1434, 1439), True, 'import num... |
from collections import Counter
test_input = ("eedadn\n"
"drvtee\n"
"eandsr\n"
"raavrd\n"
"atevrs\n"
"tsrnev\n"
"sdttsa\n"
"rasrtv\n"
"nssdts\n"
"ntnada\n"
"svetve\n"
... | [
"collections.Counter"
] | [((524, 533), 'collections.Counter', 'Counter', ([], {}), '()\n', (531, 533), False, 'from collections import Counter\n')] |
from utility.constants import *
from utility.amr_utils.amr import *
from utility.dm_utils.DMGraph import *
from utility.psd_utils.PSDGraph import *
import logging
score_logger = logging.getLogger("mrp.score")
def list_to_mulset(l):
s = dict()
for i in l:
if isinstance(i,AMRUniversal) and i.le == "i"an... | [
"logging.getLogger"
] | [((179, 209), 'logging.getLogger', 'logging.getLogger', (['"""mrp.score"""'], {}), "('mrp.score')\n", (196, 209), False, 'import logging\n')] |
###
# Copyright (c) 2017, <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:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions, and th... | [
"datetime.datetime.utcfromtimestamp",
"emoji.emojize",
"supybot.i18n.PluginInternationalization",
"urllib.request.urlopen"
] | [((1991, 2028), 'supybot.i18n.PluginInternationalization', 'PluginInternationalization', (['"""Weather"""'], {}), "('Weather')\n", (2017, 2028), False, 'from supybot.i18n import PluginInternationalization\n'), ((2736, 2759), 'urllib.request.urlopen', 'urlopen', (['url'], {'timeout': '(5)'}), '(url, timeout=5)\n', (2743... |
# calculate_ICEO.py
"""
Notes
"""
# import modules
import numpy as np
import matplotlib.pyplot as plt
def calculate_ICEO(testSetup, testCol, plot_figs=False, savePath=None):
# write script to calculate and output all of the below terms using the testSetup class
"""
Required Inputs:
# physical consta... | [
"numpy.sqrt",
"numpy.sinh",
"numpy.max",
"numpy.array",
"numpy.linspace",
"numpy.exp",
"numpy.vstack",
"numpy.concatenate",
"numpy.savetxt",
"numpy.cosh",
"matplotlib.rc",
"cycler.cycler",
"matplotlib.pyplot.tight_layout",
"numpy.sign",
"matplotlib.pyplot.subplots",
"numpy.round",
"m... | [((15600, 15638), 'numpy.array', 'np.array', (['electric_fields'], {'dtype': 'float'}), '(electric_fields, dtype=float)\n', (15608, 15638), True, 'import numpy as np\n'), ((15656, 15689), 'numpy.array', 'np.array', (['frequencys'], {'dtype': 'float'}), '(frequencys, dtype=float)\n', (15664, 15689), True, 'import numpy ... |
import os
import numpy as np
from glob import glob
import skimage.measure as meas
from skimage.util import pad
import xml.etree.ElementTree as ET
from skimage import draw
from class_data import options, BaseData
mapping_dict = {
"TCGA-55-1594": "lung",
"TCGA-69-7760": "lung",
"TCGA-69-A59K": "lung",
... | [
"xml.etree.ElementTree.parse",
"os.path.join",
"skimage.util.pad",
"numpy.zeros",
"os.path.basename",
"skimage.measure.label",
"class_data.options",
"glob.glob",
"skimage.draw.polygon"
] | [((2154, 2200), 'skimage.util.pad', 'pad', (['raw', '(pad_width + [(0, 0)])'], {'mode': '"""reflect"""'}), "(raw, pad_width + [(0, 0)], mode='reflect')\n", (2157, 2200), False, 'from skimage.util import pad\n'), ((2210, 2244), 'skimage.util.pad', 'pad', (['gt', 'pad_width'], {'mode': '"""reflect"""'}), "(gt, pad_width,... |
# Generated by Django 2.2.5 on 2019-11-20 17:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('service', '0013_auto_20191113_1744'),
]
operations = [
migrations.AlterModelOptions(
name='prof... | [
"django.db.models.ForeignKey",
"django.db.migrations.AlterModelOptions",
"django.db.models.AutoField",
"django.db.models.DecimalField",
"django.db.models.CharField"
] | [((268, 401), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""profession"""', 'options': "{'verbose_name': 'rodzaj uługi', 'verbose_name_plural': 'rodzaje usług'}"}), "(name='profession', options={'verbose_name':\n 'rodzaj uługi', 'verbose_name_plural': 'rodzaje usług'})\n... |
import folium
map = folium.Map(location=[52, 20], zoom_start=6, tiles="Mapbox Bright")
fg=folium.FeatureGroup(name="My Map")
# using "for" loop to create a new marker on the map of Poland
for coordinates in [[50.4166667, 17.9666667], [52.4166667, 18.9666667]]:
fg.add_child(folium.Marker(
location=coordin... | [
"folium.FeatureGroup",
"folium.Icon",
"folium.Map"
] | [((21, 87), 'folium.Map', 'folium.Map', ([], {'location': '[52, 20]', 'zoom_start': '(6)', 'tiles': '"""Mapbox Bright"""'}), "(location=[52, 20], zoom_start=6, tiles='Mapbox Bright')\n", (31, 87), False, 'import folium\n'), ((92, 126), 'folium.FeatureGroup', 'folium.FeatureGroup', ([], {'name': '"""My Map"""'}), "(name... |
# -*- coding: utf-8 -*-
import graphene
import six
from django.utils.encoding import force_text
from graphene_django import DjangoObjectType
from shuup.core.models import ProductMode, ShopProduct, get_person_contact
from shuup.core.pricing._context import PricingContext
from shuup.core.utils.prices import convert_taxn... | [
"graphene.String",
"graphene.Field",
"graphene.List",
"shuup.core.pricing._context.PricingContext",
"shuup.core.utils.prices.convert_taxness",
"django.utils.encoding.force_text",
"graphene.Int",
"graphene.JSONString",
"shuup.core.models.get_person_contact",
"six.iteritems",
"shuup_graphql.front.... | [((633, 647), 'graphene.Int', 'graphene.Int', ([], {}), '()\n', (645, 647), False, 'import graphene\n'), ((665, 693), 'graphene.Field', 'graphene.Field', (['PricefulType'], {}), '(PricefulType)\n', (679, 693), False, 'import graphene\n'), ((708, 735), 'graphene.Field', 'graphene.Field', (['ProductType'], {}), '(Product... |
import os
import logging
import numpy as np
import pandas as pd
import torch
from torch_geometric.data import Data
from .graph import edge_normalization
from .data import Dictionary
logging.basicConfig(level = logging.INFO,format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger()
... | [
"logging.basicConfig",
"numpy.tile",
"logging.getLogger",
"numpy.reshape",
"numpy.unique",
"pandas.read_csv",
"numpy.random.choice",
"torch.stack",
"os.path.join",
"torch.from_numpy",
"torch.cat",
"numpy.zeros",
"numpy.stack",
"torch.tensor",
"numpy.concatenate",
"numpy.random.uniform"... | [((184, 291), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n", (203, 291), False, 'import logging\n'), ((299, 318), 'loggin... |
import tensorflow as tf
import numpy as np
import sys
import ast
import vgg16.data_loader as dl
import vgg16.model as ml
import vgg16.hyper_param as hp
import vgg16.layers as ly
import vgg16.logger as lg
import vgg16.trainer as tr
import vgg16.create_session as cs
import argparse
def main():
#-----------------... | [
"vgg16.layers.Layers",
"argparse.ArgumentParser",
"vgg16.logger.LogSessionRunHook",
"vgg16.create_session.CreateSession",
"vgg16.trainer.Trainer",
"vgg16.hyper_param.HyperParams",
"vgg16.model.Model",
"vgg16.data_loader.DataLoader"
] | [((382, 461), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (405, 461), False, 'import argparse\n'), ((1155, 1179), 'vgg16.create_session.CreateSession', 'cs.CreateSession', (['conf... |
#!/usr/bin/env python
"""
Copyright (c) 2020-End_Of_Life
See the file 'LICENSE' for copying permission
"""
# import standard library required
import argparse
import sys
# import tool required
from route.route import route
from route.execute import execute
from chemsynth.chemsynth import Chemsynth, Chem... | [
"chemsynth.chemsynth.Chemsynth",
"chemsynth.chempoint.ChemsynthPoint._ChemsynthPoint__point1",
"argparse.ArgumentParser",
"route.route.route",
"sys.exc_info",
"route.execute.execute",
"sys.exit"
] | [((1126, 1174), 'chemsynth.chempoint.ChemsynthPoint._ChemsynthPoint__point1', 'ChemsynthPoint._ChemsynthPoint__point1', (['dom', 'tar'], {}), '(dom, tar)\n', (1164, 1174), False, 'from chemsynth.chempoint import ChemsynthPoint, ChemsynthPointException\n'), ((1476, 1490), 'chemsynth.chemsynth.Chemsynth', 'Chemsynth', ([... |
from django.conf.urls import url
from .views import *
app_name = 'stream'
urlpatterns = [
url(r'^$', cross, name='connect'),
# url(r'^stream/upload/$', upload, name='upload'),
# url(r'^stream/download/$', download, name='download'),
]
| [
"django.conf.urls.url"
] | [((96, 128), 'django.conf.urls.url', 'url', (['"""^$"""', 'cross'], {'name': '"""connect"""'}), "('^$', cross, name='connect')\n", (99, 128), False, 'from django.conf.urls import url\n')] |
from erdos.data_stream import DataStream
from erdos.message import Message
from erdos.op import Op
from erdos.utils import setup_logging
import planner.planner_operator
# Constants Used for the high level commands
REACH_GOAL = 0.0
GO_STRAIGHT = 5.0
TURN_RIGHT = 4.0
TURN_LEFT = 3.0
LANE_FOLLOW = 2.0
class ControlOpe... | [
"erdos.utils.setup_logging",
"erdos.message.Message",
"erdos.data_stream.DataStream"
] | [((456, 495), 'erdos.utils.setup_logging', 'setup_logging', (['self.name', 'log_file_name'], {}), '(self.name, log_file_name)\n', (469, 495), False, 'from erdos.utils import setup_logging\n'), ((1723, 1753), 'erdos.message.Message', 'Message', (['action', 'msg.timestamp'], {}), '(action, msg.timestamp)\n', (1730, 1753)... |
import os, pandas as pd, numpy as np, DataBase, gams
from dreamtools.gamY import Precompiler
from DB2Gams_l2 import gams_model_py, gams_settings
def append_index_with_1dindex(index1,index2):
"""
index1 is a pandas index/multiindex. index 2 is a pandas index (not multiindex).
Returns a pandas multiindex with the car... | [
"DataBase.return_version",
"DataBase.GPM_database",
"numpy.linspace",
"numpy.empty",
"pandas.MultiIndex.from_tuples",
"DB2Gams_l2.gams_settings"
] | [((2403, 2414), 'numpy.empty', 'np.empty', (['N'], {}), '(N)\n', (2411, 2414), True, 'import os, pandas as pd, numpy as np, DataBase, gams\n'), ((5078, 5148), 'DataBase.GPM_database', 'DataBase.GPM_database', ([], {'workspace': 'db0.workspace'}), "(workspace=db0.workspace, **{'name': shock_name})\n", (5099, 5148), Fals... |
from flask import jsonify, request
from sim_dict.translations import mod_translations
from sim_dict.models import Translation, Language, translation_schema
@mod_translations.route("/<word>", methods=["GET"])
def get_all_for_word(word):
translations = Translation.query.filter_by(en_word=word).all()
data = tran... | [
"flask.request.args.get",
"sim_dict.models.Translation.query.all",
"sim_dict.models.Translation.query.filter_by",
"sim_dict.models.Language.query.get",
"sim_dict.models.Translation.en_word.ilike",
"sim_dict.models.translation_schema.dump",
"sim_dict.translations.mod_translations.route",
"flask.jsonify... | [((159, 209), 'sim_dict.translations.mod_translations.route', 'mod_translations.route', (['"""/<word>"""'], {'methods': "['GET']"}), "('/<word>', methods=['GET'])\n", (181, 209), False, 'from sim_dict.translations import mod_translations\n'), ((578, 622), 'sim_dict.translations.mod_translations.route', 'mod_translation... |
import numpy as np
import matplotlib.pyplot as plt
def plot_line(ax, w):
# input data
X = np.zeros((2, 2))
X[0, 0] = -5.0
X[1, 0] = 5.0
X[:, 1] = 1.0
# have to flip transpose
y = w.dot(X.T)
ax.plot(X[:,0], y)
# create prior
tau = 1.0*np.eye(2)
w_0 = np.zeros((2, 1))
# sample from pri... | [
"numpy.eye",
"numpy.zeros",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.show"
] | [((285, 301), 'numpy.zeros', 'np.zeros', (['(2, 1)'], {}), '((2, 1))\n', (293, 301), True, 'import numpy as np\n'), ((436, 463), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 5)'}), '(figsize=(10, 5))\n', (446, 463), True, 'import matplotlib.pyplot as plt\n'), ((571, 589), 'matplotlib.pyplot.tight_la... |
import requests
import json
import os
import urlparse
import random
from colorthief import ColorThief
def rgb2lab (rgb) :
RGB = [0, 0, 0]
for idx, value in enumerate(rgb) :
value = float(value) / 255
if value > 0.04045 :
value = ( ( value + 0.055 ) / 1.055 ) ** 2.4
else :
value = value /... | [
"os.path.exists",
"os.makedirs",
"random.randint",
"json.dump",
"urlparse.urlparse"
] | [((1250, 1276), 'os.path.exists', 'os.path.exists', (['"""./photos"""'], {}), "('./photos')\n", (1264, 1276), False, 'import os\n'), ((2276, 2300), 'json.dump', 'json.dump', (['list', 'outfile'], {}), '(list, outfile)\n', (2285, 2300), False, 'import json\n'), ((1295, 1318), 'os.makedirs', 'os.makedirs', (['"""./photos... |
# -- coding: utf-8 --
#Import the library to use libnotify.
from gi.repository import Notify
class LinuxNotify():
"""LinuxNotify calls the notification system for Linux."""
def __init__(self, title, msg):
#Register the application and give the class a name to use.
Notify.init("Polyblip")
... | [
"gi.repository.Notify.Notification.new",
"gi.repository.Notify.init",
"gi.repository.Notify.uninit"
] | [((291, 314), 'gi.repository.Notify.init', 'Notify.init', (['"""Polyblip"""'], {}), "('Polyblip')\n", (302, 314), False, 'from gi.repository import Notify\n'), ((455, 470), 'gi.repository.Notify.uninit', 'Notify.uninit', ([], {}), '()\n', (468, 470), False, 'from gi.repository import Notify\n'), ((367, 402), 'gi.reposi... |
# -*- coding: utf-8 -*-
import os, re
from flask import Flask, render_template, request, redirect, url_for, send_from_directory, session
from werkzeug import secure_filename
from detect import start_detect
app = Flask(__name__)
@app.route('/')
def index():
name = "<NAME>"
return render_template('index.html'... | [
"flask.render_template",
"re.search",
"flask.send_from_directory",
"flask.Flask",
"os.urandom",
"os.path.join",
"flask.url_for",
"werkzeug.secure_filename",
"detect.start_detect"
] | [((215, 230), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (220, 230), False, 'from flask import Flask, render_template, request, redirect, url_for, send_from_directory, session\n'), ((603, 617), 'os.urandom', 'os.urandom', (['(24)'], {}), '(24)\n', (613, 617), False, 'import os, re\n'), ((292, 352), 'fl... |