repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
hhhameem/CV-Recommender | cv_recommender/account/urls.py | b85d53934f0d888835ab8201be388d7d69f0693d | from django.urls import path
from django.contrib.auth import views as auth_views
from . import views
urlpatterns = [
path('register/', views.register, name='register'),
path('login/', views.userlogin, name='login'),
path('logout/', views.userlogout, name='logout'),
path('password_change/', auth_views.P... | [((122, 172), 'django.urls.path', 'path', (['"""register/"""', 'views.register'], {'name': '"""register"""'}), "('register/', views.register, name='register')\n", (126, 172), False, 'from django.urls import path\n'), ((178, 223), 'django.urls.path', 'path', (['"""login/"""', 'views.userlogin'], {'name': '"""login"""'})... |
nii-gakunin-cloud/ocs-templates | Moodle/scripts/edit_conf.py | a2a39bb8824d489488af3c3972007317bb1ef6a2 | from datetime import datetime
from difflib import unified_diff
from logging import basicConfig, getLogger, INFO
import os
from pathlib import Path
import shutil
import subprocess
import sys
import yaml
from urllib.parse import urlparse
from notebook import notebookapp
from IPython.core.display import HTML
WORKDIR = ... | [((487, 506), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (496, 506), False, 'from logging import basicConfig, getLogger, INFO\n'), ((507, 552), 'logging.basicConfig', 'basicConfig', ([], {'level': 'INFO', 'format': '"""%(message)s"""'}), "(level=INFO, format='%(message)s')\n", (518, 552), Fal... |
newvicklee/nlp_algorithms | other/minimum_edit_distance.py | d2812398d96d345dcb50970bae6ebbf666ea5380 | """
Minimum edit distance computes the cost it takes to get from one string to another string.
This implementation uses the Levenshtein distance with a cost of 1 for insertions or deletions and a cost of 2 for substitutions.
Resource: https://en.wikipedia.org/wiki/Edit_distance
For example, getting from "intention" ... | [] |
iqbal-lab-org/varifier | varifier/dnadiff.py | 718a787fd8490ea33a79b5095884e66e12106399 | from operator import attrgetter
import logging
import os
import shutil
import subprocess
import pyfastaq
import pymummer
from cluster_vcf_records import vcf_record
from varifier import utils
# We only want the .snps file from the dnadiff script from MUMmer. From reading
# the docs inspecting that script, we need to ... | [((768, 831), 'subprocess.check_output', 'subprocess.check_output', (['f"""rm -f {delta} {delta_1}"""'], {'shell': '(True)'}), "(f'rm -f {delta} {delta_1}', shell=True)\n", (791, 831), False, 'import subprocess\n'), ((1299, 1315), 'os.unlink', 'os.unlink', (['delta'], {}), '(delta)\n', (1308, 1315), False, 'import os\n... |
sbj-ss/github-watcher | modules/models.py | 7d7c4d2a0a6a014b93a2168dc6e508b2b867a414 | from dataclasses import asdict, dataclass
from typing import Any, Dict, List, Type
@dataclass(frozen=True)
class StatsBaseModel:
"""Base model for various reports"""
@classmethod
def key(cls: Type) -> str:
name = cls.__name__
return name[0].lower() + name[1:]
def to_table(self) -> Lis... | [((86, 108), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (95, 108), False, 'from dataclasses import asdict, dataclass\n'), ((435, 457), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (444, 457), False, 'from dataclasses import asdict, datacl... |
iCHEF/queryfilter | queryfilter/datetimefilter.py | 0ae4faf525e162d2720d328b96fa179d68277f1e | from __future__ import absolute_import
import datetime
from dateutil import parser
import pytz
from .base import FieldFilter, DictFilterMixin, DjangoQueryFilterMixin
from .queryfilter import QueryFilter
WHOLE_DAY = datetime.timedelta(days=1)
ONE_SECOND = datetime.timedelta(seconds=1)
@QueryFilter.register_type_c... | [((220, 246), 'datetime.timedelta', 'datetime.timedelta', ([], {'days': '(1)'}), '(days=1)\n', (238, 246), False, 'import datetime\n'), ((260, 289), 'datetime.timedelta', 'datetime.timedelta', ([], {'seconds': '(1)'}), '(seconds=1)\n', (278, 289), False, 'import datetime\n'), ((2032, 2078), 'datetime.datetime.min.repla... |
Huawei-Ascend/modelzoo | built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/search_space/networks/pytorch/operator/rpn.py | df51ed9c1d6dbde1deef63f2a037a369f8554406 | # -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... | [((1062, 1104), 'vega.search_space.networks.network_factory.NetworkFactory.register', 'NetworkFactory.register', (['NetTypes.Operator'], {}), '(NetTypes.Operator)\n', (1085, 1104), False, 'from vega.search_space.networks.network_factory import NetworkFactory\n'), ((1397, 1439), 'vega.search_space.networks.network_facto... |
joybhallaa/scrapy | scrapy/http/request/__init__.py | e4750f2fbdacbeb7a20ae7c6b13bba3fb0f7ad54 | """
This module implements the Request class which is used to represent HTTP
requests in Scrapy.
See documentation in docs/topics/request-response.rst
"""
from w3lib.url import safe_url_string
from scrapy.http.headers import Headers
from scrapy.utils.python import to_bytes
from scrapy.utils.trackref import object_ref... | [((1442, 1483), 'scrapy.http.headers.Headers', 'Headers', (['(headers or {})'], {'encoding': 'encoding'}), '(headers or {}, encoding=encoding)\n', (1449, 1483), False, 'from scrapy.http.headers import Headers\n'), ((2183, 2218), 'w3lib.url.safe_url_string', 'safe_url_string', (['url', 'self.encoding'], {}), '(url, self... |
akaeme/BlackJackBot | game.py | 04970107202a24059f8da933233fba7df9f3a0ef | #encoding: utf8
__author__ = 'Diogo Gomes'
__email__ = 'dgomes@ua.pt'
__license__ = "GPL"
__version__ = "0.1"
import copy
import card
from shoe import Shoe
from dealer import Dealer
from player import Player
BET_MULTIPLIER = 2
class Game(object):
class Rules():
def __init__(self, shoe_size=4, min_bet=1, ... | [((2094, 2109), 'shoe.Shoe', 'Shoe', (['shoe_size'], {}), '(shoe_size)\n', (2098, 2109), False, 'from shoe import Shoe\n'), ((3813, 3847), 'card.blackjack', 'card.blackjack', (['self.state[0].hand'], {}), '(self.state[0].hand)\n', (3827, 3847), False, 'import card\n'), ((948, 967), 'copy.deepcopy', 'copy.deepcopy', (['... |
camipozas/python-exercises | loops/for/for3.py | c8c02d2b9ff77f21592c99038e10434aba08dbc7 | # Escribir un programa que muestre la sumatoria de todos los múltiplos de 7 encontrados entre el 0 y el 100.
# Summing all the multiples of 7 from 0 to 100.
total = 0
for i in range(101):
if i % 7 == 0:
total = total+i
print("Sumatoria de los múltiplos de 7:", total)
| [] |
Saftwerk/TWCManager | lib/TWCManager/Status/HASSStatus.py | 9b17c063ada80fc159db82fe6e3ad8c4ca071a1a | # HomeAssistant Status Output
# Publishes the provided sensor key and value pair to a HomeAssistant instance
import logging
import time
from ww import f
logger = logging.getLogger(__name__.rsplit(".")[-1])
class HASSStatus:
import threading
import requests
apiKey = None
config = None
configCo... | [((599, 615), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (613, 615), False, 'import threading\n'), ((2385, 2418), 'time.sleep', 'time.sleep', (['self.msgRateInSeconds'], {}), '(self.msgRateInSeconds)\n', (2395, 2418), False, 'import time\n'), ((6495, 6506), 'time.time', 'time.time', ([], {}), '()\n', (6504, ... |
taycurran/TwitOff | Archive/routes/home_routes.py | 6e2ee13f83fa86c80988a91b3b41ed0958688c3c |
from flask import Blueprint, jsonify, request, render_template
home_routes = Blueprint("home_routes", __name__)
@home_routes.route("/")
def index():
users = User.query.all()
return render_template('base.html', title='Home',
users=users)
@home_routes.route("/about")
def a... | [((79, 113), 'flask.Blueprint', 'Blueprint', (['"""home_routes"""', '__name__'], {}), "('home_routes', __name__)\n", (88, 113), False, 'from flask import Blueprint, jsonify, request, render_template\n'), ((197, 252), 'flask.render_template', 'render_template', (['"""base.html"""'], {'title': '"""Home"""', 'users': 'use... |
rgeorgi/intent | intent/scripts/classification/ctn_to_classifier.py | 9920798c126f6d354029f7bb0a345e7cdb649f3a | from argparse import ArgumentParser
from collections import defaultdict
import glob
import os
import pickle
from random import shuffle, seed
import sys
from tempfile import mkdtemp
import shutil
import logging
root_logger = logging.getLogger()
root_logger.setLevel(logging.DEBUG)
CTN_LOG = logging.getLogger('CTN_CLASS... | [((225, 244), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (242, 244), False, 'import logging\n'), ((292, 322), 'logging.getLogger', 'logging.getLogger', (['"""CTN_CLASS"""'], {}), "('CTN_CLASS')\n", (309, 322), False, 'import logging\n'), ((355, 376), 'logging.basicConfig', 'logging.basicConfig', ([], {... |
Havana3351/Low-cost-remote-monitor | watchdog/back-end/v0.3.0/watchdog/app/resource/video.py | 9f86a62b8515c0f9fddda31f25548680f0ad8e2f | from flask_restful import Resource
from flask import Response
import os
import cv2
picturecounter = 1 # 防止过多记录的标识
class Video(Resource):
#如果方法为get 调用该方法
def get(self):
global picturecounter
# username = (request.get_json())['username']
# db = pymysql.connect("rm-2ze61i7u6d7a3fwp9yo... | [((834, 847), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (841, 847), False, 'import os\n'), ((1098, 1117), 'cv2.imread', 'cv2.imread', (['picpath'], {}), '(picpath)\n', (1108, 1117), False, 'import cv2\n'), ((1280, 1315), 'flask.Response', 'Response', (['bs'], {'mimetype': '"""image/jpeg"""'}), "(bs, mimetype='i... |
valgur/LEOGPS | codes/ambfix.py | f289f279ef55980a0e3fd82b3b3686e41c474a2e | #!/usr/bin/env python3
'''
###############################################################################
###############################################################################
## ##
## _ ___ ___ ___ ___ ___ ... | [((20371, 20383), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (20379, 20383), True, 'import numpy as np\n'), ((21776, 21800), 'numpy.matmul', 'np.matmul', (['iZt', 'zfixedff'], {}), '(iZt, zfixedff)\n', (21785, 21800), True, 'import numpy as np\n'), ((7722, 7740), 'numpy.array', 'np.array', (['fltarray'], {}), '... |
bmcilw1/text-summary | summarizer/test_summarizer.py | f594fd4f41279a6e11262ac859cfbdad6aaf1703 | from summarizer.summarizer import summarize
def test_summarize_whenPassedEmptyString_ReturnsEmpty():
assert summarize("") == "" | [((114, 127), 'summarizer.summarizer.summarize', 'summarize', (['""""""'], {}), "('')\n", (123, 127), False, 'from summarizer.summarizer import summarize\n')] |
KarthikGandrala/DataEncryption | XORCipher/XOREncrypt.py | 6ed4dffead345bc9f7010ac2ea9afbff958c85af | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Function to encrypt message using key is defined
def encrypt(msg, key):
# Defining empty strings and counters
hexadecimal = ''
iteration = 0
# Running for loop in the range of MSG and comparing the BITS
for i in range(len(msg)):
... | [] |
francisrod01/udacity_python_foundations | 02-Use-functions/21-Opening_a_file/secret_message.py | 2a384cf35ce7eff547c88097cdc45cc4e8fc6041 | #!/usr/bin/python3
import os
import random
def rename_files(path):
file_list = os.listdir(path)
print(file_list)
for file_name in file_list:
# Remove numbers from filename.
# new_file_name file_name.translation(None, "0123456789")
# Add random numbers to beginning of filename.
... | [((86, 102), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (96, 102), False, 'import os\n'), ((465, 494), 'os.path.join', 'os.path.join', (['path', 'file_name'], {}), '(path, file_name)\n', (477, 494), False, 'import os\n'), ((496, 529), 'os.path.join', 'os.path.join', (['path', 'new_file_name'], {}), '(path,... |
timgates42/xarray | xarray/core/variable.py | bf0fe2caca1d2ebc4f1298f019758baa12f68b94 | import copy
import functools
import itertools
import numbers
import warnings
from collections import defaultdict
from datetime import timedelta
from distutils.version import LooseVersion
from typing import (
Any,
Dict,
Hashable,
Mapping,
Optional,
Sequence,
Tuple,
TypeVar,
Union,
)
... | [((1294, 1335), 'typing.TypeVar', 'TypeVar', (['"""VariableType"""'], {'bound': '"""Variable"""'}), "('VariableType', bound='Variable')\n", (1301, 1335), False, 'from typing import Any, Dict, Hashable, Mapping, Optional, Sequence, Tuple, TypeVar, Union\n'), ((7749, 7765), 'numpy.asarray', 'np.asarray', (['data'], {}), ... |
zubtsov/competitive-programming | codeforces.com/1186A/solution.py | 919d63130144347d7f6eddcf8f5bc2afb85fddf3 | number_of_participants, number_of_pens, number_of_notebooks = map(int, input().split())
if number_of_pens >= number_of_participants and number_of_notebooks >= number_of_participants:
print('Yes')
else:
print('No')
| [] |
StanczakDominik/DLA | DLA/__main__.py | bf63592a5ac96ffef639e7a0c80d7d52ff776322 | from DLA import main_single
d = main_single(1, gotosize=[1e4, 5e4])
d.plot_particles()
d.plot_mass_distribution()
| [((32, 75), 'DLA.main_single', 'main_single', (['(1)'], {'gotosize': '[10000.0, 50000.0]'}), '(1, gotosize=[10000.0, 50000.0])\n', (43, 75), False, 'from DLA import main_single\n')] |
bulutistan/Py3AMF | pyamf/tests/test_util.py | 3de53095b52fe2bf82b69ba5ad0b894b53045f7e | # -*- coding: utf-8 -*-
#
# Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
Tests for AMF utilities.
@since: 0.1.0
"""
import unittest
from datetime import datetime
from io import BytesIO
import pyamf
from pyamf import util
from pyamf.tests.util import replace_dict
PosInf = 1e300000
NegInf = -... | [((1062, 1102), 'datetime.datetime', 'datetime', (['(2009)', '(3)', '(8)', '(23)', '(30)', '(47)', '(770122)'], {}), '(2009, 3, 8, 23, 30, 47, 770122)\n', (1070, 1102), False, 'from datetime import datetime\n'), ((1116, 1138), 'pyamf.util.get_timestamp', 'util.get_timestamp', (['dt'], {}), '(dt)\n', (1134, 1138), False... |
keocol/e-valuator | e-valuator.py | c2bab22e3debf08263fef57ee4135312a2bb2b0d | import dns.resolver
import sys
import colorama
import platform
from colorama import init, Fore, Back, Style
import re
# pip install -r requirements.txt (colorama)
os = platform.platform()
if os.find('Windows')!= (-1):
init(convert=True)
print("""
███████╗░░░░░░██╗░░░██╗░█████╗░██╗░░░░░██╗░░░██... | [((179, 198), 'platform.platform', 'platform.platform', ([], {}), '()\n', (196, 198), False, 'import platform\n'), ((2558, 2599), 're.search', 're.search', (['"""[\\\\;\\\\s]p\\\\=none\\\\;"""', 'answer2'], {}), "('[\\\\;\\\\s]p\\\\=none\\\\;', answer2)\n", (2567, 2599), False, 'import re\n'), ((2612, 2655), 're.search... |
qh73xe/HowAboutNatume | api/server.py | 8d994a1e16e2153dc200097d8f8b43713d76a3d5 | # -*- coding: utf-8 -*
"""トルネードを使用した ask.api を作成します."""
from json import dumps
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.options import parse_command_line
from tornado.web import Application, RequestHandler
from tornado.options import define, options
from tokenizer impor... | [((373, 396), 'logger.getLogger', 'getLogger', (['"""API_MODULE"""'], {}), "('API_MODULE')\n", (382, 396), False, 'from logger import getLogger\n'), ((397, 465), 'tornado.options.define', 'define', (['"""port"""'], {'default': '(8000)', 'help': '"""run on the given port"""', 'type': 'int'}), "('port', default=8000, hel... |
GDGSNF/proxy.py | proxy/http/chunk_parser.py | 3ee2824217286df3c108beadf3185eee35c28b49 | # -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE... | [((526, 637), 'typing.NamedTuple', 'NamedTuple', (['"""ChunkParserStates"""', "[('WAITING_FOR_SIZE', int), ('WAITING_FOR_DATA', int), ('COMPLETE', int)]"], {}), "('ChunkParserStates', [('WAITING_FOR_SIZE', int), (\n 'WAITING_FOR_DATA', int), ('COMPLETE', int)])\n", (536, 637), False, 'from typing import NamedTuple, ... |
10088/nova | nova/pci/stats.py | 972c06c608f0b00e9066d7f581fd81197065cf49 | # Copyright (c) 2013 Intel, Inc.
# Copyright (c) 2013 OpenStack Foundation
# 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/li... | [((1061, 1088), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1078, 1088), True, 'from oslo_log import log as logging\n'), ((30746, 30783), 'nova.objects.pci_device_pool.from_pci_stats', 'pci_device_pool.from_pci_stats', (['stats'], {}), '(stats)\n', (30776, 30783), False, 'from no... |
Codingprivacy/Multiple-Rename | Use.py | 486289e8158487dad058cd8f781ac27bc9a5fc02 | import multiple
multiple.rename("C:/Users/Username/Desktop",'new_name',33,'.exe')
"""this above lines renames all the files of the folder Desktop to 'new_name' and
count starts from 33 to further (we can also provide 1 to start it from 1) and
extension is given '.exe'
hence the files will be renamed like :
1. new_n... | [((17, 85), 'multiple.rename', 'multiple.rename', (['"""C:/Users/Username/Desktop"""', '"""new_name"""', '(33)', '""".exe"""'], {}), "('C:/Users/Username/Desktop', 'new_name', 33, '.exe')\n", (32, 85), False, 'import multiple\n')] |
ohel/pyorbital-gizmod-tweaks | ReadSymLink.py | 4c02783d1c6287df508351467a5c203a11430b07 | import os
def readlinkabs(l):
"""
Return an absolute path for the destination
of a symlink
"""
if not (os.path.islink(l)):
return None
p = os.readlink(l)
if os.path.isabs(p):
return p
return os.path.join(os.path.dirname(l), p)
| [((173, 187), 'os.readlink', 'os.readlink', (['l'], {}), '(l)\n', (184, 187), False, 'import os\n'), ((195, 211), 'os.path.isabs', 'os.path.isabs', (['p'], {}), '(p)\n', (208, 211), False, 'import os\n'), ((125, 142), 'os.path.islink', 'os.path.islink', (['l'], {}), '(l)\n', (139, 142), False, 'import os\n'), ((254, 27... |
IanTBlack/picamera2 | examples/capture_circular.py | 4d31a56cdb0d8360e71927e754fc6bef50bec360 | #!/usr/bin/python3
import time
import numpy as np
from picamera2.encoders import H264Encoder
from picamera2.outputs import CircularOutput
from picamera2 import Picamera2
lsize = (320, 240)
picam2 = Picamera2()
video_config = picam2.video_configuration(main={"size": (1280, 720), "format": "RGB888"},
... | [((201, 212), 'picamera2.Picamera2', 'Picamera2', ([], {}), '()\n', (210, 212), False, 'from picamera2 import Picamera2\n'), ((452, 485), 'picamera2.encoders.H264Encoder', 'H264Encoder', (['(1000000)'], {'repeat': '(True)'}), '(1000000, repeat=True)\n', (463, 485), False, 'from picamera2.encoders import H264Encoder\n')... |
barendt/biopython | Bio/NeuralNetwork/Gene/Pattern.py | 391bcdbee7f821bff3e12b75c635a06bc1b2dcea | """Generic functionality useful for all gene representations.
This module contains classes which can be used for all the different
types of patterns available for representing gene information (ie. motifs,
signatures and schemas). These are the general classes which should be
handle any of the different specific patte... | [((5776, 5809), 'random.choice', 'random.choice', (['self._pattern_list'], {}), '(self._pattern_list)\n', (5789, 5809), False, 'import random\n'), ((3497, 3530), 'Bio.Seq.Seq', 'Seq', (['pattern_item', 'self._alphabet'], {}), '(pattern_item, self._alphabet)\n', (3500, 3530), False, 'from Bio.Seq import Seq, MutableSeq\... |
WHOIGit/nes-lter-ims | neslter/parsing/nut/__init__.py | d4cc96c10da56ca33286af84d669625b67170522 | from .nut import parse_nut, format_nut, merge_nut_bottles
| [] |
jpieper/legtool | legtool/tabs/servo_tab.py | ab3946051bd16817b61d3073ce7be8bd27af90d0 | # Copyright 2014 Josh Pieper, jjp@pobox.com.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | [] |
twisted/epsilon | epsilon/juice.py | 783910e1829688e95719a7d3151ec3e2cbb101fd | # -*- test-case-name: epsilon.test.test_juice -*-
# Copyright 2005 Divmod, Inc. See LICENSE file for details
import warnings, pprint
import keyword
import io
import six
from twisted.internet.main import CONNECTION_LOST
from twisted.internet.defer import Deferred, maybeDeferred, fail
from twisted.internet.protocol im... | [((18926, 18957), 'six.add_metaclass', 'six.add_metaclass', (['_CommandMeta'], {}), '(_CommandMeta)\n', (18943, 18957), False, 'import six\n'), ((8656, 8679), 'keyword.iskeyword', 'keyword.iskeyword', (['lkey'], {}), '(lkey)\n', (8673, 8679), False, 'import keyword\n'), ((9859, 9866), 'epsilon.compat.long', 'long', (['... |
kirillpol-ms/bonsai3-py | bonsai3/simulator_client.py | ede9c2c1d25d784d61b7cbf1438a257b5d592274 | """
Client for simulator requests
"""
__copyright__ = "Copyright 2020, Microsoft Corp."
# pyright: strict
from random import uniform
import time
from typing import Union
import jsons
import requests
from .exceptions import RetryTimeoutError, ServiceError
from .logger import Logger
from .simulator_protocol import (
... | [((737, 755), 'requests.session', 'requests.session', ([], {}), '()\n', (753, 755), False, 'import requests\n'), ((5796, 5818), 'jsons.loads', 'jsons.loads', (['json_text'], {}), '(json_text)\n', (5807, 5818), False, 'import jsons\n'), ((7087, 7108), 'random.uniform', 'uniform', (['(0)', 'max_sleep'], {}), '(0, max_sle... |
gwxie/Synthesize-Distorted-Image-and-Its-Control-Points | perturbed_images_generation_multiProcess.py | ed6de3e05a7ee1f3aecf65fcbb87c11d2ede41e7 | '''
GuoWang xie
set up :2020-1-9
intergrate img and label into one file
-- fiducial1024_v1
'''
import argparse
import sys, os
import pickle
import random
import collections
import json
import numpy as np
import scipy.io as io
import scipy.misc as m
import matplotlib.pyplot as plt
import glob
import math
import time
... | [((600, 615), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (610, 615), False, 'import sys, os\n'), ((44024, 44137), 'threading.Thread', 'threading.Thread', ([], {'target': 'saveFold.save_img', 'args': "(m, n, 'fold', repeat_time, 'relativeShift_v2')", 'name': '"""fold"""'}), "(target=saveFold.save_img, args=(m... |
tw-ddis/Gnip-Tweet-Evaluation | tweet_evaluator.py | c5c847698bd6deb891870e5cf2514dfe78caa1c2 | #!/usr/bin/env python
import argparse
import logging
try:
import ujson as json
except ImportError:
import json
import sys
import datetime
import os
import importlib
from gnip_tweet_evaluation import analysis,output
"""
Perform audience and/or conversation analysis on a set of Tweets.
"""
logger = logging.g... | [((311, 340), 'logging.getLogger', 'logging.getLogger', (['"""analysis"""'], {}), "('analysis')\n", (328, 340), False, 'import logging\n'), ((390, 413), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (411, 413), False, 'import logging\n'), ((461, 486), 'argparse.ArgumentParser', 'argparse.ArgumentP... |
admiral-aokiji/whatsapp-bot | app.py | 5a0b0d4afddc679cda3670771934cb472629587a | from flask import Flask, request
import os
from twilio.twiml.messaging_response import MessagingResponse
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.binary_location = os.environ.get("GOOGLE_CHROME_BIN")
chrome_options.add_argument("--headless")
chrome_options.add_argument("-... | [((153, 178), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (176, 178), False, 'from selenium import webdriver\n'), ((212, 247), 'os.environ.get', 'os.environ.get', (['"""GOOGLE_CHROME_BIN"""'], {}), "('GOOGLE_CHROME_BIN')\n", (226, 247), False, 'import os\n'), ((505, 520), 'flask.Fla... |
hchaozhe/nflfastpy | nflfastpy/errors.py | 11e4894d7fee4ff8baac2c08b000a39308b41143 | """
Custom exceptions for nflfastpy module
"""
class SeasonNotFoundError(Exception):
pass | [] |
zeevikal/CS231n-spring2018 | assignment1/cs231n/classifiers/neural_net.py | 50691a947b877047099e7a1fe99a3fdea4a4fcf8 | from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
class TwoLayerNet(object):
"""
A two-layer fully-connected neural network. The net has an input dimension
of N, a hidden layer dimension of H, and performs classification over C
classes.
We train the network... | [((1558, 1579), 'numpy.zeros', 'np.zeros', (['hidden_size'], {}), '(hidden_size)\n', (1566, 1579), True, 'import numpy as np\n'), ((1684, 1705), 'numpy.zeros', 'np.zeros', (['output_size'], {}), '(output_size)\n', (1692, 1705), True, 'import numpy as np\n'), ((3464, 3486), 'numpy.maximum', 'np.maximum', (['(0)', 'score... |
koralarts/django-dynamic-settings | dynamic_setting/tests/test_models.py | 8a3c5f44ad71f6d8fb78af9e7a3f5a380dd3d318 | from django.test import TestCase
from dynamic_setting.models import Setting
class SettingTestCase(TestCase):
def _create_setting(self, name, **kwargs):
return Setting.objects.create(name=name, **kwargs)
def test_create_setting(self):
""" Test Creating a new Setting. """
name = 'T... | [((178, 221), 'dynamic_setting.models.Setting.objects.create', 'Setting.objects.create', ([], {'name': 'name'}), '(name=name, **kwargs)\n', (200, 221), False, 'from dynamic_setting.models import Setting\n'), ((2228, 2262), 'dynamic_setting.models.Setting.objects.get', 'Setting.objects.get', ([], {'pk': 'setting.pk'}), ... |
MrDelik/core | homeassistant/components/zamg/weather.py | 93a66cc357b226389967668441000498a10453bb | """Sensor for data from Austrian Zentralanstalt für Meteorologie."""
from __future__ import annotations
import logging
import voluptuous as vol
from homeassistant.components.weather import (
ATTR_WEATHER_HUMIDITY,
ATTR_WEATHER_PRESSURE,
ATTR_WEATHER_TEMPERATURE,
ATTR_WEATHER_WIND_BEARING,
ATTR_WE... | [((897, 924), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (914, 924), False, 'import logging\n'), ((982, 1005), 'voluptuous.Optional', 'vol.Optional', (['CONF_NAME'], {}), '(CONF_NAME)\n', (994, 1005), True, 'import voluptuous as vol\n'), ((1026, 1055), 'voluptuous.Optional', 'vol.Opti... |
martasls/rasa | rasa/model.py | 6e535a847f6be0c05e7b89208f16a53d2c478629 | import copy
import glob
import hashlib
import logging
import os
import shutil
from subprocess import CalledProcessError, DEVNULL, check_output # skipcq:BAN-B404
import tempfile
import typing
from pathlib import Path
from typing import Any, Text, Tuple, Union, Optional, List, Dict, NamedTuple
from packaging import ver... | [((937, 964), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (954, 964), False, 'import logging\n'), ((4264, 4289), 'os.path.isdir', 'os.path.isdir', (['model_path'], {}), '(model_path)\n', (4277, 4289), False, 'import os\n'), ((6295, 6331), 'rasa.utils.common.TempDirectoryPath', 'TempDir... |
CatalaniCD/quantitative_finance | algorithmic_trading/backester_framework_test.py | c752516a43cd80914dcc8411aadd7b15a258d6a4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 16 11:20:01 2021
@author: q
GOAL : develop a backtester from a .py framework / library
# installation :
pip install backtesting
# Documentation
Index :
- Manuals
- Tutorials
- Example Strategies
- FAQ
... | [((1079, 1123), 'backtesting.set_bokeh_output', 'backtesting.set_bokeh_output', ([], {'notebook': '(False)'}), '(notebook=False)\n', (1107, 1123), False, 'import backtesting\n'), ((2231, 2318), 'backtesting.Backtest', 'Backtest', (['GOOG', 'PriceAboveSMA'], {'commission': '(0.002)', 'exclusive_orders': '(True)', 'cash'... |
PauloAlexSilva/Python | Sec_10_expr_lambdas_fun_integradas/f_generators.py | 690913cdcfd8bde52d9ddd15e3c838e6aef27730 | """"
Generator Expression
Em aulas anteriores foi abordado:
- List Comprehension;
- Dictionary Comprehension;
- Set Comprehension.
Não foi abordado:
- Tuple Comprehension ... porque elas se chamam Generators
nomes = ['Carlos', 'Camila', 'Carla', 'Cristiana', 'Cristina', 'Vanessa']
print(any8[nomes[0... | [] |
valdirsjr/learning.data | python/ordenacao.py | a4b72dfd27f55f2f04120644b73232bf343f71e3 | numero1 = int(input("Digite o primeiro número: "))
numero2 = int(input("Digite o segundo número: "))
numero3 = int(input("Digite o terceiro número: "))
if (numero1 < numero2 and numero2 < numero3):
print("crescente")
else:
print("não está em ordem crescente") | [] |
kooi/ippt-od | _sources/5-extra/opg-parameters-sneeuwvlok_solution.py | f1ba44ccfb72e6fcdfdc392fbfbec3e37c47b354 | import turtle
tina = turtle.Turtle()
tina.shape("turtle")
tina.speed(10)
def parallellogram(lengte):
for i in range(2):
tina.forward(lengte)
tina.right(60)
tina.forward(lengte)
tina.right(120)
def sneeuwvlok(lengte, num):
for i in range(num):
parallellogram(lengte)
... | [((21, 36), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (34, 36), False, 'import turtle\n')] |
servalproject/nikola | nikola/plugins/task_render_listings.py | 4d78504d93597894f3da4a434dfafdec907601a7 | # Copyright (c) 2012 Roberto Alsina y otros.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights to use, copy, modify, merge, pub... | [((3399, 3429), 'os.walk', 'os.walk', (["kw['listings_folder']"], {}), "(kw['listings_folder'])\n", (3406, 3429), False, 'import os\n'), ((3510, 3567), 'os.path.join', 'os.path.join', (["kw['output_folder']", 'root', "kw['index_file']"], {}), "(kw['output_folder'], root, kw['index_file'])\n", (3522, 3567), False, 'impo... |
jsyony37/csld | csld/phonon/head.py | b0e6d5845d807174f24ca7b591bc164c608c99c8 | # to include all module here in order to cite
from numpy import *
from numpy.linalg import *
import string
import os
import scipy
import scipy.sparse
#import rwposcar
#import anaxdat
import math
#define touch file
def touch(file):#input string
if os.path.isfile(file):
os.system(str("rm"+" "+file))
... | [((252, 272), 'os.path.isfile', 'os.path.isfile', (['file'], {}), '(file)\n', (266, 272), False, 'import os\n'), ((428, 446), 'os.path.isdir', 'os.path.isdir', (['dir'], {}), '(dir)\n', (441, 446), False, 'import os\n'), ((644, 664), 'os.path.isfile', 'os.path.isfile', (['file'], {}), '(file)\n', (658, 664), False, 'im... |
sebtelko/pulumi-azure-native | sdk/python/pulumi_azure_native/storage/storage_account_static_website.py | 711ec021b5c73da05611c56c8a35adb0ce3244e4 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
__a... | [((1858, 1891), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""accountName"""'}), "(name='accountName')\n", (1871, 1891), False, 'import pulumi\n'), ((2238, 2277), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""resourceGroupName"""'}), "(name='resourceGroupName')\n", (2251, 2277), False, 'import pulumi\n'), (... |
onehitcombo/aws-doc-sdk-examples | python/example_code/s3/s3-python-example-get-bucket-policy.py | 03e2e0c5dee75c5decbbb99e849c51417521fd82 | # Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# This f... | [((587, 605), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (599, 605), False, 'import boto3\n')] |
AIngleLab/aae | lang/py/aingle/test/gen_interop_data.py | 6e95f89fad60e62bb5305afe97c72f3278d8e04b | #!/usr/bin/env python3
##
# 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
... | [((1716, 1745), 'os.path.splitext', 'os.path.splitext', (['output_path'], {}), '(output_path)\n', (1732, 1745), False, 'import os\n')] |
Rekrau/PyGreentea | data_io/util/value_blob_erosion.py | 457d7dc5be12b15c3c7663ceaf6d74301de56e43 | import numpy as np
from scipy import ndimage
def erode_value_blobs(array, steps=1, values_to_ignore=tuple(), new_value=0):
unique_values = list(np.unique(array))
all_entries_to_keep = np.zeros(shape=array.shape, dtype=np.bool)
for unique_value in unique_values:
entries_of_this_value = array == uni... | [((194, 236), 'numpy.zeros', 'np.zeros', ([], {'shape': 'array.shape', 'dtype': 'np.bool'}), '(shape=array.shape, dtype=np.bool)\n', (202, 236), True, 'import numpy as np\n'), ((150, 166), 'numpy.unique', 'np.unique', (['array'], {}), '(array)\n', (159, 166), True, 'import numpy as np\n'), ((766, 801), 'numpy.logical_n... |
EnjoyLifeFund/macHighSierra-py36-pkgs | astropy/units/tests/test_logarithmic.py | 5668b5785296b314ea1321057420bcd077dba9ea | # coding: utf-8
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Test the Logarithmic Units and Quantities
"""
from __future__ import (absolute_import, unicode_literals, division,
print_function)
from ...extern import six
from ...extern.six.moves import zip
import pickle... | [((1241, 1285), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""lu_unit"""', 'lu_units'], {}), "('lu_unit', lu_units)\n", (1264, 1285), False, 'import pytest\n'), ((6355, 6399), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""lu_unit"""', 'lu_units'], {}), "('lu_unit', lu_units)\n", (6378, 6399)... |
kti-sam/django-connectwise | djconnectwise/tests/mocks.py | 28484faad9435892a46b8ce4a3c957f64c299971 | import os
from mock import patch
from datetime import datetime, date, time
import json
import responses
from . import fixtures
from django.utils import timezone
CW_MEMBER_IMAGE_FILENAME = 'AnonymousMember.png'
def create_mock_call(method_name, return_value, side_effect=None):
"""Utility function for mocking th... | [((367, 410), 'mock.patch', 'patch', (['method_name'], {'side_effect': 'side_effect'}), '(method_name, side_effect=side_effect)\n', (372, 410), False, 'from mock import patch\n'), ((2688, 2705), 'datetime.date', 'date', (['(1948)', '(5)', '(14)'], {}), '(1948, 5, 14)\n', (2692, 2705), False, 'from datetime import datet... |
vineeths96/Visual-Odometry | visual_odometry/visual_odometry.py | 88d96a23a0bde9c05de1f4dddcca8b6c4bd817e7 | from .monovideoodometry import MonoVideoOdometry
from .parameters import *
def visual_odometry(
image_path="./input/sequences/10/image_0/",
pose_path="./input/poses/10.txt",
fivepoint=False,
):
"""
Plots the estimated odometry path using either five point estimation or eight point estimation
:... | [] |
Amirosimani/amazon-sagemaker-script-mode | tf-2-data-parallelism/src/utils.py | ea8d7d6b1b0613dffa793c9ae247cfd8868034ec | import os
import numpy as np
import tensorflow as tf
def get_train_data(train_dir, batch_size):
train_images = np.load(os.path.join(train_dir, 'train_images.npy'))
train_labels = np.load(os.path.join(train_dir, 'train_labels.npy'))
print('train_images', train_images.shape, 'train_labels', train_labels.sha... | [((345, 409), 'tensorflow.data.Dataset.from_tensor_slices', 'tf.data.Dataset.from_tensor_slices', (['(train_images, train_labels)'], {}), '((train_images, train_labels))\n', (379, 409), True, 'import tensorflow as tf\n'), ((799, 861), 'tensorflow.data.Dataset.from_tensor_slices', 'tf.data.Dataset.from_tensor_slices', (... |
CaptainCandy/influence-release | scripts/run_rbf_comparison_car_air_top5.py | a152486a1c130fb5f907259c6692b9fe0d2ef6d0 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 19 16:26:35 2019
@author: Administrator
"""
# Forked from run_rbf_comparison.py
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import math
import copy
import numpy as... | [((571, 622), 'sys.path.append', 'sys.path.append', (['"""C:/Tang/influence-release-master"""'], {}), "('C:/Tang/influence-release-master')\n", (586, 622), False, 'import sys\n'), ((1737, 1846), 'load_vehicles.load_vehicles', 'load_vehicles', ([], {'num_train_ex_per_class': 'num_train_ex_per_class', 'num_test_ex_per_cl... |
Keesiu/meta-kaggle | data/external/repositories_2to3/145085/kaggle_Microsoft_Malware-master/kaggle_Microsoft_malware_small/find_4g.py | 87de739aba2399fd31072ee81b391f9b7a63f540 | import sys
import pickle
##########################################################
# usage
# pypy find_4g.py xid_train.p ../../data/train
# xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify
# the order of samples in traing data
# ../../data/train is the path of original train data
####... | [] |
Antonio-Gabriel/easepay_backend | src/domain/enums/__init__.py | 9aaf4de27c9cc906911ae46ee61c75c6d92dc826 | from .months import Months
from .sizes import Size | [] |
blu-base/pygments | pygments/lexers/trafficscript.py | da799d14818ed538bf937684a19ce779ddde9446 | """
pygments.lexers.trafficscript
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lexer for RiverBed's TrafficScript (RTS) language.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer
from pygments.token import String... | [] |
dimithras/pandas | pandas/tests/indexes/test_common.py | d321be6e2a43270625abf671d9e59f16529c4b48 | """
Collection of tests asserting things that should be true for
any index subclass. Makes use of the `indices` fixture defined
in pandas/tests/indexes/conftest.py.
"""
import re
import numpy as np
import pytest
from pandas._libs.tslibs import iNaT
from pandas.core.dtypes.common import is_period_dtype, needs_i8_conv... | [((18137, 18193), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""na_position"""', "[None, 'middle']"], {}), "('na_position', [None, 'middle'])\n", (18160, 18193), False, 'import pytest\n'), ((19004, 19061), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""na_position"""', "['first', 'last']"], {... |
leasanchez/BiorbdOptim | tests/test_dynamics.py | 28fac818af031668ecd82bc1929f78303c5d58d2 | import pytest
import numpy as np
from casadi import MX, SX
import biorbd_casadi as biorbd
from bioptim.dynamics.configure_problem import ConfigureProblem
from bioptim.dynamics.dynamics_functions import DynamicsFunctions
from bioptim.interfaces.biorbd_interface import BiorbdInterface
from bioptim.misc.enums import Cont... | [((724, 763), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""cx"""', '[MX, SX]'], {}), "('cx', [MX, SX])\n", (747, 763), False, 'import pytest\n'), ((765, 826), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""with_external_force"""', '[False, True]'], {}), "('with_external_force', [False, True]... |
elyase/polyaxon | polyaxon/event_manager/event_manager.py | 1c19f059a010a6889e2b7ea340715b2bcfa382a0 | from hestia.manager_interface import ManagerInterface
from event_manager import event_actions
class EventManager(ManagerInterface):
def _get_state_data(self, event): # pylint:disable=arguments-differ
return event.event_type, event
def subscribe(self, event): # pylint:disable=arguments-differ
... | [] |
KotoLLC/peacenik-tests | test_f_login_andy.py | 760f7799ab2b9312fe0cce373890195151c48fce | from helpers import *
def test_f_login_andy():
url = "http://central.orbits.local/rpc.AuthService/Login"
raw_payload = {"name": "andy","password": "12345"}
payload = json.dumps(raw_payload)
headers = {'Content-Type': 'application/json'}
# convert dict to json by json.dumps() for body dat... | [] |
ian-r-rose/visualization | docker/src/clawpack-5.3.1/riemann/src/shallow_1D_py.py | ed6d9fab95eb125e7340ab3fad3ed114ed3214af | #!/usr/bin/env python
# encoding: utf-8
r"""
Riemann solvers for the shallow water equations.
The available solvers are:
* Roe - Use Roe averages to caluclate the solution to the Riemann problem
* HLL - Use a HLL solver
* Exact - Use a newton iteration to calculate the exact solution to the
Riemann pro... | [((2045, 2083), 'numpy.empty', 'np.empty', (['(num_eqn, num_waves, num_rp)'], {}), '((num_eqn, num_waves, num_rp))\n', (2053, 2083), True, 'import numpy as np\n'), ((2094, 2123), 'numpy.zeros', 'np.zeros', (['(num_waves, num_rp)'], {}), '((num_waves, num_rp))\n', (2102, 2123), True, 'import numpy as np\n'), ((2137, 216... |
juanfra684/Nuitka | nuitka/Constants.py | 0e276895fadabefb598232f2ccf8cc7736c9a85b | # Copyright 2020, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | [((1962, 1983), 'math.copysign', 'math.copysign', (['(1.0)', 'a'], {}), '(1.0, a)\n', (1975, 1983), False, 'import math\n'), ((1987, 2008), 'math.copysign', 'math.copysign', (['(1.0)', 'b'], {}), '(1.0, b)\n', (2000, 2008), False, 'import math\n'), ((2047, 2060), 'math.isnan', 'math.isnan', (['a'], {}), '(a)\n', (2057,... |
chriscoombs/aws-comparing-algorithms-performance-mlops-cdk | functions/predictionLambda/botocore/endpoint.py | 6d3888f3ecd667ee76dc473edba37a608786ed2e | # Copyright (c) 2012-2013 Mitch Garnaat http://garnaat.org/
# Copyright 2012-2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http... | [((1129, 1156), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1146, 1156), False, 'import logging\n'), ((1176, 1205), 'botocore.history.get_global_history_recorder', 'get_global_history_recorder', ([], {}), '()\n', (1203, 1205), False, 'from botocore.history import get_global_history_re... |
RayshineRen/Introduction_to_Data_Science_in_Python | week2/Assignment2Answer.py | b19aa781a8f8d0e25853c4e86dadd4c9bebbcd71 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 21:56:15 2020
@author: Ray
@email: 1324789704@qq.com
@wechat: RayTing0305
"""
'''
Question 1
Write a function called proportion_of_education which returns the proportion of children in the dataset who had a mother with the education levels equal to less tha... | [((758, 794), 'pandas.read_csv', 'pd.read_csv', (['"""./assets/NISPUF17.csv"""'], {}), "('./assets/NISPUF17.csv')\n", (769, 794), True, 'import pandas as pd\n'), ((7478, 7594), 'pandas.DataFrame', 'pd.DataFrame', (["{'had_chickenpox_column': have_cpox.HAD_CPOX,\n 'num_chickenpox_vaccine_column': have_cpox.P_NUMVRC}"... |
accordinglyto/dferte | backup/26.py | d4b8449c1633973dc538c9e72aca5d37802a4ee4 | from numpy import genfromtxt
import matplotlib.pyplot as plt
import mpl_finance
import numpy as np
import uuid
import matplotlib
# Input your csv file here with historical data
ad = genfromtxt(f"../financial_data/SM.csv", delimiter=",", dtype=str)
def convolve_sma(array, period):
return np.convolve(array, np.on... | [((184, 249), 'numpy.genfromtxt', 'genfromtxt', (['f"""../financial_data/SM.csv"""'], {'delimiter': '""","""', 'dtype': 'str'}), "(f'../financial_data/SM.csv', delimiter=',', dtype=str)\n", (194, 249), False, 'from numpy import genfromtxt\n'), ((1909, 1980), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'num': '(1)',... |
JanSurft/tornado | streams/readers/arff_reader.py | 2c07686c5358d2bcb15d6edac3126ad9346c3c76 | """
The Tornado Framework
By Ali Pesaranghader
University of Ottawa, Ontario, Canada
E-mail: apesaran -at- uottawa -dot- ca / alipsgh -at- gmail -dot- com
"""
import re
from data_structures.attribute import Attribute
from dictionary.tornado_dictionary import TornadoDic
class ARFFReader:
"""This cl... | [((981, 992), 'data_structures.attribute.Attribute', 'Attribute', ([], {}), '()\n', (990, 992), False, 'from data_structures.attribute import Attribute\n'), ((2119, 2143), 're.sub', 're.sub', (['"""\\\\s+"""', '""""""', 'line'], {}), "('\\\\s+', '', line)\n", (2125, 2143), False, 'import re\n')] |
MichaelSchwabe/conv-ebnas-abgabe | Experimente/Experiment ID 8/run-cifar10-v7.py | f463d7bbd9b514597e19d25007913f7994cbbf7c | from __future__ import print_function
from keras.datasets import mnist
from keras.datasets import cifar10
from keras.utils.np_utils import to_categorical
import numpy as np
from keras import backend as K
from evolution import Evolution
from genome_handler import GenomeHandler
import tensorflow as tf
#import mlflow.kera... | [((494, 534), 'keras.backend.set_image_data_format', 'K.set_image_data_format', (['"""channels_last"""'], {}), "('channels_last')\n", (517, 534), True, 'from keras import backend as K\n'), ((633, 652), 'keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (650, 652), False, 'from keras.datasets imp... |
JaredFG/Multiagentes-Unity | CarModel.py | 37f7ec5c0588865ef08b50df83566a43d817bebf | '''
Autores:Eduardo Rodríguez López A01749381
Rebeca Rojas Pérez A01751192
Jared Abraham Flores Guarneros A01379868
Eduardo Aguilar Chías A01749375
'''
from random import random
f... | [((5808, 5839), 'mesa.space.MultiGrid', 'MultiGrid', (['width', 'height', '(False)'], {}), '(width, height, False)\n', (5817, 5839), False, 'from mesa.space import MultiGrid\n'), ((5864, 5886), 'mesa.time.RandomActivation', 'RandomActivation', (['self'], {}), '(self)\n', (5880, 5886), False, 'from mesa.time import Rand... |
nulinspiratie/Qcodes | qcodes/widgets/display.py | d050d38ac83f532523a39549c3247dfa6096a36e | """Helper for adding content stored in a file to a jupyter notebook."""
import os
from pkg_resources import resource_string
from IPython.display import display, Javascript, HTML
# Originally I implemented this using regular open() and read(), so it
# could use relative paths from the importing file.
#
# But for distr... | [((1176, 1214), 'pkg_resources.resource_string', 'resource_string', (['"""qcodes"""', 'qcodes_path'], {}), "('qcodes', qcodes_path)\n", (1191, 1214), False, 'from pkg_resources import resource_string\n'), ((1497, 1517), 'IPython.display.Javascript', 'Javascript', (['contents'], {}), '(contents)\n', (1507, 1517), False,... |
smr99/lego-hub-tk | hubcontrol.py | d3b86847873fa80deebf993ccd44b4d3d8f9bf40 | #! /usr/bin/python3
import base64
from data.ProgramHubLogger import ProgramHubLogger
from datetime import datetime
import logging
import os
import sys
from ui.MotionSensor import MotionSensorWidget
from ui.PositionStatus import PositionStatusWidget
from ui.DevicePortWidget import DevicePortWidget
from ui.ConnectionWid... | [((770, 794), 'logging.getLogger', 'logging.getLogger', (['"""App"""'], {}), "('App')\n", (787, 794), False, 'import logging\n'), ((862, 889), 'utils.setup.setup_logging', 'setup_logging', (['log_filename'], {}), '(log_filename)\n', (875, 889), False, 'from utils.setup import setup_logging\n'), ((6458, 6469), 'comm.Hub... |
shagun-agrawal/To-Do-App | To-D0-App-main/base/views.py | 083081690fe9d291f13c0452a695a092b7544ab2 | from django.shortcuts import render
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.urls import reverse_lazy
from django.contrib.auth.views import LoginView
from .models impor... | [((823, 844), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""tasks"""'], {}), "('tasks')\n", (835, 844), False, 'from django.urls import reverse_lazy\n'), ((939, 960), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""tasks"""'], {}), "('tasks')\n", (951, 960), False, 'from django.urls import reverse_lazy\n'), ((106... |
samysweb/dnnv | tests/unit_tests/test_nn/test_converters/test_tensorflow/test_Dropout.py | 58fb95b7300914d9da28eed86c39eca473b1aaef | import numpy as np
from dnnv.nn.converters.tensorflow import *
from dnnv.nn.operations import *
TOL = 1e-6
def test_Dropout_consts():
x = np.array([3, 4]).astype(np.float32)
op = Dropout(x)
tf_op = TensorflowConverter().visit(op)
result_ = tf_op()
assert isinstance(result_, tuple)
assert le... | [((442, 467), 'numpy.all', 'np.all', (['(result >= y - TOL)'], {}), '(result >= y - TOL)\n', (448, 467), True, 'import numpy as np\n'), ((481, 506), 'numpy.all', 'np.all', (['(result <= y + TOL)'], {}), '(result <= y + TOL)\n', (487, 506), True, 'import numpy as np\n'), ((899, 924), 'numpy.all', 'np.all', (['(result >=... |
idsc-frazzoli/SMARTS | smarts/zoo/worker.py | bae0a6ea160330921edc94a7161a4e8cf72a1974 | # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to us... | [((2917, 2956), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (2936, 2956), False, 'import logging\n'), ((3631, 3672), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'stop_server'], {}), '(signal.SIGINT, stop_server)\n', (3644, 3672), False, 'import signa... |
Nburkhal/mit-cs250 | week2/problems/problem2.py | a3d32a217deb2cfa1b94d8188bef73c0742b1245 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Now write a program that calculates the minimum fixed monthly payment needed
in order pay off a credit card balance within 12 months.
By a fixed monthly payment, we mean a single number which does not change each month,
but instead is a constant amount that will be ... | [] |
yennanliu/CS_basics | leetcode_python/Sort/sort-characters-by-frequency.py | 3c50c819897a572ff38179bfb0083a19b2325fde | # V0
import collections
class Solution(object):
def frequencySort(self, s):
count = collections.Counter(s)
count_dict = dict(count)
count_tuple_sorted = sorted(count_dict.items(), key=lambda kv : -kv[1])
res = ''
for item in count_tuple_sorted:
res += item[0] * it... | [((96, 118), 'collections.Counter', 'collections.Counter', (['s'], {}), '(s)\n', (115, 118), False, 'import collections\n'), ((2076, 2104), 'collections.defaultdict', 'collections.defaultdict', (['int'], {}), '(int)\n', (2099, 2104), False, 'import collections\n'), ((771, 793), 'collections.Counter', 'collections.Count... |
chateval/chatevalv2 | eval/scripts/human/html_gen.py | 7ba96d81842db00427a6d6351d5cea76a8766450 | """Stores all the helper functions that generate html"""
import random
def generate_2choice_html(example):
'''Makes html for ranking form for the specified row index.
Returns the HTML for a table of radio buttons used for ranking,
as well as a count of the total number of radio buttons.
'''
# Check f... | [((535, 565), 'random.shuffle', 'random.shuffle', (['target_indices'], {}), '(target_indices)\n', (549, 565), False, 'import random\n'), ((2496, 2526), 'random.shuffle', 'random.shuffle', (['target_indices'], {}), '(target_indices)\n', (2510, 2526), False, 'import random\n')] |
sdpython/python_project_template | python3_module_template/subproject/myexample.py | e365b29ba9a7dfd2688f68eb7ff2b84a6a82cb57 | # -*- coding: utf-8 -*-
"""
@file
@brief This the documentation of this module (myexampleb).
"""
class myclass:
"""
This is the documentation for this class.
**example with a sphinx directives**
It works everywhere in the documentation.
.. exref::
:title: an example of use
Ju... | [] |
eperrier/QDataSet | simulation/dataset_G_1q_X_Z_N1.py | 383b38b9b4166848f72fac0153800525e66b477b | ##############################################
"""
This module generate a dataset
"""
##############################################
# preample
import numpy as np
from utilites import Pauli_operators, simulate, CheckNoise
################################################
# meta parameters
name = "G_1q... | [((2428, 2454), 'utilites.CheckNoise', 'CheckNoise', (['sim_parameters'], {}), '(sim_parameters)\n', (2438, 2454), False, 'from utilites import Pauli_operators, simulate, CheckNoise\n'), ((2456, 2480), 'utilites.simulate', 'simulate', (['sim_parameters'], {}), '(sim_parameters)\n', (2464, 2480), False, 'from utilites i... |
zhiqwang/mmdeploy | configs/mmdet/detection/detection_tensorrt_static-300x300.py | 997d111a6f4ca9624ab3b36717748e6ce002037d | _base_ = ['../_base_/base_tensorrt_static-300x300.py']
| [] |
Ziang-Lu/Flask-Blog | user_service/user_service/api.py | 8daf901a0ea0e079ad24a61fd7f16f1298514d4c | # -*- coding: utf-8 -*-
"""
API definition module.
"""
from flask import Blueprint
from flask_restful import Api
from .resources.user import UserAuth, UserItem, UserList, UserFollow
# Create an API-related blueprint
api_bp = Blueprint(name='api', import_name=__name__)
api = Api(api_bp)
api.add_resource(UserList, '... | [((229, 272), 'flask.Blueprint', 'Blueprint', ([], {'name': '"""api"""', 'import_name': '__name__'}), "(name='api', import_name=__name__)\n", (238, 272), False, 'from flask import Blueprint\n'), ((280, 291), 'flask_restful.Api', 'Api', (['api_bp'], {}), '(api_bp)\n', (283, 291), False, 'from flask_restful import Api\n'... |
ariannasg/python3-essential-training | advanced/itertools_funcs.py | 9b52645f5ccb57d2bda5d5f4a3053681a026450a | #!usr/bin/env python3
import itertools
# itertools is a module that's not technically a set of built-in functions but
# it is part of the standard library that comes with python.
# it's useful for for creating and using iterators.
def main():
print('some infinite iterators')
# cycle iterator can be used to cy... | [((404, 425), 'itertools.cycle', 'itertools.cycle', (['seq1'], {}), '(seq1)\n', (419, 425), False, 'import itertools\n'), ((603, 626), 'itertools.count', 'itertools.count', (['(100)', '(3)'], {}), '(100, 3)\n', (618, 626), False, 'import itertools\n'), ((1091, 1122), 'itertools.chain', 'itertools.chain', (['"""ABCD"""'... |
Azenha/AlgProg2 | aula 05/model/Pessoa.py | 062b5caac24435717074a18a7499f80130489a46 | class Pessoa:
def __init__(self, codigo, nome, endereco, telefone):
self.__codigo = int(codigo)
self.nome = str(nome)
self._endereco = str(endereco)
self.__telefone = str(telefone)
def imprimeNome(self):
print(f"Você pode chamar essa pessoa de {self.nome}.")
def __i... | [] |
lukefx/stardust | examples/plain_text_response.py | 4d9e399ffba9d4a47a2f428b59b5abf4c5bd41ad | from starlette.responses import PlainTextResponse
async def serve(req):
return PlainTextResponse("Hello World!")
| [((85, 118), 'starlette.responses.PlainTextResponse', 'PlainTextResponse', (['"""Hello World!"""'], {}), "('Hello World!')\n", (102, 118), False, 'from starlette.responses import PlainTextResponse\n')] |
t3eHawk/pypyrus_logbook | pypyrus_logbook/logger.py | bd647a1c355b07e8df28c0d7298fcfe68cd9572e | import atexit
import datetime as dt
import os
import platform
import pypyrus_logbook as logbook
import sys
import time
import traceback
from .conf import all_loggers
from .formatter import Formatter
from .header import Header
from .output import Root
from .record import Record
from .sysinfo import Sysinfo
class Logg... | [((7866, 7883), 'datetime.datetime.now', 'dt.datetime.now', ([], {}), '()\n', (7881, 7883), True, 'import datetime as dt\n'), ((9089, 9116), 'atexit.register', 'atexit.register', (['self._exit'], {}), '(self._exit)\n', (9104, 9116), False, 'import atexit\n'), ((19925, 19939), 'sys.exc_info', 'sys.exc_info', ([], {}), '... |
revnav/sandbox | darling_ansible/python_venv/lib/python3.7/site-packages/oci/object_storage/transfer/constants.py | f9c8422233d093b76821686b6c249417502cf61d | # coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [] |
ZendaInnocent/news-api | scraper/news/spiders/millardayo.py | 71465aea50e0b1cea08a421d72156cbe7ed8a952 | # Spider for MillardAyo.com
import scrapy
from bs4 import BeautifulSoup
class MillardAyoSpider(scrapy.Spider):
name = 'millardayo'
allowed_urls = ['www.millardayo.com']
start_urls = [
'https://millardayo.com',
]
def parse(self, response, **kwargs):
# extracting data - link, imag... | [((353, 389), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.body', '"""lxml"""'], {}), "(response.body, 'lxml')\n", (366, 389), False, 'from bs4 import BeautifulSoup\n')] |
stephenoken/beam | sdks/python/apache_beam/runners/portability/expansion_service_test.py | 4797f310b6671de6fd703502520f4b012b655c82 | #
# 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 us... | [((1714, 1741), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1731, 1741), False, 'import logging\n'), ((2170, 2241), 'apache_beam.transforms.ptransform.PTransform.register_urn', 'ptransform.PTransform.register_urn', (['"""beam:transforms:xlang:count"""', 'None'], {}), "('beam:transform... |
RunnerPro/RunnerProApi | db.py | 2e0aba17cba2a019b6d102bc4eac2fd60f164156 | from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker
from settings import DB_URI
Session = sessionmaker(autocommit=False, autoflush=False, bind=create_engine(DB_URI))
session = scoped_session(Session)
| [((244, 267), 'sqlalchemy.orm.scoped_session', 'scoped_session', (['Session'], {}), '(Session)\n', (258, 267), False, 'from sqlalchemy.orm import scoped_session\n'), ((211, 232), 'sqlalchemy.create_engine', 'create_engine', (['DB_URI'], {}), '(DB_URI)\n', (224, 232), False, 'from sqlalchemy import create_engine\n')] |
ntanhbk44/tvm | python/tvm/contrib/nvcc.py | f89a929f09f7a0b0ccd0f4d46dc2b1c562839087 | # 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... | [((3102, 3173), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.STDOUT'}), '(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n', (3118, 3173), False, 'import subprocess\n'), ((3772, 3843), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'stdout': 'subproce... |
dhruvshah1996/Project3 | calc/history/calculations.py | d87ad37f6cf2de0d3402c71d21b25258946aad69 | """Calculation history Class"""
from calc.calculations.addition import Addition
from calc.calculations.subtraction import Subtraction
from calc.calculations.multiplication import Multiplication
from calc.calculations.division import Division
class Calculations:
"""Calculations class manages the history of calculati... | [((1632, 1655), 'calc.calculations.addition.Addition.create', 'Addition.create', (['values'], {}), '(values)\n', (1647, 1655), False, 'from calc.calculations.addition import Addition\n'), ((1912, 1938), 'calc.calculations.subtraction.Subtraction.create', 'Subtraction.create', (['values'], {}), '(values)\n', (1930, 1938... |
matheusguerreiro/python | Python/17 - 081 - extraindo dados de uma lista.py | f39a1b92409f11cbe7fef5d9261f863f9e0fac0d | # Aula 17 (Listas (Parte 1))
valores = []
while True:
valor = int(input('Digite um Valor ou -1 para Finalizar: '))
if valor < 0:
print('\nFinalizando...')
break
else:
valores.append(valor)
print(f'Foram digitados {len(valores)} números')
valores.sort(reverse=True)
print(f'Lista ord... | [] |
maryam-afzp/django-yekpay | yekpay/migrations/0014_auto_20181120_1453.py | f7b9d7914035ea4f27238eba9e0c70227cc65046 | # Generated by Django 2.0.9 on 2018-11-20 11:23
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('yekpay', '0013_auto_2018... | [((227, 284), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (258, 284), False, 'from django.db import migrations, models\n'), ((367, 474), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name... |
nishaq503/polus-plugins-dl | polus-cell-nuclei-segmentation/src/dsb2018_topcoders/albu/src/pytorch_zoo/inplace_abn/modules/__init__.py | 511689e82eb29a84761538144277d1be1af7aa44 | from .bn import ABN, InPlaceABN, InPlaceABNWrapper, InPlaceABNSync, InPlaceABNSyncWrapper
from .misc import GlobalAvgPool2d
from .residual import IdentityResidualBlock
from .dense import DenseModule
| [] |
kylebrandt/arrow | python/pyarrow/tests/test_compute.py | 515197dfe6e83d6fa6fe82bfec134f41b222b748 | # 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... | [((1853, 1913), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""arrow_type"""', 'numerical_arrow_types'], {}), "('arrow_type', numerical_arrow_types)\n", (1876, 1913), False, 'import pytest\n'), ((2200, 2260), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""arrow_type"""', 'numerical_arrow_types... |
ashwinath/merlin | python/sdk/client/api/log_api.py | 087a7fa6fb21e4c771d64418bd58873175226ca1 | # coding: utf-8
"""
Merlin
API Guide for accessing Merlin's model management, deployment, and serving functionalities # noqa: E501
OpenAPI spec version: 0.7.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
... | [((3490, 3521), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (3503, 3521), False, 'import six\n'), ((722, 733), 'client.api_client.ApiClient', 'ApiClient', ([], {}), '()\n', (731, 733), False, 'from client.api_client import ApiClient\n')] |
bollwyvl/OpenMDAO | openmdao/solvers/nonlinear/nonlinear_block_jac.py | 4d7a31b2bb39674e2be0d6a13cbe22de3f5353af | """Define the NonlinearBlockJac class."""
from openmdao.recorders.recording_iteration_stack import Recording
from openmdao.solvers.solver import NonlinearSolver
from openmdao.utils.mpi import multi_proc_fail_check
class NonlinearBlockJac(NonlinearSolver):
"""
Nonlinear block Jacobi solver.
"""
SOLVER... | [((580, 619), 'openmdao.recorders.recording_iteration_stack.Recording', 'Recording', (['"""NonlinearBlockJac"""', '(0)', 'self'], {}), "('NonlinearBlockJac', 0, self)\n", (589, 619), False, 'from openmdao.recorders.recording_iteration_stack import Recording\n'), ((2041, 2075), 'openmdao.utils.mpi.multi_proc_fail_check'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.