code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pandas as pd
import numpy as np
import re
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.preprocessing import OneHotEncoder
from sklearn.decomposition import PCA , TruncatedSVD
import joblib
from sklearn.manifold import TSNE
# import seaborn as sns
import matplotlib.pyplot as ... | [
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"pandas.to_datetime",
"sklearn.feature_extraction.text.CountVectorizer",
"matplotlib.pyplot.xlabel",
"sklearn.manifold.TSNE",
"matplotlib.pyplot.scatter",
"joblib.load",
"joblib.dump",
"matplotlib.pyplot.savefig",
"sklearn.decomposition.TruncatedSVD... | [((3375, 3390), 'sklearn.preprocessing.OneHotEncoder', 'OneHotEncoder', ([], {}), '()\n', (3388, 3390), False, 'from sklearn.preprocessing import OneHotEncoder\n'), ((3595, 3624), 'sklearn.decomposition.TruncatedSVD', 'TruncatedSVD', ([], {'n_components': '(50)'}), '(n_components=50)\n', (3607, 3624), False, 'from skle... |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Tests the log service
:author: <NAME>
"""
# Standard library
import logging
import sys
import time
try:
import unittest2 as unittest
except ImportError:
import unittest # type: ignore
# Pelix
import pelix.framework
import pelix.misc
from pelix.ipopo... | [
"logging.getLogger",
"sys.exc_info",
"logging.getLevelName",
"pelix.ipopo.constants.use_ipopo",
"time.time"
] | [((3860, 3895), 'logging.getLevelName', 'logging.getLevelName', (['logging.DEBUG'], {}), '(logging.DEBUG)\n', (3880, 3895), False, 'import logging\n'), ((12560, 12578), 'pelix.ipopo.constants.use_ipopo', 'use_ipopo', (['context'], {}), '(context)\n', (12569, 12578), False, 'from pelix.ipopo.constants import use_ipopo\n... |
# coding=utf-8
from __future__ import absolute_import, division, print_function
from future import standard_library; standard_library.install_aliases()
from os.path import join, dirname, realpath
from itertools import groupby
from operator import itemgetter
from urllib.parse import urlparse
from csv import DictReader... | [
"flask.render_template",
"psycopg2.connect",
"json.loads",
"urllib.parse.urlparse",
"flask.Flask",
"requests.get",
"future.standard_library.install_aliases",
"os.path.dirname",
"json.load",
"operator.itemgetter",
"time.time"
] | [((118, 152), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (150, 152), False, 'from future import standard_library\n'), ((764, 779), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (769, 779), False, 'from flask import Flask, request, render_template, json... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'ConfigEntry', fields ['name']
db.delete_... | [
"south.db.db.create_unique",
"south.db.db.delete_unique"
] | [((310, 357), 'south.db.db.delete_unique', 'db.delete_unique', (['u"""core_configentry"""', "['name']"], {}), "(u'core_configentry', ['name'])\n", (326, 357), False, 'from south.db import db\n'), ((638, 696), 'south.db.db.create_unique', 'db.create_unique', (['u"""core_configentry"""', "['name', 'user_id']"], {}), "(u'... |
#!/usr/bin/env python
"""
LIVE STREAM TO YOUTUBE LIVE using FFMPEG -- screenshare
https://www.scivision.co/youtube-live-ffmpeg-livestream/
https://support.google.com/youtube/answer/2853702
Windows: get DirectShow device list from:
ffmpeg -list_devices true -f dshow -i dummy
"""
from youtubelive_ffmpeg import youtu... | [
"signal.signal",
"sys.platform.startswith",
"youtubelive_ffmpeg.youtubelive",
"argparse.ArgumentParser"
] | [((343, 373), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (366, 373), False, 'import sys\n'), ((467, 500), 'sys.platform.startswith', 'sys.platform.startswith', (['"""darwin"""'], {}), "('darwin')\n", (490, 500), False, 'import sys\n'), ((700, 744), 'signal.signal', 'signal.s... |
"""
Utility functions for domain decomposition.
"""
def lazy_reduce(reduction, block, launches, contexts):
"""
Applies a reduction over a sequence of parallelizable device operations.
The reduction can be something like built-in `max` or `min`. The
`launches` argument is a sequence of callables which... | [
"numpy.zeros"
] | [((2623, 2641), 'numpy.zeros', 'np.zeros', (['[ni, nq]'], {}), '([ni, nq])\n', (2631, 2641), True, 'import numpy as np\n'), ((3212, 3234), 'numpy.zeros', 'np.zeros', (['[ni, nj, nq]'], {}), '([ni, nj, nq])\n', (3220, 3234), True, 'import numpy as np\n')] |
"""
This is to keep Chinese doc update to English doc. Should be run regularly.
There is no sane way to check the contents though. PR review should enforce contributors to update the corresponding translation.
See https://github.com/microsoft/nni/issues/4298 for discussion.
Under docs, run
python tools/chineselin... | [
"shutil.copyfile",
"pathlib.Path"
] | [((1819, 1833), 'pathlib.Path', 'Path', (['"""source"""'], {}), "('source')\n", (1823, 1833), False, 'from pathlib import Path\n'), ((1116, 1147), 'shutil.copyfile', 'shutil.copyfile', (['source', 'target'], {}), '(source, target)\n', (1131, 1147), False, 'import shutil\n'), ((433, 443), 'pathlib.Path', 'Path', (['path... |
"""
A PynamoDB example using a custom attribute
"""
from __future__ import print_function
import pickle
from pynamodb.attributes import BinaryAttribute, UnicodeAttribute
from pynamodb.models import Model
class Color(object):
"""
This class is used to demonstrate the PickleAttribute below
"""
def __ini... | [
"pickle.dumps",
"pynamodb.attributes.UnicodeAttribute"
] | [((1246, 1277), 'pynamodb.attributes.UnicodeAttribute', 'UnicodeAttribute', ([], {'hash_key': '(True)'}), '(hash_key=True)\n', (1262, 1277), False, 'from pynamodb.attributes import BinaryAttribute, UnicodeAttribute\n'), ((859, 878), 'pickle.dumps', 'pickle.dumps', (['value'], {}), '(value)\n', (871, 878), False, 'impor... |
from books.serializers import BookSerializer, BookGenderSerializer
from core.models import Book, BookGender
from django.db.models import Count, Sum, Avg
from django.shortcuts import render, redirect
def landing(request):
"""Render the landing page"""
return render(request, 'landing.html')
def home(request):... | [
"django.shortcuts.render",
"core.models.BookGender.objects.all",
"books.serializers.BookSerializer",
"django.db.models.Count",
"django.db.models.Avg",
"core.models.Book.objects.all",
"django.shortcuts.redirect",
"books.serializers.BookGenderSerializer",
"django.db.models.Sum"
] | [((268, 299), 'django.shortcuts.render', 'render', (['request', '"""landing.html"""'], {}), "(request, 'landing.html')\n", (274, 299), False, 'from django.shortcuts import render, redirect\n'), ((1985, 2024), 'django.shortcuts.render', 'render', (['request', '"""home.html"""', 'page_info'], {}), "(request, 'home.html',... |
import os
import logging
from assemblyline.common import forge
from assemblyline.common.str_utils import safe_str
from assemblyline.common.uid import get_id_from_data
from assemblyline.odm.models.signature import Signature
class SuricataImporter(object):
def __init__(self, logger=None):
if not logger:
... | [
"logging.getLogger",
"os.path.exists",
"assemblyline.common.forge.get_classification",
"assemblyline.common.uid.get_id_from_data",
"assemblyline.common.str_utils.safe_str",
"os.path.basename",
"assemblyline.common.forge.get_datastore",
"assemblyline.common.log.init_logging",
"os.path.expanduser"
] | [((563, 584), 'assemblyline.common.forge.get_datastore', 'forge.get_datastore', ([], {}), '()\n', (582, 584), False, 'from assemblyline.common import forge\n'), ((615, 641), 'assemblyline.common.forge.get_classification', 'forge.get_classification', ([], {}), '()\n', (639, 641), False, 'from assemblyline.common import ... |
"""
Classes from the 'CoreFollowUp' framework.
"""
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name):
return None
def _Class(name):
try:
return ObjCClass(name)
except NameError:
return None
FLApprovedItemsFilter = _Class("FLApprovedItemsFilter")... | [
"rubicon.objc.ObjCClass"
] | [((205, 220), 'rubicon.objc.ObjCClass', 'ObjCClass', (['name'], {}), '(name)\n', (214, 220), False, 'from rubicon.objc import ObjCClass\n')] |
#!/usr/bin/env python
# Copyright 2021 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.
"""
A chain with a self-signed Root1 and a Root1 cross signed by Root2. The
cross-signed root has a newer notBefore date than the self-s... | [
"gencerts.create_intermediate_certificate",
"gencerts.create_self_signed_root_certificate",
"gencerts.write_chain",
"gencerts.create_end_entity_certificate"
] | [((471, 524), 'gencerts.create_self_signed_root_certificate', 'gencerts.create_self_signed_root_certificate', (['"""Root1"""'], {}), "('Root1')\n", (515, 524), False, 'import gencerts\n'), ((575, 628), 'gencerts.create_self_signed_root_certificate', 'gencerts.create_self_signed_root_certificate', (['"""Root2"""'], {}),... |
#!/usr/bin/env python3
'''
A new Ubuntu CVE different than shuttlefish. Utilizes Launchpad data to grab Ubuntu
CVE Data
'''
import time
import logging
import re
import cvss
import cpe
# Library doesn't exist
# import capec
class mowCVE:
'''
Generic CVE Class To Expand Upon Includes Bits for Auditing
C... | [
"logging.getLogger",
"cvss.CVSS2",
"cvss.CVSS3",
"cpe.CPE",
"time.time",
"re.search"
] | [((498, 525), 'logging.getLogger', 'logging.getLogger', (['"""mowCVE"""'], {}), "('mowCVE')\n", (515, 525), False, 'import logging\n'), ((750, 787), 're.search', 're.search', (['self._cve_regex', 'cve', 're.I'], {}), '(self._cve_regex, cve, re.I)\n', (759, 787), False, 'import re\n'), ((1449, 1476), 'cvss.CVSS2', 'cvss... |
from collections import Counter
from tqdm import tqdm
import itertools
import pandas as pd
import numpy as np
from db import get_annotation_db
from journal import get_journal_text, get_journal_info, get_journal_text_representation
responsibility_labels = ["communicating", "info_filtering", "clinical_decisions", "prep... | [
"db.get_annotation_db",
"journal.get_journal_text",
"itertools.chain",
"itertools.groupby",
"tqdm.tqdm",
"journal.get_journal_text_representation",
"itertools.combinations",
"journal.get_journal_info",
"pandas.DataFrame",
"pandas.concat"
] | [((9840, 9880), 'pandas.DataFrame', 'pd.DataFrame', (['responsibility_annotations'], {}), '(responsibility_annotations)\n', (9852, 9880), True, 'import pandas as pd\n'), ((17511, 17543), 'tqdm.tqdm', 'tqdm', (['responsibility_annotations'], {}), '(responsibility_annotations)\n', (17515, 17543), False, 'from tqdm import... |
# coding=utf-8
# Copyright 2018 The TF-Agents Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
"tensorflow.one_hot",
"tensorflow.shape",
"tensorflow.Variable",
"tensorflow.reduce_sum",
"tensorflow.norm",
"tf_agents.utils.nest_utils.flatten_multi_batched_nested_tensors",
"tensorflow.gather",
"tensorflow.matmul",
"tensorflow.square",
"tensorflow.zeros_like",
"tensorflow.expand_dims",
"ten... | [((2342, 2416), 'tensorflow.Variable', 'tf.Variable', (['reward_aggregates'], {'name': '"""reward_aggregates"""', 'dtype': 'tf.float32'}), "(reward_aggregates, name='reward_aggregates', dtype=tf.float32)\n", (2353, 2416), True, 'import tensorflow as tf\n'), ((2458, 2508), 'tensorflow.Variable', 'tf.Variable', (['invers... |
import random
import os
import numpy as np
from scipy.ndimage.filters import median_filter
import os
import random
import numpy as np
from scipy.ndimage.filters import median_filter
def gaussian_noise(img, mean=0, sigma=0.03):
img = img.copy()
noise = np.random.normal(mean, sigma, img.shape)
mask_overflo... | [
"numpy.random.normal",
"os.path.exists",
"random.uniform",
"scipy.ndimage.filters.median_filter",
"os.path.join",
"numpy.sum",
"numpy.zeros",
"os.mkdir",
"numpy.expand_dims",
"random.randint"
] | [((263, 303), 'numpy.random.normal', 'np.random.normal', (['mean', 'sigma', 'img.shape'], {}), '(mean, sigma, img.shape)\n', (279, 303), True, 'import numpy as np\n'), ((1600, 1630), 'os.path.exists', 'os.path.exists', (['pred_dir_train'], {}), '(pred_dir_train)\n', (1614, 1630), False, 'import os\n'), ((1640, 1664), '... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-28 14:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dictionary', '0005_auto_20170601_1013'),
]
operation... | [
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((917, 1036), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""parent_gloss"""', 'to': '"""dictionary.Gloss"""'}), "(on_delete=django.db.models.deletion.CASCADE, related_name\n ='parent_gloss', to='dictionary.Gloss')\n", (934, 1036), Fal... |
from collections import namedtuple
from scipy.special import expit
import numpy as np
from .mapping import Mapping
class Activation(Mapping):
pass
# Activation = namedtuple("Activation", ["forward", "backward"])
class Relu(Activation):
@staticmethod
def forward(x):
return np.where(x>0, x, 0)
... | [
"numpy.identity",
"numpy.eye",
"numpy.where",
"numpy.exp",
"numpy.sum"
] | [((296, 317), 'numpy.where', 'np.where', (['(x > 0)', 'x', '(0)'], {}), '(x > 0, x, 0)\n', (304, 317), True, 'import numpy as np\n'), ((549, 558), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (555, 558), True, 'import numpy as np\n'), ((912, 921), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (918, 921), True, 'import n... |
import os
import string
import plyr
import shutil
from pydub import AudioSegment
from time import localtime, strftime
from mutagen.id3 import ID3, TPE1, TIT2, TRCK, TALB, APIC, TDEN, TDTG, ID3NoHeaderError
DEBUG = True
DISCO_DIR = os.path.join(os.sep, 'home', 'pi', 'disco')
ART_DIR = os.path.join(DISCO_DIR, 'Art')
DA... | [
"time.localtime",
"os.path.getsize",
"mutagen.id3.TRCK",
"mutagen.id3.TALB",
"os.makedirs",
"mutagen.id3.ID3",
"os.path.join",
"os.symlink",
"plyr.Query",
"os.path.isfile",
"mutagen.id3.TPE1",
"os.path.isdir",
"shutil.rmtree",
"os.path.islink",
"mutagen.id3.TIT2",
"pydub.AudioSegment.f... | [((233, 276), 'os.path.join', 'os.path.join', (['os.sep', '"""home"""', '"""pi"""', '"""disco"""'], {}), "(os.sep, 'home', 'pi', 'disco')\n", (245, 276), False, 'import os\n'), ((287, 317), 'os.path.join', 'os.path.join', (['DISCO_DIR', '"""Art"""'], {}), "(DISCO_DIR, 'Art')\n", (299, 317), False, 'import os\n'), ((329... |
from collections import OrderedDict
import torch
import torch.nn as nn
from gym import spaces
from rl.policies.utils import MLP, BC_Visual_Policy
from rl.policies.actor_critic import Actor, Critic
from util.gym import observation_size, action_size, goal_size, box_size, robot_state_size, image_size
import numpy as np... | [
"rl.policies.distributions.FixedNormal",
"numpy.log",
"torch.tanh",
"rl.policies.distributions.MixedDistribution",
"rl.policies.distributions.FixedCategorical",
"util.gym.goal_size",
"util.gym.image_size",
"torch.nn.ModuleDict",
"torch.zeros_like",
"util.pytorch.to_tensor",
"collections.OrderedD... | [((1407, 1500), 'rl.policies.utils.BC_Visual_Policy', 'BC_Visual_Policy', ([], {'robot_state': 'input_dim', 'num_classes': '(256)', 'img_size': 'config.env_image_size'}), '(robot_state=input_dim, num_classes=256, img_size=config.\n env_image_size)\n', (1423, 1500), False, 'from rl.policies.utils import MLP, BC_Visua... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 3 09:30:54 2020
@author: jeremiasknoblauch
Description: Read in the results and produce plots. Before creating the plots
create .txt files holding the results to be plotted.
"""
import numpy as np
import matplotlib.pyplot as plt
# global variabl... | [
"numpy.mean",
"numpy.log",
"numpy.max",
"numpy.zeros",
"numpy.loadtxt",
"matplotlib.pyplot.subplots"
] | [((2559, 2584), 'numpy.loadtxt', 'np.loadtxt', (['path_name_TVD'], {}), '(path_name_TVD)\n', (2569, 2584), True, 'import numpy as np\n'), ((2600, 2625), 'numpy.loadtxt', 'np.loadtxt', (['path_name_KLD'], {}), '(path_name_KLD)\n', (2610, 2625), True, 'import numpy as np\n'), ((6767, 6817), 'matplotlib.pyplot.subplots', ... |
from utils.prepare_data import get_training_data
from utils.prepare_plots import plot_results
from simpleencoderdecoder.build_simple_encoderdecoder_model import simple_encoderdecoder
import random
import numpy as np
if __name__ == "__main__":
profile_gray_objs, midcurve_gray_objs = get_training_data()
test_gra... | [
"random.sample",
"utils.prepare_plots.plot_results",
"numpy.asarray",
"utils.prepare_data.get_training_data",
"simpleencoderdecoder.build_simple_encoderdecoder_model.simple_encoderdecoder"
] | [((288, 307), 'utils.prepare_data.get_training_data', 'get_training_data', ([], {}), '()\n', (305, 307), False, 'from utils.prepare_data import get_training_data\n'), ((331, 366), 'random.sample', 'random.sample', (['profile_gray_objs', '(5)'], {}), '(profile_gray_objs, 5)\n', (344, 366), False, 'import random\n'), ((5... |
from pathlib import Path
from functools import partial
import tempfile
import logging
import tomli
import trio
from dirgh import find_download
import psqlsync.actions
logger = logging.getLogger(__name__)
def prepare(target, owner, repo, repo_dir, overwrite, config, token, verbose):
logger.info("Downloading bac... | [
"logging.getLogger",
"tomli.load",
"trio.run",
"pathlib.Path",
"functools.partial",
"tempfile.gettempdir"
] | [((179, 206), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (196, 206), False, 'import logging\n'), ((346, 437), 'functools.partial', 'partial', (['find_download', 'owner', 'repo', 'repo_dir', 'target'], {'overwrite': 'overwrite', 'token': 'token'}), '(find_download, owner, repo, repo_di... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... | [
"ansible_collections.oracle.oci.plugins.module_utils.oci_common_utils.list_all_resources",
"ansible.module_utils.basic.AnsibleModule",
"ansible_collections.oracle.oci.plugins.module_utils.oci_common_utils.get_common_arg_spec",
"ansible_collections.oracle.oci.plugins.module_utils.oci_common_utils.merge_dicts",... | [((34423, 34470), 'ansible_collections.oracle.oci.plugins.module_utils.oci_resource_utils.get_custom_class', 'get_custom_class', (['"""ResponderRecipeHelperCustom"""'], {}), "('ResponderRecipeHelperCustom')\n", (34439, 34470), False, 'from ansible_collections.oracle.oci.plugins.module_utils.oci_resource_utils import OC... |
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.staticfiles.storage import staticfiles_storage
from django.views.generic.base import RedirectView
from rest_framework import routers
import cspreports.urls
from .views import AnnouncementViewSet, AssessmentViewSet, Attribut... | [
"django.conf.urls.include",
"django.conf.urls.url",
"django.contrib.staticfiles.storage.staticfiles_storage.url",
"rest_framework.routers.DefaultRouter"
] | [((485, 508), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (506, 508), False, 'from rest_framework import routers\n'), ((904, 959), 'django.conf.urls.url', 'url', (['"""^healthcheck/?$"""', 'healthcheck'], {'name': '"""healthcheck"""'}), "('^healthcheck/?$', healthcheck, name='heal... |
import time
def selectionSort(vector):
start_time = time.time()
for i in range(len(vector)):
iMin = i
for j in range(i+1, len(vector)):
if(vector[iMin] > vector[j]):
iMin = j
vector[i], vector[iMin] = vector[iMin], vector[i]
elapsed_time = time.time() ... | [
"time.time"
] | [((57, 68), 'time.time', 'time.time', ([], {}), '()\n', (66, 68), False, 'import time\n'), ((308, 319), 'time.time', 'time.time', ([], {}), '()\n', (317, 319), False, 'import time\n')] |
from django.contrib import admin
from django.urls import path
from check.views import PingdomHealthCheckView, PingdomWarningView, PingdomErrorView, DisplayStatusView
urlpatterns = [
path('', admin.site.urls),
path('pingdom/healthcheck/', PingdomHealthCheckView.as_view()),
path('pingdom/warnings/', Pingdom... | [
"check.views.PingdomHealthCheckView.as_view",
"check.views.PingdomWarningView.as_view",
"django.urls.path",
"check.views.PingdomErrorView.as_view",
"check.views.DisplayStatusView.as_view"
] | [((188, 213), 'django.urls.path', 'path', (['""""""', 'admin.site.urls'], {}), "('', admin.site.urls)\n", (192, 213), False, 'from django.urls import path\n'), ((248, 280), 'check.views.PingdomHealthCheckView.as_view', 'PingdomHealthCheckView.as_view', ([], {}), '()\n', (278, 280), False, 'from check.views import Pingd... |
# PyZX - Python library for quantum circuit rewriting
# and optimization using the ZX-calculus
# Copyright (C) 2018 - <NAME> and <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
... | [
"copy.copy",
"fractions.Fraction",
"typing.TypeVar"
] | [((1142, 1171), 'typing.TypeVar', 'TypeVar', (['"""Tvar"""'], {'bound': '"""Gate"""'}), "('Tvar', bound='Gate')\n", (1149, 1171), False, 'from typing import Dict, List, Optional, Type, ClassVar, TypeVar, Generic, Set\n'), ((6263, 6278), 'copy.copy', 'copy.copy', (['self'], {}), '(self)\n', (6272, 6278), False, 'import ... |
#/usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf
from time import sleep
import paho.mqtt.client as mqtt
def connect(client_name = "laptop",host_name = "127.0.0.1"):
client =mqtt.Client(client_name)
client.connect(host_name)
return client
def send(client, data, topic):
client.publ... | [
"paho.mqtt.client.Client"
] | [((199, 223), 'paho.mqtt.client.Client', 'mqtt.Client', (['client_name'], {}), '(client_name)\n', (210, 223), True, 'import paho.mqtt.client as mqtt\n')] |
# importing redis module
import redis
# calling redis with its port number on the local machine with an object instance
r = redis.Redis(host='localhost', port=6379, db=0)
# printing empty line
print()
# setting the key and value
print("Did the value is set for the specified key ? :",r.set('Name', 'Ajay')... | [
"redis.Redis"
] | [((131, 177), 'redis.Redis', 'redis.Redis', ([], {'host': '"""localhost"""', 'port': '(6379)', 'db': '(0)'}), "(host='localhost', port=6379, db=0)\n", (142, 177), False, 'import redis\n')] |
import time
from text_processing import text_normalizer
from nltk.stem.wordnet import WordNetLemmatizer
import re
import pandas as pd
import spacy
from text_processing import geo_names_finder
from utilities import excel_writer
from utilities import excel_reader
import os
import textdistance
lmtzr = WordNetLemmatizer()... | [
"os.path.exists",
"text_processing.geo_names_finder.GeoNameFinder",
"os.getenv",
"re.compile",
"spacy.load",
"utilities.excel_writer.ExcelWriter",
"re.match",
"time.sleep",
"textdistance.levenshtein.normalized_similarity",
"nltk.stem.wordnet.WordNetLemmatizer",
"text_processing.text_normalizer.r... | [((301, 320), 'nltk.stem.wordnet.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (318, 320), False, 'from nltk.stem.wordnet import WordNetLemmatizer\n'), ((327, 355), 'spacy.load', 'spacy.load', (['"""en_core_web_sm"""'], {}), "('en_core_web_sm')\n", (337, 355), False, 'import spacy\n'), ((716, 748), 'text_p... |
import os
from A_MIA_R3_Core.Graphproc import Graphmod
class Graph_Process:
def __path_cutext2(self,pathkun):
pathkun22, extkun = os.path.splitext(os.path.basename(pathkun))
return pathkun22
def __init__(self,filename):
self.filename=filename
self.path_ONLY=self.__path_cutext2... | [
"A_MIA_R3_Core.Graphproc.Graphmod.DrawGraphs",
"os.path.basename"
] | [((390, 425), 'A_MIA_R3_Core.Graphproc.Graphmod.DrawGraphs', 'Graphmod.DrawGraphs', (['self.path_ONLY'], {}), '(self.path_ONLY)\n', (409, 425), False, 'from A_MIA_R3_Core.Graphproc import Graphmod\n'), ((162, 187), 'os.path.basename', 'os.path.basename', (['pathkun'], {}), '(pathkun)\n', (178, 187), False, 'import os\n... |
import awkward as ak
import numpy as np
import pytest
from pytest_lazyfixture import lazy_fixture
from fast_carpenter.testing import FakeBEEvent
import fast_carpenter.tree_adapter as tree_adapter
from fast_carpenter.tree_adapter import ArrayMethods
####################################################################... | [
"fast_carpenter.tree_adapter.ArrayMethods.to_pandas",
"awkward.count_nonzero",
"fast_carpenter.tree_adapter.ArrayMethods.filtered_len",
"pytest_lazyfixture.lazy_fixture",
"fast_carpenter.tree_adapter.ArrayMethods.arrays_as_np_array",
"fast_carpenter.tree_adapter.create",
"awkward.all",
"awkward.num",
... | [((492, 557), 'fast_carpenter.tree_adapter.create', 'tree_adapter.create', (["{'adapter': 'uproot3', 'tree': uproot3_tree}"], {}), "({'adapter': 'uproot3', 'tree': uproot3_tree})\n", (511, 557), True, 'import fast_carpenter.tree_adapter as tree_adapter\n'), ((1068, 1133), 'fast_carpenter.tree_adapter.create', 'tree_ada... |
import os
import shutil
import tempfile
import traceback
from fusion.cli.utilities import RenderTemplate
__all__ = ['CreateExecutable', 'SetupExecutableCreator']
def SetupExecutableCreator(commands):
command = commands.add_parser('create-executable',
help='Generate a CMake executable project and add it t... | [
"os.path.exists",
"os.path.isabs",
"os.makedirs",
"shutil.move",
"os.path.join",
"os.path.isfile",
"traceback.print_exc",
"tempfile.mkdtemp",
"os.mkdir",
"shutil.rmtree",
"fusion.cli.utilities.RenderTemplate"
] | [((652, 684), 'os.path.join', 'os.path.join', (['exePath', '"""include"""'], {}), "(exePath, 'include')\n", (664, 684), False, 'import os\n'), ((689, 710), 'os.mkdir', 'os.mkdir', (['includePath'], {}), '(includePath)\n', (697, 710), False, 'import os\n'), ((729, 775), 'os.path.join', 'os.path.join', (['includePath', '... |
# Adapted from https://github.com/maurapintor/Fast-Minimum-Norm-FMN-Attack
import math
from functools import partial
from typing import Optional
import torch
from torch import nn, Tensor
from torch.autograd import grad
from adv_lib.utils.losses import difference_of_logits
from adv_lib.utils.projections import l1_bal... | [
"torch.ones",
"torch.maximum",
"math.cos",
"functools.partial",
"torch.zeros_like",
"torch.minimum",
"torch.zeros",
"torch.where"
] | [((5426, 5450), 'torch.zeros_like', 'torch.zeros_like', (['inputs'], {}), '(inputs)\n', (5442, 5450), False, 'import torch\n'), ((5466, 5522), 'torch.zeros', 'torch.zeros', (['batch_size'], {'dtype': 'torch.bool', 'device': 'device'}), '(batch_size, dtype=torch.bool, device=device)\n', (5477, 5522), False, 'import torc... |
import nltk
import os
import re
def get_filename(full_path):
'''Given a full absolute path to a file, return the filename only (including extension).
If path separators are not present, return the original argument.'''
# Automatically detect the default OS path separator (Windows-style or
... | [
"os.path.abspath",
"re.search",
"re.compile"
] | [((969, 1072), 're.compile', 're.compile', (['"""^(?P<subjectID>[0-9a-zA-Z]+)[_-](?P<sessionID>[0-9a-zA-Z]+)[.](?:[0-9a-zA-Z]+)$"""'], {}), "(\n '^(?P<subjectID>[0-9a-zA-Z]+)[_-](?P<sessionID>[0-9a-zA-Z]+)[.](?:[0-9a-zA-Z]+)$'\n )\n", (979, 1072), False, 'import re\n'), ((1092, 1226), 're.compile', 're.compile', ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License,... | [
"logging.debug",
"sys.exit",
"logging.info",
"logging.error",
"os.path.exists",
"subprocess.Popen",
"subprocess.CalledProcessError",
"os.path.normpath",
"os.path.isdir",
"argparse.FileType",
"collections.namedtuple",
"os.path.splitext",
"shutil.copy",
"logging.basicConfig",
"os.path.join... | [((1612, 1636), 'os.environ.get', 'os.environ.get', (['"""JOSHUA"""'], {}), "('JOSHUA')\n", (1626, 1636), False, 'import os\n'), ((1658, 1719), 'os.path.join', 'os.path.join', (['JOSHUA_PATH', '"""scripts/preparation/normalize.pl"""'], {}), "(JOSHUA_PATH, 'scripts/preparation/normalize.pl')\n", (1670, 1719), False, 'im... |
import os
from makehex.lexer import lex as __lex
from makehex.parser import parser as __parser
from makehex.tools import xint as __int, CB
def __exec(command: str, out, locals_: dict):
from os import environ as __env
from subprocess import Popen, PIPE
env = __env.copy()
env["HX_COMMAND"] = command
... | [
"makehex.tools.CB.typed",
"subprocess.Popen",
"makehex.tools.xint",
"os.environ.copy",
"makehex.parser.parser",
"os.path.basename",
"makehex.lexer.lex"
] | [((535, 596), 'makehex.tools.CB.typed', 'CB.typed', ([], {'arg_count': '(1)', 'need_body': '(True)', 'skip': "('out', 'locals')"}), "(arg_count=1, need_body=True, skip=('out', 'locals'))\n", (543, 596), False, 'from makehex.tools import xint as __int, CB\n'), ((1208, 1256), 'makehex.tools.CB.typed', 'CB.typed', ([], {'... |
# Copyright 2020-present Kensho Technologies, LLC.
import os
import tarfile
from ..api import load_model_from_tarball, save_model_to_tarball
from ..exceptions import ModelValidationError
from ..serializable_model import CustomSerializedValue, SerializableModel
from ..utils import get_model_directory_name, get_temporar... | [
"tarfile.open",
"os.path.join"
] | [((2955, 2992), 'os.path.join', 'os.path.join', (['temp_dir', '"""tarball.tar"""'], {}), "(temp_dir, 'tarball.tar')\n", (2967, 2992), False, 'import os\n'), ((4450, 4487), 'os.path.join', 'os.path.join', (['temp_dir', '"""tarball.tar"""'], {}), "(temp_dir, 'tarball.tar')\n", (4462, 4487), False, 'import os\n'), ((6090,... |
import requests
import json
from datetime import datetime, timezone
def timestamp_from_api_response(resp):
try:
time = datetime.fromisoformat(resp)
return time.strftime('%d/%m/%Y')
except Exception as e:
return "ERROR (converting time)"
def days_until_collection(resp):
... | [
"datetime.datetime.now",
"json.loads",
"requests.request",
"datetime.datetime.fromisoformat"
] | [((925, 958), 'requests.request', 'requests.request', (['"""GET"""', 'endpoint'], {}), "('GET', endpoint)\n", (941, 958), False, 'import requests\n'), ((140, 168), 'datetime.datetime.fromisoformat', 'datetime.fromisoformat', (['resp'], {}), '(resp)\n', (162, 168), False, 'from datetime import datetime, timezone\n'), ((... |
'''pcornet_ont - Luigi Tasks to help load the SCILHS PCORNet Ontology
'''
from datetime import datetime
from typing import List, cast
import luigi
from etl_tasks import DBAccessTask, SourceTask
from etl_tasks import DBTarget, SchemaTarget, TimeStampParameter
from ont_load import MetaToConcepts
from param_val import... | [
"datetime.datetime",
"param_val.StrParam"
] | [((1724, 1757), 'param_val.StrParam', 'StrParam', ([], {'default': '"""PCORIMETADATA"""'}), "(default='PCORIMETADATA')\n", (1732, 1757), False, 'from param_val import StrParam\n'), ((1647, 1668), 'datetime.datetime', 'datetime', (['(2017)', '(3)', '(24)'], {}), '(2017, 3, 24)\n', (1655, 1668), False, 'from datetime imp... |
import boto3
import simplejson as json
import decimal
import operator
from boto3.dynamodb.conditions import Key, Attr
def lambda_handler(event, context):
dynamodb = boto3.resource('dynamodb', region_name='eu-west-1')
table = dynamodb.Table('BBAthleteTokens')
response = table.scan()
allitems = response[... | [
"boto3.resource",
"boto3.dynamodb.conditions.Key"
] | [((170, 221), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {'region_name': '"""eu-west-1"""'}), "('dynamodb', region_name='eu-west-1')\n", (184, 221), False, 'import boto3\n'), ((451, 502), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {'region_name': '"""eu-west-1"""'}), "('dynamodb', region_nam... |
"""
Comment Model
===========
Model for commenting on Practices and Lessons;
Always in a group under a user
"""
import logging
import os
import re
import config
import util
import mandrill
import searchable_properties as sndb
from .lesson import Lesson
from .model import Model
from .practice import Practice
from .t... | [
"searchable_properties.BooleanProperty",
"searchable_properties.StringProperty",
"searchable_properties.TextProperty",
"re.search"
] | [((489, 518), 'searchable_properties.TextProperty', 'sndb.TextProperty', ([], {'default': '""""""'}), "(default='')\n", (506, 518), True, 'import searchable_properties as sndb\n'), ((537, 570), 'searchable_properties.StringProperty', 'sndb.StringProperty', ([], {'default': 'None'}), '(default=None)\n', (556, 570), True... |
import copy
import os
import os.path
class Store:
"""This class stores binary data in files."""
def __init__(self, properties):
self._properties = properties
if "path" not in properties:
raise AttributeError("You must specify a path when creating a Store!")
if not os.pat... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"os.unlink",
"copy.copy"
] | [((448, 491), 'os.path.join', 'os.path.join', (["self._properties['path']", 'key'], {}), "(self._properties['path'], key)\n", (460, 491), False, 'import os\n'), ((745, 769), 'os.path.exists', 'os.path.exists', (['filepath'], {}), '(filepath)\n', (759, 769), False, 'import os\n'), ((2729, 2744), 'copy.copy', 'copy.copy'... |
# This file is part of Pynguin.
#
# Pynguin is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pynguin is distributed in the ho... | [
"time.time_ns"
] | [((1243, 1257), 'time.time_ns', 'time.time_ns', ([], {}), '()\n', (1255, 1257), False, 'import time\n'), ((1400, 1414), 'time.time_ns', 'time.time_ns', ([], {}), '()\n', (1412, 1414), False, 'import time\n')] |
#!/usr/bin/env python
# coding: utf-8
import sys
import logging
from amulog import cli
from amulog import common
from amulog import config
_logger = logging.getLogger(__package__.partition(".")[0])
def get_targets_conf(conf):
from amulog import __main__ as amulog_main
return amulog_main.get_targets_conf(co... | [
"amulog.config.set_common_logging",
"amulog.cli.main",
"amulog.config.open_config",
"amulog.config.getlist",
"amulog.common.recur_dir",
"amulog.__main__.is_online",
"amulog.__main__.get_targets_arg",
"amulog.__main__.get_targets_conf",
"amulog.common.rep_dir",
"amulog.common.Timer"
] | [((289, 323), 'amulog.__main__.get_targets_conf', 'amulog_main.get_targets_conf', (['conf'], {}), '(conf)\n', (317, 323), True, 'from amulog import __main__ as amulog_main\n'), ((409, 440), 'amulog.__main__.get_targets_arg', 'amulog_main.get_targets_arg', (['ns'], {}), '(ns)\n', (436, 440), True, 'from amulog import __... |
""" Unit tests for Master """
import asyncio
import logging
from unittest.mock import Mock
import pytest
from bhamon_orchestra_master.job_scheduler import JobScheduler
from bhamon_orchestra_master.master import Master
from bhamon_orchestra_master.supervisor import Supervisor
from ..mock_extensions import AsyncMock,... | [
"bhamon_orchestra_master.master.Master",
"pytest.raises",
"asyncio.sleep"
] | [((607, 803), 'bhamon_orchestra_master.master.Master', 'Master', ([], {'database_client_factory': 'None', 'project_provider': 'None', 'job_provider': 'None', 'schedule_provider': 'None', 'worker_provider': 'None', 'job_scheduler': 'job_scheduler_mock', 'supervisor': 'supervisor_mock'}), '(database_client_factory=None, ... |
# coding: utf8
import numpy as np
class FootTrajectoryGenerator:
"""A foot trajectory generator that handles the generation of a 3D trajectory
with a 5th order polynomial to lead each foot from its location at the start of
its swing phase to its final location that has been decided by the FootstepPlanner... | [
"numpy.tile",
"numpy.where",
"numpy.array",
"numpy.zeros",
"numpy.dot",
"numpy.cos",
"numpy.sin"
] | [((575, 666), 'numpy.array', 'np.array', (['[[0.1946, 0.1946, -0.1946, -0.1946], [0.14695, -0.14695, 0.14695, -0.14695]]'], {}), '([[0.1946, 0.1946, -0.1946, -0.1946], [0.14695, -0.14695, 0.14695, \n -0.14695]])\n', (583, 666), True, 'import numpy as np\n'), ((1017, 1052), 'numpy.array', 'np.array', (['[[0.0, -1.0],... |
import numpy as np
class Trajectory:
def __init__(self):
pass
@classmethod
def LSPB(cls, q0, qf, tf, tb, t_step=0.07):
q0 = np.array(q0)
qf = np.array(qf)
if np.allclose(q0, qf):
t = [0.0]
q_pos = [qf]
return q_pos, t
# Define c... | [
"numpy.allclose",
"numpy.array",
"numpy.linalg.inv",
"numpy.isnan",
"numpy.concatenate",
"numpy.zeros_like",
"numpy.arange"
] | [((155, 167), 'numpy.array', 'np.array', (['q0'], {}), '(q0)\n', (163, 167), True, 'import numpy as np\n'), ((181, 193), 'numpy.array', 'np.array', (['qf'], {}), '(qf)\n', (189, 193), True, 'import numpy as np\n'), ((205, 224), 'numpy.allclose', 'np.allclose', (['q0', 'qf'], {}), '(q0, qf)\n', (216, 224), True, 'import... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 12 23:39:45 2017
@author: Karolis
"""
import json
import time
from bs4 import BeautifulSoup
import selenium.webdriver as webdriver
from selenium.webdriver.common.keys import Keys
SLEEP_BETWEEN_CALLS = 2 #sec
NUM_TRIES_TO_SCRAPE = 3
def get_num_posts(driver):
s... | [
"bs4.BeautifulSoup",
"json.dump",
"selenium.webdriver.Firefox",
"time.sleep"
] | [((326, 374), 'bs4.BeautifulSoup', 'BeautifulSoup', (['driver.page_source', '"""html.parser"""'], {}), "(driver.page_source, 'html.parser')\n", (339, 374), False, 'from bs4 import BeautifulSoup\n'), ((1626, 1657), 'time.sleep', 'time.sleep', (['SLEEP_BETWEEN_CALLS'], {}), '(SLEEP_BETWEEN_CALLS)\n', (1636, 1657), False,... |
import torch
import torch.nn as nn
from torch.utils.data import DataLoader, Dataset, Subset
from torch.cuda import amp
import numpy as np
import logging
import time
import os
from os import mkdir, listdir, getcwd
from os.path import join, exists
from copy import deepcopy
class EarlyStopping(object):
'''
Per... | [
"logging.getLogger",
"logging.StreamHandler",
"copy.deepcopy",
"os.path.exists",
"torch.cuda.amp.GradScaler",
"time.perf_counter",
"torch.cuda.amp.autocast",
"numpy.ceil",
"logging.getLevelName",
"torch.cuda.get_device_name",
"logging.Formatter",
"torch.load",
"os.path.join",
"os.getcwd",
... | [((8088, 8138), 'os.path.join', 'join', (["self._config['output_folder']", '"""checkpoints"""'], {}), "(self._config['output_folder'], 'checkpoints')\n", (8092, 8138), False, 'from os.path import join, exists\n'), ((8732, 8756), 'torch.zeros', 'torch.zeros', ([], {'size': '(bpe,)'}), '(size=(bpe,))\n', (8743, 8756), Fa... |
# -*- coding: utf-8 -*-
from django.test import TestCase
from djangocms_semantic_ui.models import Segment
class SegmentTestCase(TestCase):
def setUp(self):
pass
def test_models(self):
segment = Segment.objects.create(
label='Test',
color='green',
inverted... | [
"djangocms_semantic_ui.models.Segment.objects.create"
] | [((223, 323), 'djangocms_semantic_ui.models.Segment.objects.create', 'Segment.objects.create', ([], {'label': '"""Test"""', 'color': '"""green"""', 'inverted_color': '(False)', 'type_segment': '"""raised"""'}), "(label='Test', color='green', inverted_color=False,\n type_segment='raised')\n", (245, 323), False, 'from... |
# Copyright (c) 2017 Sony Corporation. 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 applicabl... | [
"nnabla.utils.nnp_graph.NnpNetworkPass"
] | [((3361, 3384), 'nnabla.utils.nnp_graph.NnpNetworkPass', 'NnpNetworkPass', (['verbose'], {}), '(verbose)\n', (3375, 3384), False, 'from nnabla.utils.nnp_graph import NnpNetworkPass\n')] |
import json
import requests
api_key = "<KEY>"
url = "https://api.ambeedata.com/latest/fire"
querystring = {"lat": "12.9889055", "lng": "77.574044"}
headers = {
'x-api-key': api_key,
'Content-type': "application/json"
}
response = requests.request("GET", url, headers=headers, params=querystring)
if response:
... | [
"requests.request"
] | [((240, 305), 'requests.request', 'requests.request', (['"""GET"""', 'url'], {'headers': 'headers', 'params': 'querystring'}), "('GET', url, headers=headers, params=querystring)\n", (256, 305), False, 'import requests\n')] |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 10 15:49:49 2021
@author: <NAME>
"""
import matplotlib.pyplot as plt
import cv2
import tensorflow_hub as hub
import tensorflow as tf
import numpy as np
import file_path as f
# Load the model from tensorflow hub
model = hub.load('https://tfhub.dev/google/magenta/arbitrar... | [
"tensorflow.image.convert_image_dtype",
"tensorflow.io.read_file",
"tensorflow_hub.load",
"numpy.squeeze",
"tensorflow.constant",
"tensorflow.image.decode_image",
"matplotlib.pyplot.show"
] | [((269, 355), 'tensorflow_hub.load', 'hub.load', (['"""https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2"""'], {}), "(\n 'https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2')\n", (277, 355), True, 'import tensorflow_hub as hub\n'), ((1019, 1029), 'matplotlib.pyplot.show', 'plt.... |
##==================================
##Mosaic To New Raster
##Usage: MosaicToNewRaster_management inputs;inputs... output_location raster_dataset_name_with_extension
## {coordinate_system_for_the_raster} 8_BIT_UNSIGNED | 1_BIT | 2_BIT | 4_BIT
## ... | [
"arcpy.CheckOutExtension",
"arcpy.SpatialReference",
"arcpy.management.MosaicToNewRaster",
"arcpy.da.Walk"
] | [((1189, 1217), 'arcpy.SpatialReference', 'arcpy.SpatialReference', (['(3006)'], {}), '(3006)\n', (1211, 1217), False, 'import arcpy, time\n'), ((1235, 1269), 'arcpy.CheckOutExtension', 'arcpy.CheckOutExtension', (['"""Spatial"""'], {}), "('Spatial')\n", (1258, 1269), False, 'import arcpy, time\n'), ((1329, 1393), 'arc... |
import os
import wandb
import torch
import torchvision
from config import set_params
from kws.utils import set_random_seed, transforms
from kws.utils.data import SpeechCommandsDataset, load_data, split_data
from kws.model import treasure_net
from kws.train import train
def main():
# set parameters and random seed... | [
"kws.utils.transforms.RandomVolume",
"kws.utils.data.SpeechCommandsDataset",
"torch.utils.data.DataLoader",
"kws.model.treasure_net",
"kws.train.train",
"torch.load",
"wandb.init",
"kws.utils.transforms.AudioNoise",
"kws.utils.data.load_data",
"kws.utils.data.split_data",
"config.set_params",
... | [((334, 346), 'config.set_params', 'set_params', ([], {}), '()\n', (344, 346), False, 'from config import set_params\n'), ((351, 389), 'kws.utils.set_random_seed', 'set_random_seed', (["params['random_seed']"], {}), "(params['random_seed'])\n", (366, 389), False, 'from kws.utils import set_random_seed, transforms\n'), ... |
import os
from parglare import GLRParser, Grammar, NodeNonTerm, NodeTerm, REDUCE
class CParser:
def __init__(self):
self._glr = None
self._setup_parser()
self.user_defined_types = set()
def _setup_parser(self):
"""Setup parser."""
file_path = os.path.realpath(os.path... | [
"subprocess.Popen",
"os.path.join",
"subprocess.STARTUPINFO",
"os.path.realpath",
"os.path.dirname",
"os.unlink",
"tempfile.NamedTemporaryFile",
"parglare.Grammar.from_file"
] | [((7218, 7283), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'mode': '"""w+"""', 'suffix': '""".c"""', 'delete': '(False)'}), "(mode='w+', suffix='.c', delete=False)\n", (7245, 7283), False, 'import tempfile\n'), ((7596, 7716), 'subprocess.Popen', 'subprocess.Popen', (['command'], {'cwd': 'cwd', ... |
# Generated by Django 2.0.1 on 2018-02-28 05:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('attendance', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='event',
name='absent_member',
... | [
"django.db.models.ManyToManyField"
] | [((334, 402), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'default': 'None', 'to': '"""member.Member"""'}), "(blank=True, default=None, to='member.Member')\n", (356, 402), False, 'from django.db import migrations, models\n')] |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"OvmFaultConstants.ShellExceutedFailedException",
"simplejson.dumps",
"subprocess.Popen",
"OvmLoggerModule.OvmLogger",
"OVSSiteRMServer.get_master_ip",
"popen2.Popen3",
"simplejson.loads"
] | [((1568, 1590), 'OvmLoggerModule.OvmLogger', 'OvmLogger', (['"""OvmCommon"""'], {}), "('OvmCommon')\n", (1577, 1590), False, 'from OvmLoggerModule import OvmLogger\n'), ((2360, 2401), 'simplejson.loads', 'json.loads', (['jStr'], {'object_hook': 'toAsciiHook'}), '(jStr, object_hook=toAsciiHook)\n', (2370, 2401), True, '... |
# Copyright 2021 MosaicML. All Rights Reserved.
"""GPT-2 model based on `Hugging Face GPT-2 <https://huggingface.co/docs/transformers/master/en/model_doc/gpt2>`_.
Implemented as a wrapper using :class:`.ComposerTrainer`.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Mapping, Sequence, Uni... | [
"composer.models.nlp_metrics.Perplexity",
"torchmetrics.MetricCollection"
] | [((2775, 2787), 'composer.models.nlp_metrics.Perplexity', 'Perplexity', ([], {}), '()\n', (2785, 2787), False, 'from composer.models.nlp_metrics import Perplexity\n'), ((2818, 2830), 'composer.models.nlp_metrics.Perplexity', 'Perplexity', ([], {}), '()\n', (2828, 2830), False, 'from composer.models.nlp_metrics import P... |
from __future__ import annotations
from deprecation import deprecated
from itertools import chain
from typing import (
Any,
Mapping,
MutableMapping,
MutableSequence,
Optional,
Sequence,
Tuple,
TypeVar,
Union,
)
from snuba.datasets.schemas import RelationalSource
from snuba.query.ty... | [
"deprecation.deprecated",
"snuba.util.to_list",
"snuba.util.is_condition",
"snuba.util.SAFE_COL_RE.match",
"snuba.util.columns_in_expr",
"typing.TypeVar"
] | [((569, 588), 'typing.TypeVar', 'TypeVar', (['"""TElement"""'], {}), "('TElement')\n", (576, 588), False, 'from typing import Any, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, TypeVar, Union\n'), ((5380, 5502), 'deprecation.deprecated', 'deprecated', ([], {'details': '"""Do not access the intern... |
# __init__ for osgeo package.
# making the osgeo package version the same as the gdal version:
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = i... | [
"imp.load_module",
"_gdal.VersionInfo",
"os.path.dirname"
] | [((767, 800), '_gdal.VersionInfo', '_gdal.VersionInfo', (['"""RELEASE_NAME"""'], {}), "('RELEASE_NAME')\n", (784, 800), False, 'import _gdal\n'), ((516, 567), 'imp.load_module', 'imp.load_module', (['"""_gdal"""', 'fp', 'pathname', 'description'], {}), "('_gdal', fp, pathname, description)\n", (531, 567), False, 'impor... |
import numpy as np
from harmonic_equation import harmonic_equation
from equation import equation
import low_level_tools as llt
################################################################################
def eq_11_bc(current):
N, M = current[0].shape
z = np.linspace(0, 1, N)
x, y = np.meshgrid(z, z, i... | [
"numpy.sqrt",
"numpy.log",
"numpy.sinh",
"numpy.array",
"low_level_tools.dx_forward",
"numpy.sin",
"harmonic_equation.harmonic_equation",
"low_level_tools.d2y",
"low_level_tools.dy_forward",
"low_level_tools.dxdy",
"numpy.exp",
"numpy.linspace",
"low_level_tools.dx",
"numpy.meshgrid",
"n... | [((269, 289), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'N'], {}), '(0, 1, N)\n', (280, 289), True, 'import numpy as np\n'), ((301, 333), 'numpy.meshgrid', 'np.meshgrid', (['z', 'z'], {'indexing': '"""ij"""'}), "(z, z, indexing='ij')\n", (312, 333), True, 'import numpy as np\n'), ((348, 361), 'numpy.exp', 'np.ex... |
import itertools
import json
from django.http import HttpResponse, Http404
from django.shortcuts import get_object_or_404
from django.template.defaultfilters import date
from django.urls import reverse
from django.utils.timezone import now
from django.views import View
from django.views.decorators.cache import cache_p... | [
"django.template.defaultfilters.date",
"apps.comics.models.Ad.objects.filter",
"itertools.groupby",
"django.http.HttpResponse",
"django.shortcuts.get_object_or_404",
"django.utils.timezone.now",
"django.views.decorators.cache.cache_page",
"apps.comics.models.Page.objects.order_by",
"django.urls.reve... | [((2200, 2219), 'django.views.decorators.cache.cache_page', 'cache_page', (['(60 * 60)'], {}), '(60 * 60)\n', (2210, 2219), False, 'from django.views.decorators.cache import cache_page\n'), ((751, 822), 'django.urls.reverse', 'reverse', (['"""reader"""'], {'kwargs': "{'comic': page.comic.slug, 'page': page.slug}"}), "(... |
"""
# configparser.py
Module to parse and validate the yaml configuration files.
"""
import yaml
import os
from .account import Account
def read_config_files(folder):
"""Retrieve account objects from yaml configuration files in given folder.
:param folder: Folder containing config files
:return: list o... | [
"yaml.safe_load",
"os.listdir",
"os.path.join"
] | [((390, 413), 'os.path.join', 'os.path.join', (['folder', 'f'], {}), '(folder, f)\n', (402, 413), False, 'import os\n'), ((423, 441), 'os.listdir', 'os.listdir', (['folder'], {}), '(folder)\n', (433, 441), False, 'import os\n'), ((554, 576), 'yaml.safe_load', 'yaml.safe_load', (['stream'], {}), '(stream)\n', (568, 576)... |
import discord
import datetime
import random
import requests as req
from bs4 import BeautifulSoup as bs
import re
class Bot(discord.Client):
def _init_(self):
super()._init_()
def random_color(self):
hexa = "0123456789abcd"
random_hex = "0x"
for i in range(6):
random_hex += random.choic... | [
"random.choice",
"datetime.datetime.utcnow",
"discord.utils.get",
"requests.get",
"bs4.BeautifulSoup",
"re.sub",
"discord.Embed"
] | [((440, 455), 'discord.Embed', 'discord.Embed', ([], {}), '()\n', (453, 455), False, 'import discord\n'), ((1062, 1088), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (1086, 1088), False, 'import datetime\n'), ((308, 327), 'random.choice', 'random.choice', (['hexa'], {}), '(hexa)\n', (321, 3... |
# Generated by Django 2.2.5 on 2019-09-10 16:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailcommerce_promotions', '0009_coupon_categories'),
]
operations = [
migrations.AlterField(
model_name='coupon',
... | [
"django.db.models.ManyToManyField"
] | [((358, 564), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'help_text': '"""Only apply to products in selected categories"""', 'limit_choices_to': "{'numchild': 0}", 'related_name': '"""coupons"""', 'to': '"""wagtailcommerce_products.Category"""'}), "(blank=True, help_text=\n ... |
import flux
import pytest
import requests
from flask_app import models
from .utils import model_for
def test_start_session_with_subjects(client, subjects):
session = client.report_session_start(
subjects=subjects
)
assert session.refresh().subjects == [dict(s) for s in subjects]
def test_add_su... | [
"flux.current_timeline.time",
"pytest.mark.parametrize",
"flask_app.models.Subject.query.filter_by"
] | [((1315, 1388), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""field_name"""', "['product', 'version', 'revision']"], {}), "('field_name', ['product', 'version', 'revision'])\n", (1338, 1388), False, 'import pytest\n'), ((1013, 1041), 'flux.current_timeline.time', 'flux.current_timeline.time', ([], {}), '(... |
# Jedi breaks frequently after 0.10.2.
# Here is some regression tests to make sure Jedi is not going to break this app
import jedi
def test_keyword_completion():
completions = jedi.Script('def a():\n pa').complete()
assert len(completions) == 1
assert completions[0].name == 'pass'
def test_call_signat... | [
"jedi.Script"
] | [((184, 212), 'jedi.Script', 'jedi.Script', (['"""def a():\n pa"""'], {}), "('def a():\\n pa')\n", (195, 212), False, 'import jedi\n'), ((400, 417), 'jedi.Script', 'jedi.Script', (['code'], {}), '(code)\n', (411, 417), False, 'import jedi\n')] |
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='pypersonalfin',
version='1.0.1',
url='https://github.com/guilhermebruzzi/pypersonalfin',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['pypersonalfin'],
install_requires=[
'python-slugify>=4,<5... | [
"setuptools.setup"
] | [((54, 336), 'setuptools.setup', 'setup', ([], {'name': '"""pypersonalfin"""', 'version': '"""1.0.1"""', 'url': '"""https://github.com/guilhermebruzzi/pypersonalfin"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'packages': "['pypersonalfin']", 'install_requires': "['python-slug... |
from __future__ import absolute_import
from __future__ import print_function
import veriloggen
import types_axi_slave_readwrite_lite_simultaneous
expected_verilog = """
module test;
reg CLK;
reg RST;
wire [32-1:0] sum;
reg [32-1:0] myaxi_awaddr;
reg [4-1:0] myaxi_awcache;
reg [3-1:0] myaxi_awprot;
reg m... | [
"pyverilog.ast_code_generator.codegen.ASTCodeGenerator",
"veriloggen.reset",
"types_axi_slave_readwrite_lite_simultaneous.mkTest",
"pyverilog.vparser.parser.VerilogParser"
] | [((14589, 14607), 'veriloggen.reset', 'veriloggen.reset', ([], {}), '()\n', (14605, 14607), False, 'import veriloggen\n'), ((14626, 14678), 'types_axi_slave_readwrite_lite_simultaneous.mkTest', 'types_axi_slave_readwrite_lite_simultaneous.mkTest', ([], {}), '()\n', (14676, 14678), False, 'import types_axi_slave_readwri... |
# import json
# from keras.models import model_from_json
# from keras.optimizers import sgd
import os.path
from Training.qlearn import Training
from Testing.test import Testing
# Change what is being trained/tested here.
from Parameters import pong_target_1000 as param
if __name__ == "__main__":
# These four l... | [
"Testing.test.Testing",
"Training.qlearn.Training",
"Parameters.pong_target_1000.setup"
] | [((472, 485), 'Parameters.pong_target_1000.setup', 'param.setup', ([], {}), '()\n', (483, 485), True, 'from Parameters import pong_target_1000 as param\n'), ((1330, 1503), 'Training.qlearn.Training', 'Training', (['env', 'model', 'model_name', 'max_memory', 'batch_size', 'target_model_update'], {'enable_double': 'enabl... |
"""Upvote|Downvote pitch table
Revision ID: ee6bced5ea09
Revises: <PASSWORD>
Create Date: 2019-05-29 11:42:43.594430
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ee6bced5ea09'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade... | [
"alembic.op.create_foreign_key",
"alembic.op.drop_constraint",
"alembic.op.drop_table",
"alembic.op.drop_column",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer",
"sqlalchemy.String",
"sqlalchemy.Time"
] | [((869, 941), 'alembic.op.create_foreign_key', 'op.create_foreign_key', (['None', '"""users"""', '"""comments"""', "['comment_id']", "['id']"], {}), "(None, 'users', 'comments', ['comment_id'], ['id'])\n", (890, 941), False, 'from alembic import op\n'), ((1066, 1119), 'alembic.op.drop_constraint', 'op.drop_constraint',... |
import numpy as np
import torch
import utils
if __name__ == '__main__':
args = utils.parse_args()
print(f'Running baseline for ALRS testing...\nArgs:\n{utils.args_to_str(args)}\n')
displayed_rendering_error = False
best_config = None
best_info_list = None
best_val_loss = np.inf
ini... | [
"utils.save_baseline",
"utils.step_decay_action",
"numpy.log",
"utils.make_alrs_env",
"utils.args_to_str",
"utils.parse_args",
"utils.dict_to_file"
] | [((86, 104), 'utils.parse_args', 'utils.parse_args', ([], {}), '()\n', (102, 104), False, 'import utils\n'), ((2439, 2504), 'utils.dict_to_file', 'utils.dict_to_file', (['best_config', 'filename'], {'path': '"""data/baselines/"""'}), "(best_config, filename, path='data/baselines/')\n", (2457, 2504), False, 'import util... |
""" Exit program """
from log_generator.dateTime_handler import get_dateNow
import sys
# sortir du programme
def exitProgram():
print("Sortie du programme : " + get_dateNow())
sys.exit() | [
"log_generator.dateTime_handler.get_dateNow",
"sys.exit"
] | [((186, 196), 'sys.exit', 'sys.exit', ([], {}), '()\n', (194, 196), False, 'import sys\n'), ((167, 180), 'log_generator.dateTime_handler.get_dateNow', 'get_dateNow', ([], {}), '()\n', (178, 180), False, 'from log_generator.dateTime_handler import get_dateNow\n')] |
import os
import sqlite3
from .fixtures import *
def test_title_is_htmlencoded_in_index_html(tmp_path, process, disable_extractors_dict):
"""
https://github.com/pirate/ArchiveBox/issues/330
Unencoded content should not be rendered as it facilitates xss injections
and breaks the layout.
"""
sub... | [
"os.chdir",
"sqlite3.connect"
] | [((930, 948), 'os.chdir', 'os.chdir', (['tmp_path'], {}), '(tmp_path)\n', (938, 948), False, 'import os\n'), ((960, 992), 'sqlite3.connect', 'sqlite3.connect', (['"""index.sqlite3"""'], {}), "('index.sqlite3')\n", (975, 992), False, 'import sqlite3\n'), ((1500, 1518), 'os.chdir', 'os.chdir', (['tmp_path'], {}), '(tmp_p... |
import rospy
from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement
class GoalSeen(AbstractDecisionElement):
def __init__(self, blackboard, dsd, parameters=None):
super(GoalSeen, self).__init__(blackboard, dsd, parameters)
self.goal_lost_time = rospy.Duration(self.bla... | [
"rospy.Duration",
"rospy.Time",
"rospy.Time.now"
] | [((297, 353), 'rospy.Duration', 'rospy.Duration', (["self.blackboard.config['goal_lost_time']"], {}), "(self.blackboard.config['goal_lost_time'])\n", (311, 353), False, 'import rospy\n'), ((570, 583), 'rospy.Time', 'rospy.Time', (['(0)'], {}), '(0)\n', (580, 583), False, 'import rospy\n'), ((446, 462), 'rospy.Time.now'... |
import unittest
import datetime
from unittest.mock import MagicMock
from osgar.drivers.winsen_gas_detector import WinsenCO2
class WinsenCO2Test(unittest.TestCase):
def test_parse_packet(self):
ref_packet = bytes.fromhex('ff86063b3d000000fc')
sensor = WinsenCO2(config={}, bus=MagicMock())
... | [
"unittest.mock.MagicMock"
] | [((300, 311), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (309, 311), False, 'from unittest.mock import MagicMock\n'), ((600, 611), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (609, 611), False, 'from unittest.mock import MagicMock\n'), ((848, 859), 'unittest.mock.MagicMock', 'MagicMock', ([... |
# Generated by Django 3.1.8 on 2021-06-24 15:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('employees', '0011_auto_20210624_2313'),
]
operations = [
migrations.RenameField(
model_name='employee',
old_name='dept_role'... | [
"django.db.migrations.RenameField"
] | [((229, 328), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""employee"""', 'old_name': '"""dept_role"""', 'new_name': '"""department_role"""'}), "(model_name='employee', old_name='dept_role',\n new_name='department_role')\n", (251, 328), False, 'from django.db import migrations... |
# Streamlit practice 2021 0223
import streamlit as st
import pandas as pd
import numpy as np
import scanpy as sc
import os
from ..applications import Oracle_development_module, Oracle_systematic_analysis_helper
from .perturb_simulation_visualization import (plot_cluster_and_dev_flow,
... | [
"scanpy.pl.embedding",
"streamlit.cache",
"pandas.read_parquet",
"streamlit.sidebar.write",
"scanpy.read_h5ad",
"os.makedirs",
"streamlit.write",
"os.path.isfile",
"streamlit.sidebar.slider",
"os.path.isdir",
"os.path.basename",
"streamlit.sidebar.number_input",
"streamlit.columns"
] | [((1694, 1730), 'streamlit.cache', 'st.cache', ([], {'allow_output_mutation': '(True)'}), '(allow_output_mutation=True)\n', (1702, 1730), True, 'import streamlit as st\n'), ((2417, 2479), 'streamlit.cache', 'st.cache', ([], {'allow_output_mutation': '(True)', 'suppress_st_warning': '(True)'}), '(allow_output_mutation=T... |
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
""" Implementation of the performance instrumentation report. """
import json
import numpy as np
import re
class InstrumentationReport(object):
@staticmethod
def get_event_uuid(event):
uuid = (-1, -1, -1)
if 'args' in... | [
"numpy.mean",
"numpy.median",
"re.match",
"numpy.max",
"numpy.array",
"numpy.min",
"json.load"
] | [((830, 874), 're.match', 're.match', (['""".*report-(\\\\d+)\\\\.json"""', 'filename'], {}), "('.*report-(\\\\d+)\\\\.json', filename)\n", (838, 874), False, 'import re\n'), ((6740, 6756), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (6748, 6756), True, 'import numpy as np\n'), ((1122, 1135), 'json.load'... |
# Copyright 2017 The TensorFlow Authors. 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... | [
"sys.setdlopenflags",
"sys.getdlopenflags"
] | [((1834, 1854), 'sys.getdlopenflags', 'sys.getdlopenflags', ([], {}), '()\n', (1852, 1854), False, 'import sys\n'), ((1913, 1975), 'sys.setdlopenflags', 'sys.setdlopenflags', (['(_default_dlopen_flags | ctypes.RTLD_GLOBAL)'], {}), '(_default_dlopen_flags | ctypes.RTLD_GLOBAL)\n', (1931, 1975), False, 'import sys\n'), (... |
"""
Data module for configuration, data storage and file manipulation
"""
import os
import sys
import yaml
import platform
import shutil
from datetime import date
from pathlib import Path
from typing import List, Dict, Any
class Account:
"""
Helper class for Config
Account:
user_id: string
... | [
"yaml.full_load",
"yaml.dump",
"pathlib.Path",
"os.path.isfile",
"platform.system",
"sys.exit",
"platform.machine",
"datetime.date.today"
] | [((4393, 4410), 'platform.system', 'platform.system', ([], {}), '()\n', (4408, 4410), False, 'import platform\n'), ((4432, 4450), 'platform.machine', 'platform.machine', ([], {}), '()\n', (4448, 4450), False, 'import platform\n'), ((5796, 5826), 'os.path.isfile', 'os.path.isfile', (['self.yaml_path'], {}), '(self.yaml_... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <<EMAIL>>
#
# 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 ... | [
"jinja2.FileSystemLoader",
"pkg_resources.resource_filename",
"io.open"
] | [((1852, 1868), 'io.open', 'open', (['path', '"""w+"""'], {}), "(path, 'w+')\n", (1856, 1868), False, 'from io import open\n'), ((2102, 2148), 'pkg_resources.resource_filename', 'pkgrf', (['"""mriqc"""', '"""data/reports/individual.html"""'], {}), "('mriqc', 'data/reports/individual.html')\n", (2107, 2148), True, 'from... |
from boa3.builtin.nativecontract.stdlib import StdLib
def main() -> int:
return StdLib.atoi('100', 10, 'extra')
| [
"boa3.builtin.nativecontract.stdlib.StdLib.atoi"
] | [((86, 117), 'boa3.builtin.nativecontract.stdlib.StdLib.atoi', 'StdLib.atoi', (['"""100"""', '(10)', '"""extra"""'], {}), "('100', 10, 'extra')\n", (97, 117), False, 'from boa3.builtin.nativecontract.stdlib import StdLib\n')] |
import discord
from discord.ext import commands
from wand.image import Image
import io
from styrobot.util import message
def image_command(name):
def deco(func):
async def wrapper(self, ctx: commands.Context):
img = await message.image_walk(ctx.message)
if img is None:
... | [
"wand.image.Image",
"discord.ext.commands.command",
"discord.File",
"styrobot.util.message.image_walk"
] | [((997, 1065), 'wand.image.Image', 'Image', ([], {'width': 'img.width', 'height': 'img.height', 'pseudo': '"""canvas:lightgray"""'}), "(width=img.width, height=img.height, pseudo='canvas:lightgray')\n", (1002, 1065), False, 'from wand.image import Image\n'), ((755, 782), 'discord.ext.commands.command', 'commands.comman... |
"""
Gets concordance and collocation for keywords occurring in articles
which have a target word and groups the results by date.
Words in articles, target words and keywords can be normalized,
normalized and stemmed, or normalized and lemmatized (default).
"""
from defoe import query_utils
from defoe.papers.query_uti... | [
"defoe.query_utils.get_config",
"defoe.query_utils.extract_window_size",
"defoe.papers.query_utils.get_article_keyword_idx",
"os.path.dirname",
"defoe.papers.query_utils.article_contains_word",
"defoe.papers.query_utils.get_concordance",
"defoe.query_utils.extract_preprocess_word_type",
"defoe.query_u... | [((2169, 2204), 'defoe.query_utils.get_config', 'query_utils.get_config', (['config_file'], {}), '(config_file)\n', (2191, 2204), False, 'from defoe import query_utils\n'), ((2228, 2276), 'defoe.query_utils.extract_preprocess_word_type', 'query_utils.extract_preprocess_word_type', (['config'], {}), '(config)\n', (2268,... |
# Copyright 2019 The Android Open Source Project
#
# 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 ag... | [
"os.path.exists",
"zipfile.ZipFile",
"urlfetch.get",
"consolemenu.SelectionMenu.get_selection",
"os.getcwd",
"xml.etree.ElementTree.fromstring",
"zipfile.is_zipfile"
] | [((1838, 1858), 'os.path.exists', 'os.path.exists', (['dest'], {}), '(dest)\n', (1852, 1858), False, 'import os\n'), ((7719, 7810), 'consolemenu.SelectionMenu.get_selection', 'SelectionMenu.get_selection', (['display'], {'title': '"""Select the system image you wish to use:"""'}), "(display, title=\n 'Select the sys... |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in ... | [
"autobahn.twisted.websocket.connectWS",
"zope.interface.implementer",
"ranstring.randomByteString",
"twisted.internet.reactor.run",
"autobahn.twisted.websocket.WebSocketClientFactory"
] | [((1625, 1662), 'zope.interface.implementer', 'implementer', (['interfaces.IPushProducer'], {}), '(interfaces.IPushProducer)\n', (1636, 1662), False, 'from zope.interface import implementer\n'), ((3407, 3453), 'autobahn.twisted.websocket.WebSocketClientFactory', 'WebSocketClientFactory', (['u"""ws://127.0.0.1:9000"""']... |
# Common Segmentation Operator implemented by Pytorch
# XiangtaiLi(<EMAIL>)
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import BatchNorm2d
upsample = lambda x, size: F.interpolate(x, size, mode='bilinear', align_corners=True)
def conv3x3(in_planes, out_planes, stride=1):
""... | [
"torch.bmm",
"torch.nn.ReLU",
"torch.nn.Sigmoid",
"torch.nn.Softmax",
"torch.nn.Sequential",
"torch.nn.Dropout2d",
"torch.nn.Conv2d",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.functional.interpolate",
"torch.nn.functional.pad",
"torch.nn.Linear",
"torch.cat"
] | [((206, 265), 'torch.nn.functional.interpolate', 'F.interpolate', (['x', 'size'], {'mode': '"""bilinear"""', 'align_corners': '(True)'}), "(x, size, mode='bilinear', align_corners=True)\n", (219, 265), True, 'import torch.nn.functional as F\n'), ((364, 453), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'],... |
from functools import reduce
def test_find_longest_sequence():
"""
Given an array L,
find the position p and length k which
- all elements to the left of p from p-k position are in ascending order
- all elements to the right of p until p+k position are in descending order
- and L[p] is the biggest a... | [
"functools.reduce",
"bisect.insort_left"
] | [((1396, 1419), 'bisect.insort_left', 'insort_left', (['ymap[y]', 'x'], {}), '(ymap[y], x)\n', (1407, 1419), False, 'from bisect import insort_left\n'), ((4455, 4491), 'functools.reduce', 'reduce', (['(lambda a, b: a + b)', 'assigned'], {}), '(lambda a, b: a + b, assigned)\n', (4461, 4491), False, 'from functools impor... |
import numpy
import matplotlib.pylab as plt
class LinearHeadHead(object):
"""
Solves the system:
\div \frac{\rho}{\mu} k \grad (p + \rho g z) = 0 on the domain [x_0, x_1] \cross [z_0,z_1]
Boundary conditions are given by:
h(x_0,z,t) = h_0 [m] => p(x_0,z,t)=(h_0-z) \rho g
h(x_1,... | [
"amanzi_xml.utils.search.find_tag_path",
"matplotlib.pylab.xlabel",
"numpy.linspace",
"numpy.zeros",
"matplotlib.pylab.plot",
"matplotlib.pylab.ylabel"
] | [((3622, 3658), 'numpy.linspace', 'numpy.linspace', (['lhh.x_0', 'lhh.x_1', '(11)'], {}), '(lhh.x_0, lhh.x_1, 11)\n', (3636, 3658), False, 'import numpy\n'), ((3716, 3736), 'numpy.zeros', 'numpy.zeros', (['(11, 2)'], {}), '((11, 2))\n', (3727, 3736), False, 'import numpy\n'), ((4033, 4048), 'matplotlib.pylab.plot', 'pl... |
"""Checks validation of file for uploading to CAR"""
from __future__ import annotations
import pandas as pd
from rdkit import Chem
from .recipebuilder.encodedrecipes import encoded_recipes
from .utils import canonSmiles, getAddtionOrder, checkReactantSMARTS, combichem
class ValidateFile(object):
"""
Creates ... | [
"pandas.DataFrame",
"rdkit.Chem.MolFromSmiles",
"rdkit.Chem.MolToSmiles",
"pandas.read_csv"
] | [((624, 669), 'pandas.read_csv', 'pd.read_csv', (['csv_to_validate'], {'encoding': '"""utf8"""'}), "(csv_to_validate, encoding='utf8')\n", (635, 669), True, 'import pandas as pd\n'), ((7367, 7390), 'rdkit.Chem.MolFromSmiles', 'Chem.MolFromSmiles', (['smi'], {}), '(smi)\n', (7385, 7390), False, 'from rdkit import Chem\n... |
import psutil
from time import sleep
import os
import winsound
t=int(input("Percentage: "))
while True:
battery = psutil.sensors_battery()
if battery.percent<t+1:
winsound.Beep(2500, 800)
for i in range(9,-1,-1):
print(f'Sutting Down in {i} sec')
sleep(1)
break
... | [
"os.system",
"winsound.Beep",
"psutil.sensors_battery",
"time.sleep"
] | [((348, 377), 'os.system', 'os.system', (['"""shutdown /s /t 1"""'], {}), "('shutdown /s /t 1')\n", (357, 377), False, 'import os\n'), ((119, 143), 'psutil.sensors_battery', 'psutil.sensors_battery', ([], {}), '()\n', (141, 143), False, 'import psutil\n'), ((180, 204), 'winsound.Beep', 'winsound.Beep', (['(2500)', '(80... |
#!/usr/bin/env python
# Copyright (c) 2014 Unbounded Robotics Inc.
# All right 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
# not... | [
"socket.socket",
"argparse.ArgumentParser"
] | [((2178, 2222), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (2201, 2222), False, 'import argparse\n'), ((3017, 3032), 'socket.socket', 'socket.socket', ([], {}), '()\n', (3030, 3032), False, 'import socket\n')] |
import torch
import torch.nn as nn
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchvision.utils as utils
import matplotlib.pyplot as plt
import numpy as np
from torchvision.utils import save_image
import imageio
from PIL imp... | [
"torch.cuda.is_available",
"sys.exit",
"torchvision.utils.make_grid",
"matplotlib.pyplot.imshow",
"os.listdir",
"matplotlib.pyplot.axis",
"torchvision.transforms.ToTensor",
"torch.randn",
"generator.CGenerator",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize",
"matplotlib.p... | [((5930, 5955), 'torch.randn', 'torch.randn', (['(1)', '(100)', '(1)', '(1)'], {}), '(1, 100, 1, 1)\n', (5941, 5955), False, 'import torch\n'), ((6004, 6017), 'generator.getImage', 'getImage', (['res'], {}), '(res)\n', (6012, 6017), False, 'from generator import Generator, getImage, CGenerator\n'), ((6022, 6037), 'matp... |
import pygame
import random
pygame.init()
bg_color = (192, 192, 192)
grid_color = (128, 128, 128)
game_width = 10 # Change this to increase size
game_height = 10 # Change this to increase size
numMine = 9 # Number of mines
grid_size = 32 # Size of grid (WARNING: macke sure to change the images dimension... | [
"pygame.init",
"pygame.quit",
"pygame.event.get",
"random.randrange",
"pygame.display.set_mode",
"pygame.time.Clock",
"pygame.font.SysFont",
"pygame.display.set_caption",
"pygame.image.load",
"pygame.display.update",
"pygame.Rect"
] | [((30, 43), 'pygame.init', 'pygame.init', ([], {}), '()\n', (41, 43), False, 'import pygame\n'), ((572, 628), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(display_width, display_height)'], {}), '((display_width, display_height))\n', (595, 628), False, 'import pygame\n'), ((656, 675), 'pygame.time.Clock', '... |
import logging
import os
import warnings
from pathlib import Path
from urllib.parse import urlparse, urlunparse
try:
import s3fs
except ImportError:
s3fs = None
from great_expectations.datasource.batch_kwargs_generator.batch_kwargs_generator import (
BatchKwargsGenerator,
)
from great_expectations.datasou... | [
"logging.getLogger",
"urllib.parse.urlparse",
"pathlib.Path",
"s3fs.S3FileSystem",
"os.path.join",
"great_expectations.datasource.types.S3BatchKwargs",
"warnings.warn",
"great_expectations.exceptions.BatchKwargsError"
] | [((437, 464), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (454, 464), False, 'import logging\n'), ((2649, 2707), 's3fs.S3FileSystem', 's3fs.S3FileSystem', ([], {'anon': '(False)', 'client_kwargs': 'client_kwargs'}), '(anon=False, client_kwargs=client_kwargs)\n', (2666, 2707), False, 'i... |
# coding=utf-8
#
# Copyright 2016 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"f5.bigip.resource.UnsupportedOperation"
] | [((1515, 1602), 'f5.bigip.resource.UnsupportedOperation', 'UnsupportedOperation', (['"""DB resources doesn\'t support create, only load and refresh"""'], {}), '(\n "DB resources doesn\'t support create, only load and refresh")\n', (1535, 1602), False, 'from f5.bigip.resource import UnsupportedOperation\n'), ((1771, ... |