repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
jmarine/ezeeai | ezeeai/utils/hooks.py | 091b4ce3bc5794c534084bff3301b15ba8a9be1a | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.training import session_run_hook
from tensorflow.python.training.basic_session_run_hooks import NeverTriggerTimer, SecondOrStepTimer
from tensorflow.python.training.session_run_hook impor... | [((448, 482), 'tensorflow.python.util.tf_export.tf_export', 'tf_export', (['"""train.EmailAtStepHook"""'], {}), "('train.EmailAtStepHook')\n", (457, 482), False, 'from tensorflow.python.util.tf_export import tf_export\n'), ((2249, 2273), 'smtplib.SMTP', 'smtplib.SMTP', (['smtpserver'], {}), '(smtpserver)\n', (2261, 227... |
whiletrace/dwellinglybackend | tests/factory_fixtures/dummy_resource.py | e766b3d612b4c92fd337b82498ab8ef68bd95e1f | from flask import request
from flask_restful import Resource
from utils.gatekeeper import allowed_params
class DummyResource(Resource):
dummy_params = set()
@allowed_params(dummy_params)
def put(self):
return request.json
| [((169, 197), 'utils.gatekeeper.allowed_params', 'allowed_params', (['dummy_params'], {}), '(dummy_params)\n', (183, 197), False, 'from utils.gatekeeper import allowed_params\n')] |
JiniousChoi/encyclopedia-in-code | quizzes/00.organize.me/hackerrank/sorted_set/server2.py | 77bc551a03a2a3e3808e50016ece14adb5cfbd96 | #!/usr/bin/env python3
import socket, threading
from queue import Queue
import sys, struct
# NOTE: Use this path to create the UDS Server socket
SERVER_SOCKET_PATH = "./socket";
class Result:
def __init__(self):
self._evt = threading.Event()
self._result = None
def set_result(self, value... | [((3692, 3721), 'socket.socket', 'socket.socket', (['socket.AF_UNIX'], {}), '(socket.AF_UNIX)\n', (3705, 3721), False, 'import socket, threading\n'), ((239, 256), 'threading.Event', 'threading.Event', ([], {}), '()\n', (254, 256), False, 'import socket, threading\n'), ((564, 571), 'queue.Queue', 'Queue', ([], {}), '()\... |
funrunskypalace/vnpy | vnpy/gateway/rohon/__init__.py | 2d87aede685fa46278d8d3392432cc127b797926 | from .rohon_gateway import RohonGateway
| [] |
dndtools2/dndtools2 | dnd/mobile/urls.py | 6bd794349b84f3018dd0bd12712535924557c166 | from django.conf.urls import patterns, url, include
from .views import force_desktop_version, return_to_mobile_version
app_name = 'mobile'
urlpatterns = [
# force desktop
url(r'^force-desktop-version/$', force_desktop_version, name='force_desktop_version'),
# return to mobile version
url(r'^return-to... | [((181, 270), 'django.conf.urls.url', 'url', (['"""^force-desktop-version/$"""', 'force_desktop_version'], {'name': '"""force_desktop_version"""'}), "('^force-desktop-version/$', force_desktop_version, name=\n 'force_desktop_version')\n", (184, 270), False, 'from django.conf.urls import patterns, url, include\n'), (... |
esteng/guiding-multi-step | ros_aruco.py | 3f0db0ba70b5851cc83878f4ed48cf82342a2ddf | """
Calibrate with the ROS package aruco_detect
"""
import rospy
import roslib
from geometry_msgs.msg import Transform
class ROSArUcoCalibrate:
def __init__(self, aruco_tag_len=0.0795):
print("Please roslaunch roslaunch aruco_detect aruco_detect.launch before you run!")
self.aruco_tf_topic = "/f... | [((374, 434), 'rospy.Subscriber', 'rospy.Subscriber', (['self.aruco_tf_topic', 'Transform', 'self._tfCb'], {}), '(self.aruco_tf_topic, Transform, self._tfCb)\n', (390, 434), False, 'import rospy\n'), ((533, 572), 'rospy.logwarn', 'rospy.logwarn', (['"""_tfCb: tf_msg is None!"""'], {}), "('_tfCb: tf_msg is None!')\n", (... |
mmalandra-kb4/service-metrics-gatherer | utils/utils.py | f9a795a43d491ef59a32121ab4ed5c2c62cb968b | """
* Copyright 2019 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,... | [((688, 730), 'logging.getLogger', 'logging.getLogger', (['"""metricsGatherer.utils"""'], {}), "('metricsGatherer.utils')\n", (705, 730), False, 'import logging\n'), ((788, 801), 'urllib.parse.urlparse', 'urlparse', (['url'], {}), '(url)\n', (796, 801), False, 'from urllib.parse import urlparse\n'), ((819, 861), 're.su... |
nassermarafi/SRCSWArchetypes | OSAnalysisHelper.py | 105a5e40ef0ba1951108dc52b382ae0c5457057a | from __future__ import absolute_import
__author__ = 'marafi'
def SolutionAlgorithim(OData, Dt, Tol, Steps):
#Insert within the While loop, make sure parameter "ok" is defined
import OpenSeesAPI
OData.AddObject(OpenSeesAPI.TCL.TCLScript('if {$ok != 0} {'))
OData.AddObject(OpenSeesAPI.TCL.TCLScript('put... | [((224, 268), 'OpenSeesAPI.TCL.TCLScript', 'OpenSeesAPI.TCL.TCLScript', (['"""if {$ok != 0} {"""'], {}), "('if {$ok != 0} {')\n", (249, 268), False, 'import OpenSeesAPI\n'), ((290, 379), 'OpenSeesAPI.TCL.TCLScript', 'OpenSeesAPI.TCL.TCLScript', (['(\'puts "Trying Lower Dt: %f and Tol: %f ... "\' % (Dt, Tol))'], {}), '(... |
socialpoint-labs/unity-yaml-parser | unityparser/commands.py | 91c175140ed32aed301bc34d4311f370da69a8ba | import re
from argparse import ArgumentParser
from multiprocessing import Pool, Manager, Process
from pathlib import Path
from .utils import UnityDocument
YAML_HEADER = '%YAML'
class UnityProjectTester:
"""
Class to run tests on a given Unity project folder
"""
AVAILABLE_COMMANDS = ('test_no_yaml_is... | [((427, 443), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (441, 443), False, 'from argparse import ArgumentParser\n'), ((2309, 2340), 'pathlib.Path', 'Path', (['self.options.project_path'], {}), '(self.options.project_path)\n', (2313, 2340), False, 'from pathlib import Path\n'), ((3058, 3067), 'multi... |
kaizhengny/LeetCode | DP/Leetcode 221. Maximal Square.py | 67d64536ab80f4966699fe7460d165f2a98d6a82 | class Solution:
def maximalSquare(self, matrix: List[List[str]]) -> int:
if not matrix: return 0
m, n = len(matrix), len(matrix[0])
dp = [[0]*n for _ in range(m)]
res = 0
for i in range(m):
dp[i][0] = int(matrix[i][0])
for j in range(n):
dp[0][... | [] |
Polyconseil/dokang | dokang/harvesters/__init__.py | b0ab3e4aabfb97adb2a2e877a42fc1896e5fcf08 | # -*- coding: utf-8 -*-
# Copyright (c) Polyconseil SAS. All rights reserved.
import hashlib
import json
import logging
import os
import re
from .html import html_config, HtmlHarvester # pylint: disable=unused-import
from .sphinx import ( # pylint: disable=unused-import
sphinx_config, sphinx_rtd_config,
Sph... | [((374, 401), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (391, 401), False, 'import logging\n'), ((656, 669), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (667, 669), False, 'import hashlib\n'), ((2091, 2108), 'os.walk', 'os.walk', (['base_dir'], {}), '(base_dir)\n', (2098, 2108), ... |
semccomas/string-method-gmxapi | __init__.py | fb68dce792d35df739225b1048e0816a4a61d45e | __all__ = ["stringmethod"]
| [] |
yangtao4389/pinche | carPooling/migrations/0018_auto_20190521_1651.py | 81463761058f67d47cea980f29a061b1e1b2d08a | # Generated by Django 2.0.4 on 2019-05-21 16:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('carPooling', '0017_carpoolingrecunbook'),
]
operations = [
migrations.AlterField(
model_name='carpoolinguserconf',
n... | [((352, 416), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)', 'null': '(True)', 'verbose_name': '"""真实姓名"""'}), "(max_length=128, null=True, verbose_name='真实姓名')\n", (368, 416), False, 'from django.db import migrations, models\n'), ((551, 618), 'django.db.models.CharField', 'models.CharFi... |
Zer0-One/fuckbot | src/fuckbot/ticker.py | 02f5a112988e25a9f04a9a941a55f11cf51c3d8f | import discord
import logging
TRADING_API_URL='https://cloud.iexapis.com/stable/stock/{0}/quote'
TRADING_API_ICON='https://iextrading.com/favicon.ico'
def ticker_embed(symbol):
ticker = discord.Embed(title=f"{symbol}".upper(), type="rich", color=3029236, url=TRADING_API_URL.format(symbol))
ticker.set_author(n... | [] |
johny-c/minos | minos/lib/util/StateSet.py | 660e991f44118382f4a3cb7566670c4159d33fe3 | import bz2
import csv
import collections
import math
from enum import Enum
class Select(Enum):
FIRST = 'first'
RANGE_KEY = 'range_key'
RANGE_VALUE = 'range_value'
class SelectPolicy:
def __init__(self, policy, field=None):
self.policy = policy
self.field = field
class StateSet:
... | [((8663, 8716), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Load state set"""'}), "(description='Load state set')\n", (8686, 8716), False, 'import argparse\n'), ((5410, 5427), 'csv.DictReader', 'csv.DictReader', (['f'], {}), '(f)\n', (5424, 5427), False, 'import csv\n'), ((6173, 6190)... |
pmatigakis/pagetags | pagetags/configuration/development.py | 5e81d01493548edc2677453819c32de3cf75d159 | DEBUG = True
TESTING = False
| [] |
SvenMarcus/hpc-rocket | hpcrocket/pyfilesystem/factory.py | b28917e7afe6e2e839d1ae58f2e21fba6e3eb61c | from hpcrocket.core.filesystem import Filesystem, FilesystemFactory
from hpcrocket.core.launchoptions import Options
from hpcrocket.pyfilesystem.localfilesystem import LocalFilesystem
from hpcrocket.pyfilesystem.sshfilesystem import SSHFilesystem
class PyFilesystemFactory(FilesystemFactory):
def __init__(self, o... | [((447, 467), 'hpcrocket.pyfilesystem.localfilesystem.LocalFilesystem', 'LocalFilesystem', (['"""."""'], {}), "('.')\n", (462, 467), False, 'from hpcrocket.pyfilesystem.localfilesystem import LocalFilesystem\n'), ((627, 664), 'hpcrocket.pyfilesystem.sshfilesystem.SSHFilesystem', 'SSHFilesystem', (['connection', 'proxyj... |
vincewhite/cassandra-dtest | cqlsh_tests/cqlsh_tools.py | a01dce6af73a8656e8740227a811fe63025fb3f4 | import csv
import random
import cassandra
from cassandra.cluster import ResultSet
from typing import List
class DummyColorMap(object):
def __getitem__(self, *args):
return ''
def csv_rows(filename, delimiter=None):
"""
Given a filename, opens a csv file and yields it line by line.
"""
... | [((1287, 1323), 'cassandra.marshal.int64_unpack', 'cassandra.marshal.int64_unpack', (['byts'], {}), '(byts)\n', (1317, 1323), False, 'import cassandra\n'), ((474, 508), 'csv.reader', 'csv.reader', (['csvfile'], {}), '(csvfile, **reader_opts)\n', (484, 508), False, 'import csv\n'), ((1107, 1126), 'csv.writer', 'csv.writ... |
LastRemote/sagemaker-python-sdk | tests/unit/sagemaker/tensorflow/test_estimator_init.py | fddf29d9e4383cd3f939253eef47ee79a464dd37 | # Copyright 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://aws.amazon.com/apache2.0/
#
# or in the "license" file accompan... | [((829, 845), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (843, 845), False, 'import pytest\n'), ((1202, 1256), 'mock.patch', 'patch', (['"""sagemaker.fw_utils.python_deprecation_warning"""'], {}), "('sagemaker.fw_utils.python_deprecation_warning')\n", (1207, 1256), False, 'from mock import Mock, patch\n'), (... |
sofwerx/mycroft-articlekeyword-skill | testing.py | 7cab109db512d3a6465db241b18018e9415f4a9f |
import subprocess
proc = subprocess.Popen(['python3', 'articlekeywords.py', 'aih.txt' , '5'], stdout=subprocess.PIPE )
#print(type(proc.communicate()[0]))
# path = '/opt/mycroft/skills/mycroft-bitcoinprice-skill/'
text = proc.stdout.read()
rows = text.splitlines()
#print(text.splitlines())
count = 0
s = ""
for ... | [((27, 123), 'subprocess.Popen', 'subprocess.Popen', (["['python3', 'articlekeywords.py', 'aih.txt', '5']"], {'stdout': 'subprocess.PIPE'}), "(['python3', 'articlekeywords.py', 'aih.txt', '5'], stdout=\n subprocess.PIPE)\n", (43, 123), False, 'import subprocess\n')] |
mirrorcoloured/slcypi | slcyGeneral.py | c47975b3523f770d12a521c82e2dfca181e3f35b | # Python 2.7.1
import RPi.GPIO as GPIO
from twython import Twython
import time
import sys
import os
import pygame
APP_KEY='zmmlyAJzMDIntLpDYmSH98gbw'
APP_SECRET='ksfSVa2hxvTQKYy4UR9tjpb57CAynMJDsygz9qOyzlH24NVwpW'
OAUTH_TOKEN='794094183841566720-BagrHW91yH8C3Mdh9SOlBfpL6wrSVRW'
OAUTH_TOKEN_SECRET='d0Uucq2dkSHrFHZGLM1... | [((362, 423), 'twython.Twython', 'Twython', (['APP_KEY', 'APP_SECRET', 'OAUTH_TOKEN', 'OAUTH_TOKEN_SECRET'], {}), '(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)\n', (369, 423), False, 'from twython import Twython\n'), ((461, 475), 'RPi.GPIO.cleanup', 'GPIO.cleanup', ([], {}), '()\n', (473, 475), True, 'import ... |
PetervdPerk-NXP/pyarmnn-release | python/pyarmnn/scripts/generate_docs.py | 2008c270f7c7c84a930842c845138628c8b95713 | # Copyright © 2019 Arm Ltd. All rights reserved.
# Copyright 2020 NXP
# SPDX-License-Identifier: MIT
import os
import tarfile
import pyarmnn as ann
import shutil
from typing import List, Union
from pdoc.cli import main
package_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
d... | [((1525, 1575), 'os.path.join', 'os.path.join', (['package_dir', '""".."""', '""".."""', '"""README.md"""'], {}), "(package_dir, '..', '..', 'README.md')\n", (1537, 1575), False, 'import os\n'), ((1747, 1753), 'pdoc.cli.main', 'main', ([], {}), '()\n', (1751, 1753), False, 'from pdoc.cli import main\n'), ((1773, 1806),... |
jeffzhengye/pylearn | tests/gejun_sum.py | a140d0fca8a371faada194cb0126192675cc2045 | __author__ = 'jeffye'
def sum_consecutives(s):
i = 1
li = []
if i < len(s):
n = 1
while s[i] != s[i + 1] and s[i] != s[i - 1]:
sum = s[i]
i = i + 1
return sum
while s[i] == s[i + 1]:
n = n + 1
sum = s[i] * n
i = i + 1
return sum
... | [] |
tscher/PySDDP | PySDDP/term.py | ece69b77c951cbb1f046ac184f6fe4fc025ad690 | class term(object):
# Dados de cadastro das usinas termeletrica (presentes no TERM.DAT)
Codigo = None
Nome = None
Potencia = None
FCMax = None
TEIF = None
IP = None
GTMin = None
# Dados Adicionais Especificados no arquivo de configuracao termica (CONFT)
Sist = None
Status = ... | [] |
b2bs-team/pylint-errors | plerr/__main__.py | f1362c8afbe6b7075f805560d7699f63ad35a10b | """plerr entrypoint"""
from plerr import cli
if __name__ == '__main__':
cli.main()
| [((77, 87), 'plerr.cli.main', 'cli.main', ([], {}), '()\n', (85, 87), False, 'from plerr import cli\n')] |
CamouOkau/messenger_new_years_bot | code/send.py | 38f3c26b6c5b4dae7fe48f8b61680ec903c0deac | import sys
import time
from datetime import datetime
from bot import FbMessengerBot
if __name__ == "__main__":
if len(sys.argv) < 3:
print("No email or password provided")
else:
bot = FbMessengerBot(sys.argv[1], sys.argv[2])
with open("users.txt", "r") as file:
users = dict... | [((210, 250), 'bot.FbMessengerBot', 'FbMessengerBot', (['sys.argv[1]', 'sys.argv[2]'], {}), '(sys.argv[1], sys.argv[2])\n', (224, 250), False, 'from bot import FbMessengerBot\n'), ((531, 545), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (543, 545), False, 'from datetime import datetime\n'), ((566, 599), ... |
ghanshyammann/senlin-tempest-plugin | senlin_tempest_plugin/api/policies/test_policy_update_negative.py | 9f33bbe723eb381f93c2248a6a277efef3d92ec3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [((779, 813), 'tempest.lib.decorators.attr', 'decorators.attr', ([], {'type': "['negative']"}), "(type=['negative'])\n", (794, 813), False, 'from tempest.lib import decorators\n'), ((819, 883), 'tempest.lib.decorators.idempotent_id', 'decorators.idempotent_id', (['"""5df90d82-9889-4c6f-824c-30272bcfa767"""'], {}), "('5... |
hal0x2328/neo3-boa | boa3_test/test_sc/interop_test/contract/DestroyContract.py | 6825a3533384cb01660773050719402a9703065b | from boa3.builtin import public
from boa3.builtin.interop.contract import destroy_contract
@public
def Main():
destroy_contract()
| [((117, 135), 'boa3.builtin.interop.contract.destroy_contract', 'destroy_contract', ([], {}), '()\n', (133, 135), False, 'from boa3.builtin.interop.contract import destroy_contract\n')] |
qinfeng2011/wltp | tests/test_vmax.py | 317ad38fb96599a29d22e40f69b6aeb4d205611d | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 European Commission (JRC);
# Licensed under the EUPL (the 'Licence');
# You may not use this work except in compliance with the Licence.
# You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
import functools as fnt
import logging
impo... | [((564, 604), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (583, 604), False, 'import logging\n'), ((611, 638), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (628, 638), False, 'import logging\n'), ((1202, 1245), 'wltp.engine.... |
giuseppe/quay | util/canonicaljson.py | a1b7e4b51974edfe86f66788621011eef2667e6a | import collections
def canonicalize(json_obj, preserve_sequence_order=True):
"""
This function canonicalizes a Python object that will be serialized as JSON.
Example usage: json.dumps(canonicalize(my_obj))
Args:
json_obj (object): the Python object that will later be serialized as JSON.
Re... | [((636, 671), 'collections.OrderedDict', 'collections.OrderedDict', (['sorted_obj'], {}), '(sorted_obj)\n', (659, 671), False, 'import collections\n')] |
russss/datasette-geo | datasette_plugin_geo/inspect.py | d4cecc020848bbde91e9e17bf352f7c70bc3dccf | from datasette import hookimpl
from datasette.utils import detect_spatialite
from shapely import wkt
def get_spatial_tables(conn):
if not detect_spatialite(conn):
return {}
spatial_tables = {}
c = conn.cursor()
c.execute(
"""SELECT f_table_name, f_geometry_column, srid, spatial_index_... | [((144, 167), 'datasette.utils.detect_spatialite', 'detect_spatialite', (['conn'], {}), '(conn)\n', (161, 167), False, 'from datasette.utils import detect_spatialite\n'), ((1106, 1121), 'shapely.wkt.loads', 'wkt.loads', (['data'], {}), '(data)\n', (1115, 1121), False, 'from shapely import wkt\n')] |
Sinon/microcosm-pubsub | microcosm_pubsub/context.py | c98a188fcd5b3f358c7171dae0c39a33c5774a4e | """
Message context.
"""
from typing import Dict
from microcosm.api import defaults, typed
from microcosm.config.types import boolean
from microcosm_logging.decorators import logger
from microcosm_pubsub.constants import TTL_KEY, URI_KEY
from microcosm_pubsub.message import SQSMessage
@defaults(
enable_ttl=typ... | [((317, 351), 'microcosm.api.typed', 'typed', (['boolean'], {'default_value': '(True)'}), '(boolean, default_value=True)\n', (322, 351), False, 'from microcosm.api import defaults, typed\n'), ((369, 397), 'microcosm.api.typed', 'typed', (['int'], {'default_value': '(32)'}), '(int, default_value=32)\n', (374, 397), Fals... |
murdockcrc/python-tricks | azure_ml/pytorch_classifier/train_parameterized.py | 57f7ad9c00a045c1f9f18f89bed6e73be6c85b69 | import os
import argparse
import torch
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
from model import Net
from azureml.core import Run
run = Run.get_context()
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
'--data_path',
... | [((189, 206), 'azureml.core.Run.get_context', 'Run.get_context', ([], {}), '()\n', (204, 206), False, 'from azureml.core import Run\n'), ((246, 271), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (269, 271), False, 'import argparse\n'), ((1000, 1103), 'torchvision.datasets.CIFAR10', 'torchvisi... |
kazqvaizer/arq-sqlalchemy-boilerplate | src/tests/test_app_db.py | c14596ed358a061e6eb2a380f4bd962242b123f3 | import pytest
from app.db import session_scope
pytestmark = pytest.mark.asyncio
async def test_engine_configured(env):
async with session_scope() as session:
assert str(session.bind.engine.url) == env("SQLALCHEMY_DATABASE_URI")
| [((138, 153), 'app.db.session_scope', 'session_scope', ([], {}), '()\n', (151, 153), False, 'from app.db import session_scope\n')] |
cgarciae/catalyst | catalyst/core/callbacks/formatters.py | 391ff89ab0d9a1961b88719e894f917ac0fb7fc3 | from abc import ABC, abstractmethod
from datetime import datetime
import json
import logging
from catalyst import utils
from catalyst.core import _State
class MetricsFormatter(ABC, logging.Formatter):
"""
Abstract metrics formatter
"""
def __init__(self, message_prefix):
"""
Args:
... | [((2934, 2982), 'json.dumps', 'json.dumps', (['res'], {'indent': '(True)', 'ensure_ascii': '(False)'}), '(res, indent=True, ensure_ascii=False)\n', (2944, 2982), False, 'import json\n'), ((1552, 1588), 'catalyst.utils.format_metric', 'utils.format_metric', (['m_name', 'm_value'], {}), '(m_name, m_value)\n', (1571, 1588... |
Suraj1127/fuzzy-matcher | fuzzy/fuzzy.py | a3a6ecc6954d79ca65e2517f93db44cc432e7a90 | #!/usr/bin/env python3
"""
Description: Python script to append the common columns in one sheet from another sheet using fuzzy matching.
"""
import pip
def import_or_install(package):
try:
__import__(package)
except ImportError:
pip.main(['install', package])
import os
import sys
im... | [((4202, 4227), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4225, 4227), False, 'import argparse\n'), ((6315, 6347), 'os.path.isfile', 'os.path.isfile', (['args.destination'], {}), '(args.destination)\n', (6329, 6347), False, 'import os\n'), ((6779, 6804), 'argparse.ArgumentParser', 'argpar... |
zkbt/exopop | exoatlas/visualizations/panels/BubblePanel.py | 5e8b9d391fe9e2d39c623d7ccd7eca8fd0f0f3f8 | from .Panel import *
__all__ = ['BubblePanel']
default_size = plt.matplotlib.rcParams['lines.markersize']**2
class BubblePanel(Panel):
'''
BubblePanel is a general wrapper for making scatter plots
where planets are represented as bubbles that can have
informative sizes and/or colors.
'''
def... | [] |
pengwu/scapy_env | venv/lib/python2.7/dist-packages/landscape/sysinfo/load.py | 3db9c5dea2e219048a2387649d6d89be342903d9 | import os
from twisted.internet.defer import succeed
class Load(object):
def register(self, sysinfo):
self._sysinfo = sysinfo
def run(self):
self._sysinfo.add_header("System load", str(os.getloadavg()[0]))
return succeed(None)
| [((250, 263), 'twisted.internet.defer.succeed', 'succeed', (['None'], {}), '(None)\n', (257, 263), False, 'from twisted.internet.defer import succeed\n'), ((214, 229), 'os.getloadavg', 'os.getloadavg', ([], {}), '()\n', (227, 229), False, 'import os\n')] |
dougmorato/bag-of-holding | src/boh_api/viewsets.py | 8a7bc45ced8837bdb00da60dcfb496bb0271f161 | from rest_framework import viewsets
from boh import models
from . import serializers
class OrganizationViewSet(viewsets.ModelViewSet):
queryset = models.Organization.objects.all()
serializer_class = serializers.OrganizationSerializer
class ApplicationViewSet(viewsets.ModelViewSet):
queryset = models.A... | [((154, 187), 'boh.models.Organization.objects.all', 'models.Organization.objects.all', ([], {}), '()\n', (185, 187), False, 'from boh import models\n'), ((312, 344), 'boh.models.Application.objects.all', 'models.Application.objects.all', ([], {}), '()\n', (342, 344), False, 'from boh import models\n'), ((460, 484), 'b... |
TatendaNoreen/Python | githubintro-fe2d832af2bad7d6b27d036c205cc9d8414b2183/CommunicationAnimation.py | df9799bbea84af03c1fb3b29fada1e16c04bab80 | import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot
import agentframework
import csv
import matplotlib.animation
#create environment in which agents will operate
environment=[]
#read csv downloaded file
f = open('in.txt', newline='')
reader = csv.reader(f, quoting=csv.QUOTE_NONNUMERIC)
for row in ... | [((18, 41), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (32, 41), False, 'import matplotlib\n'), ((265, 308), 'csv.reader', 'csv.reader', (['f'], {'quoting': 'csv.QUOTE_NONNUMERIC'}), '(f, quoting=csv.QUOTE_NONNUMERIC)\n', (275, 308), False, 'import csv\n'), ((837, 877), 'matplotlib.pyplot... |
opencv/openvino_training_extensions | external/model-preparation-algorithm/tests/conftest.py | f5d809741e192a2345558efc75899a475019cf98 | # Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
try:
import e2e.fixtures
from e2e.conftest_utils import * # noqa
from e2e.conftest_utils import pytest_addoption as _e2e_pytest_addoption # noqa
from e2e import config # noqa
from e2e.utils import get_plugins_... | [((1154, 1185), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (1168, 1185), False, 'import pytest\n'), ((1496, 1527), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (1510, 1527), False, 'import pytest\n'), ((356, 388), 'e2e.uti... |
rtpsw/ibis | ibis/udf/validate.py | d7318fdf87121cd8fadbcf0369a2b217aab3053a | """Validation for UDFs.
Warning: This is an experimental module and API here can change without notice.
DO NOT USE DIRECTLY.
"""
from inspect import Parameter, Signature, signature
from typing import Any, Callable, List
import ibis.common.exceptions as com
from ibis.expr.datatypes import DataType
def _parameter_c... | [((1277, 1292), 'inspect.signature', 'signature', (['func'], {}), '(func)\n', (1286, 1292), False, 'from inspect import Parameter, Signature, signature\n'), ((2323, 2395), 'ibis.common.exceptions.IbisTypeError', 'com.IbisTypeError', (['"""The output type of a UDF must be a single datatype."""'], {}), "('The output type... |
stattikcms/stattik | packages/stattik/stattik/schema/schema.py | 5c96d600d105461edb95a11d8050dee3c32edd1e | import inspect
from ariadne import make_executable_schema, QueryType, MutationType, SubscriptionType
from .resolver import *
#
# Schema
#
class GrammarError(Exception):
pass
keywords = ['query', 'mutation', 'subscription', 'source']
class SchemaMetaDict(dict):
'''
Dictionary that allows decorated sche... | [((4025, 4045), 'inspect.unwrap', 'inspect.unwrap', (['func'], {}), '(func)\n', (4039, 4045), False, 'import inspect\n'), ((5069, 5080), 'ariadne.QueryType', 'QueryType', ([], {}), '()\n', (5078, 5080), False, 'from ariadne import make_executable_schema, QueryType, MutationType, SubscriptionType\n'), ((5110, 5124), 'ar... |
DankMickey/Project-Altis-Educational-Source | toontown/battle/DistributedBattleBaseAI.py | 0a74999fb52d4e690a41b984703119f63c372d20 | import random
from otp.ai.AIBase import *
from direct.distributed.ClockDelta import *
from toontown.battle.BattleBase import *
from toontown.battle.BattleCalculatorAI import *
from toontown.toonbase.ToontownBattleGlobals import *
from toontown.battle.SuitBattleGlobals import *
from pandac.PandaModules import *
from too... | [((947, 1017), 'direct.directnotify.DirectNotifyGlobal.directNotify.newCategory', 'DirectNotifyGlobal.directNotify.newCategory', (['"""DistributedBattleBaseAI"""'], {}), "('DistributedBattleBaseAI')\n", (990, 1017), False, 'from direct.directnotify import DirectNotifyGlobal\n'), ((1167, 1226), 'direct.distributed.Distr... |
HsunGong/Augmented-Advertisement | tracking_test.py | ae9d0f5796c13e837a1a547d888647aeb61f0b04 | # Copyright (c) Group Three-Forest SJTU. All Rights Reserved.
from tracking.tracking import *
# a = tracking_video_rectangle("video/","1.mp4",[[273,352],[266,616],[412,620],[416,369]])
a = tracking_video_rectangle_tovideo("video/","1.mp4", "1.png", [[273,352],[266,616],[412,620],[416,369]], result = 'result__.a... | [] |
katetolstaya/gym-flock | gym_flock/envs/old/flocking_position.py | 3236d1dafcb1b9be0cf78b471672e8becb2d37af | import gym
from gym import spaces, error, utils
from gym.utils import seeding
import numpy as np
from scipy.spatial.distance import pdist, squareform
import configparser
from os import path
import matplotlib.pyplot as plt
from matplotlib.pyplot import gca
font = {'family' : 'sans-serif',
'weight' : 'bold',
... | [((488, 515), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (513, 515), False, 'import configparser\n'), ((1655, 1720), 'numpy.zeros', 'np.zeros', (['(self.n_nodes, self.nx * self.filter_len, self.n_pools)'], {}), '((self.n_nodes, self.nx * self.filter_len, self.n_pools))\n', (1663, 1720),... |
codingwangfeng/GoodGoodName | conf/constants.py | 02bfeb3ae65fd9ba0354f5b67237fcad4c0e11cb | # -*-coding:utf-8-*-
# from functools import reduce
from functools import reduce
SANCAI_jixiang = [1, 3, 5, 7, 8, 11, 13, 15, 16, 18, 21, 23, 24, 25, 31, 32, 33, 35, 37, 39, 41, 45, 47, 48, 52, 57, 61,
63,
65, 67, 68, 81] # 吉祥运暗示数(代表健全,幸福,名誉等)
SANCAI_xiaoji = [6, 17, 26, 27, 29, 30,... | [((1814, 1859), 'functools.reduce', 'reduce', (['(lambda x, y: x + y)', 'good_num_list', '[]'], {}), '(lambda x, y: x + y, good_num_list, [])\n', (1820, 1859), False, 'from functools import reduce\n'), ((1881, 1925), 'functools.reduce', 'reduce', (['(lambda x, y: x + y)', 'bad_num_list', '[]'], {}), '(lambda x, y: x + ... |
kevinmuturi5/farm-Management-system | main/migrations/0006_labourer_allproj.py | 61929d7998d92d56daac67c2f8ace3cc76b6ee8b | # Generated by Django 3.1.2 on 2020-10-18 16:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0005_auto_20201018_1902'),
]
operations = [
migrations.AddField(
model_name='labourer',
name='allproj',
... | [((334, 387), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'to': '"""main.Listing"""'}), "(blank=True, to='main.Listing')\n", (356, 387), False, 'from django.db import migrations, models\n')] |
beachwood23/taurus | bzt/modules/blazemeter/blazemeter_reporter.py | 698ac747bae5d4940a879a8526add67c11ef42da | """
Module for reporting into http://www.blazemeter.com/ service
Copyright 2015 BlazeMeter 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
Unles... | [((1859, 1870), 'time.time', 'time.time', ([], {}), '()\n', (1868, 1870), False, 'import time\n'), ((2131, 2137), 'bzt.bza.User', 'User', ([], {}), '()\n', (2135, 2137), False, 'from bzt.bza import User, Session, Test\n'), ((7511, 7520), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (7518, 7520), False, 'from io import By... |
wyli/nitorch | nitorch/nn/losses/_spatial.py | 3ecd18944cf45fb9193c4c6ffc32953c4d1c71ac | """
Losses that assume an underlying spatial organization
(gradients, curvature, etc.)
"""
import torch
import torch.nn as tnn
from nitorch.core.pyutils import make_list, prod
from nitorch.core.utils import slice_tensor
from nitorch.spatial import diff1d
from ._base import Loss
class LocalFeatures(tnn.Module):
"... | [((2889, 2904), 'nitorch.core.pyutils.make_list', 'make_list', (['side'], {}), '(side)\n', (2898, 2904), False, 'from nitorch.core.pyutils import make_list, prod\n'), ((3083, 3097), 'nitorch.core.pyutils.make_list', 'make_list', (['dim'], {}), '(dim)\n', (3092, 3097), False, 'from nitorch.core.pyutils import make_list,... |
roberthtamayose/digitalmenu | items/models.py | 19c6633844934fd95f861674946da386411a19c9 | from django.db import models
from django.utils import timezone
class Categoria(models.Model):
nome = models.CharField(max_length=255)
def __str__(self):
return self.nome
class Item(models.Model):
nome = models.CharField(max_length=255)
data_criacao = models.DateTimeField(default=timezone.no... | [((107, 139), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (123, 139), False, 'from django.db import models\n'), ((228, 260), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (244, 260), False, 'from django.d... |
zeroday0619/XenXenXenSe | app/services/__init__.py | 5af079e5edde3a6e4a1f5868052480d7b140d87c | from app.services.console import Console
from app.services.server import Server
__main__ = ["server", "console"]
| [] |
nuclearsandwich-ros/twist_mux-release | launch/twist_mux_launch.py | d92dcda0255e727b899d3bac62ef3d89c19cb38e | #!/usr/bin/env python3
# Copyright 2020 Gaitech Korea Co., Ltd.
#
# 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 appli... | [((965, 1005), 'ament_index_python.packages.get_package_share_directory', 'get_package_share_directory', (['"""twist_mux"""'], {}), "('twist_mux')\n", (992, 1005), False, 'from ament_index_python.packages import get_package_share_directory\n'), ((1122, 1162), 'ament_index_python.packages.get_package_share_directory', '... |
psu-capstone-teamD/ElementalAuth | Tests/testLiveService.py | d896efad5a3e4cb453c324afc456aa82f82da239 | import sys
import unittest
import requests_mock
from mock import patch
sys.path.append('services/LiveService')
from LiveService import LiveService
L = LiveService()
baseURL = "https://yanexx65s8e1.live.elementalclouddev.com/api"
class LiveServiceTest(unittest.TestCase):
'''@patch('services.LiveService.LiveSe... | [((71, 110), 'sys.path.append', 'sys.path.append', (['"""services/LiveService"""'], {}), "('services/LiveService')\n", (86, 110), False, 'import sys\n'), ((154, 167), 'LiveService.LiveService', 'LiveService', ([], {}), '()\n', (165, 167), False, 'from LiveService import LiveService\n'), ((798, 820), 'requests_mock.Mock... |
LionelMassoulard/aikit | tests/models/test_stacking.py | 98b2abaa3bf47ab46f2fd3c270010293de06dba9 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 14 11:49:10 2018
@author: Lionel Massoulard
"""
import pytest
import numpy as np
import pandas as pd
from sklearn.base import is_regressor, is_classifier
from sklearn.exceptions import NotFittedError
from sklearn.model_selection import KFold
from sklearn.ensemble impo... | [((644, 663), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (658, 663), True, 'import numpy as np\n'), ((672, 696), 'numpy.random.randn', 'np.random.randn', (['(100)', '(10)'], {}), '(100, 10)\n', (687, 696), True, 'import numpy as np\n'), ((1734, 1753), 'numpy.random.seed', 'np.random.seed', (['(1... |
odrolliv13/Hex-Photos | employee/views/check_rental.py | d1b42b63394783164f843fe6343491f04fe11e0c | from django import forms
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, Http404
from manager import models as pmod
from . import templater
from django.conf import settings
import decimal, datetime
# This view will display all users and then on a new page display al... | [((444, 473), 'django.http.HttpResponseRedirect', 'HttpResponseRedirect', (['"""/shop"""'], {}), "('/shop')\n", (464, 473), False, 'from django.http import HttpResponse, HttpResponseRedirect, Http404\n'), ((523, 552), 'django.http.HttpResponseRedirect', 'HttpResponseRedirect', (['"""/shop"""'], {}), "('/shop')\n", (543... |
nguyenngtt/GSE---TEAM-A | jupyter/settings.py | 4f78c1ace051d4f2ff30a039aa481aa9b79d3242 | import pandas as pd
import numpy as np
import os
import logging
# suppress warnings
import warnings;
warnings.filterwarnings('ignore');
from tqdm.autonotebook import tqdm
# register `pandas.progress_apply` and `pandas.Series.map_apply` with `tqdm`
tqdm.pandas()
# https://pandas.pydata.org/pandas-docs/stable/user_g... | [((103, 136), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (126, 136), False, 'import warnings\n'), ((252, 265), 'tqdm.autonotebook.tqdm.pandas', 'tqdm.pandas', ([], {}), '()\n', (263, 265), False, 'from tqdm.autonotebook import tqdm\n'), ((746, 780), 'numpy.set_printopt... |
jeanbez/spack | var/spack/repos/builtin/packages/py-cyvcf2/package.py | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyCyvcf2(PythonPackage):
"""fast vcf parsing with cython + htslib"""
homepage... | [] |
mottaquikarim/pydev-psets | pset_functions/db_search/p1.py | 9749e0d216ee0a5c586d0d3013ef481cc21dee27 | """
GPA Calculator
"""
# Write a function called "simple_gpa" to find GPA when student enters a letter grade as a string. Assign the result to a variable called "gpa".
"""
Use these conversions:
A+ --> 4.0
A --> 4.0
A- --> 3.7
B+ --> 3.3
B --> 3.0
B- --> 2.7
C+ --> 2.3
C --> 2.0
C- --> 1.7
D+ --> 1.3
D --> 1.0
D- -->... | [] |
flying-sheep/SoundCard | test_soundcard.py | b476c8142b460fc8161d374b282fe846d72a0780 | import sys
import soundcard
import numpy
import pytest
ones = numpy.ones(1024)
signal = numpy.concatenate([[ones], [-ones]]).T
def test_speakers():
for speaker in soundcard.all_speakers():
assert isinstance(speaker.name, str)
assert hasattr(speaker, 'id')
assert isinstance(speaker.channels... | [((63, 79), 'numpy.ones', 'numpy.ones', (['(1024)'], {}), '(1024)\n', (73, 79), False, 'import numpy\n'), ((89, 125), 'numpy.concatenate', 'numpy.concatenate', (['[[ones], [-ones]]'], {}), '([[ones], [-ones]])\n', (106, 125), False, 'import numpy\n'), ((169, 193), 'soundcard.all_speakers', 'soundcard.all_speakers', ([]... |
jaiveergill/Last-Three-Digits-of-11-x | Last 3 digits of 11^x.py | def4519b9b46e41b4c4f2b3a5dbe5566316dd83e | # This is a simple program to find the last three digits of 11 raised to any given number.
# The main algorithm that does the work is on line 10
def trim_num(num):
if len(str(num)) > 3: # no need to trim if the number is 3 or less digits long
return str(num)[(len(str(num)) - 3):] # trims the number
ret... | [] |
ljb2208/osr-rover-code | osr_odometry/scripts/osr_odom_ackerman2.py | f4791d835cd760446777a226d37bb3114256affd | #!/usr/bin/env python
import time
from osr_msgs.msg import Joystick, Commands, Encoder, RunStop
from nav_msgs.msg import Odometry
from geometry_msgs.msg import Point, Pose, Quaternion, Twist, Vector3
import rospy
import tf
import math
import numpy
class Odometry2():
def __init__(self, baseFrame, wheelTrack, mpt, d... | [((5352, 5384), 'rospy.init_node', 'rospy.init_node', (['"""osr_odometry2"""'], {}), "('osr_odometry2')\n", (5367, 5384), False, 'import rospy\n'), ((5389, 5437), 'rospy.loginfo', 'rospy.loginfo', (['"""Starting the osr odometry2 node"""'], {}), "('Starting the osr odometry2 node')\n", (5402, 5437), False, 'import rosp... |
alisiahkoohi/importance-of-transfer-learning | src/simulation-conditioning/utilities/data-generation-scripts/Wavefield_Marmousi_pml_401x301_1000-1287_120-232_4k_20kp100_A_train.py | bb4c7943f4ff64a2f1785503328b4cbb4f5111aa | import numpy as np
import h5py
import os
from devito.logger import info
from devito import TimeFunction, clear_cache
from examples.seismic.acoustic import AcousticWaveSolver
from examples.seismic import Model, RickerSource, Receiver, TimeAxis
from math import floor
from scipy.interpolate import griddata
import argparse... | [((331, 370), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""""""'}), "(description='')\n", (354, 370), False, 'import argparse\n'), ((877, 904), 'numpy.reshape', 'np.reshape', (['vp', '(1601, 401)'], {}), '(vp, (1601, 401))\n', (887, 904), True, 'import numpy as np\n'), ((959, 996), 'num... |
divine-coder/CODECHEF-PYTHON | facto.py | a1e34d6f9f75cf7b9497f1ef2f937cb4f64f1543 | import math
if __name__=='__main__':
n=(int)(input())
for abc in range(n):
t=(int)(input())
print math.factorial(t)
| [] |
johnmartingodo/pyKinematicsKineticsToolbox | setup.py | 4ffc99885f3c637b8c33914a4e50ccb4595fc844 | from setuptools import setup
setup(name="pykinematicskineticstoolbox",
version="0.0",
description="Installable python package which collects useful kinematics and kinetics functions",
author="John Martin K. Godø",
author_email="[email protected]",
license="MIT",
packages=["pykinematic... | [((30, 369), 'setuptools.setup', 'setup', ([], {'name': '"""pykinematicskineticstoolbox"""', 'version': '"""0.0"""', 'description': '"""Installable python package which collects useful kinematics and kinetics functions"""', 'author': '"""John Martin K. Godø"""', 'author_email': '"""[email protected]"""'... |
bit0fun/plugins | summary/summary_avail.py | 1f6f701bf1e60882b8fa61cb735e7033c8c29e3c | from datetime import datetime
# ensure an rpc peer is added
def addpeer(p, rpcpeer):
pid = rpcpeer['id']
if pid not in p.persist['peerstate']:
p.persist['peerstate'][pid] = {
'connected': rpcpeer['connected'],
'last_seen': datetime.now() if rpcpeer['connected'] else None,
... | [((883, 897), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (895, 897), False, 'from datetime import datetime\n'), ((265, 279), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (277, 279), False, 'from datetime import datetime\n')] |
hugovk/python-terrascript | terrascript/dns/r.py | 08fe185904a70246822f5cfbdc9e64e9769ec494 | # terrascript/dns/r.py
import terrascript
class dns_a_record_set(terrascript.Resource):
pass
class dns_aaaa_record_set(terrascript.Resource):
pass
class dns_cname_record(terrascript.Resource):
pass
class dns_mx_record_set(terrascript.Resource):
pass
class dns_ns_record_set(terrascript.Resource... | [] |
gneumann333/jumpscaleX_core | JumpscaleCore/clients/tcprouter/TCPRouterFactory.py | 777d249fa3668c6e802c2f765f4b82fb39c3e5fa | from Jumpscale import j
from .TCPRouterClient import TCPRouterClient
JSConfigs = j.baseclasses.object_config_collection
class TCPRouterFactory(JSConfigs):
__jslocation__ = "j.clients.tcp_router"
_CHILDCLASS = TCPRouterClient
def test(self):
"""
kosmos 'j.clients.tcp_router.test()'
... | [] |
miguelarbesu/nmrglue | nmrglue/fileio/spinsolve.py | 6ca36de7af1a2cf109f40bf5afe9c1ce73c9dcdc | """
Functions for reading Magritek Spinsolve binary (dx/1d) files and
parameter (acqu.par/proc.par) files.
"""
import os
from warnings import warn
import numpy as np
from . import fileiobase
from . import jcampdx
__developer_info__ = """
Spinsolve is the software used on the Magritek benchtop NMR devices.
A spect... | [((3216, 3242), 'os.path.join', 'os.path.join', (['dir', 'acqupar'], {}), '(dir, acqupar)\n', (3228, 3242), False, 'import os\n'), ((3250, 3273), 'os.path.isfile', 'os.path.isfile', (['acqupar'], {}), '(acqupar)\n', (3264, 3273), False, 'import os\n'), ((3551, 3577), 'os.path.join', 'os.path.join', (['dir', 'procpar'],... |
mielgosez/navigation_analytics | src/navigation_analytics/navigation_data.py | 3c382e8200afe4d37fa0880f155bf1bb2f48b83f | import logging
import copy
import pickle
import pandas as pd
class BaseClass:
def __init__(self,
input_data: pd.DataFrame,
logger: logging.Logger,
metadata: dict):
self.__input_data = input_data
self.__logger = logger
self.__metadata = met... | [((17565, 17622), 'logging.Logger', 'logging.Logger', ([], {'name': '"""default_logger"""', 'level': 'logger_level'}), "(name='default_logger', level=logger_level)\n", (17579, 17622), False, 'import logging\n'), ((20100, 20124), 'pandas.ExcelWriter', 'pd.ExcelWriter', (['filename'], {}), '(filename)\n', (20114, 20124),... |
CalColson/openskill.py | openskill/statistics.py | ab61ca57fa6e60140d0a292c73440f22ceabd9a2 | import sys
import scipy.stats
normal = scipy.stats.norm(0, 1)
def phi_major(x):
return normal.cdf(x)
def phi_minor(x):
return normal.pdf(x)
def v(x, t):
xt = x - t
denom = phi_major(xt)
return -xt if (denom < sys.float_info.epsilon) else phi_minor(xt) / denom
def w(x, t):
xt = x - t
... | [] |
revesansparole/oacontainer | src/openalea/container/graph.py | 066a15b8b1b22f857bf25ed443c5f39f4cbefb3e | # -*- coding: utf-8 -*-
#
# Graph : graph package
#
# Copyright or Copr. 2006 INRIA - CIRAD - INRA
#
# File author(s): Jerome Chopard <[email protected]>
#
# Distributed under the Cecill-C License.
# See accompanying file LICENSE.txt or copy at
# http://www.cecill.in... | [((1469, 1500), 'id_dict.IdDict', 'IdDict', ([], {'idgenerator': 'idgenerator'}), '(idgenerator=idgenerator)\n', (1475, 1500), False, 'from id_dict import IdDict\n'), ((1523, 1554), 'id_dict.IdDict', 'IdDict', ([], {'idgenerator': 'idgenerator'}), '(idgenerator=idgenerator)\n', (1529, 1554), False, 'from id_dict import... |
GT-AcerZhang/PaddlePaddle-SSD | nets/mobilenet_v2_ssd.py | 3833afe3470b7dc811409b3d8111b98dc31c6d0e | import paddle.fluid as fluid
from paddle.fluid.initializer import MSRA
from paddle.fluid.param_attr import ParamAttr
class MobileNetV2SSD:
def __init__(self, img, num_classes, img_shape):
self.img = img
self.num_classes = num_classes
self.img_shape = img_shape
def ssd_net(self, scale=... | [((8339, 8389), 'paddle.fluid.data', 'fluid.data', ([], {'name': '"""data"""', 'shape': '[None, 3, 300, 300]'}), "(name='data', shape=[None, 3, 300, 300])\n", (8349, 8389), True, 'import paddle.fluid as fluid\n'), ((1779, 2209), 'paddle.fluid.layers.multi_box_head', 'fluid.layers.multi_box_head', ([], {'inputs': '[modu... |
caishenghang/oneflow | oneflow/python/test/ops/test_object_bbox_scale.py | db239cc9f98e551823bf6ce2d4395bd5c339b1c5 | """
Copyright 2020 The OneFlow 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 applicable law or agr... | [((5441, 5473), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (5471, 5473), True, 'import oneflow as flow\n'), ((891, 906), 'pycocotools.coco.COCO', 'COCO', (['anno_file'], {}), '(anno_file)\n', (895, 906), False, 'from pycocotools.coco import COCO\n'), ((2307, 2336), 'numpy.a... |
BertRaeymaekers/scrapbook | vagrant/kafka/bin/init.py | 3c8483d4594356fbc84deb8d6496db3d856492c1 | #! /usr/bin/env python3
import json
import os.path
import jinja2
DEFAULT_PARAMS = {
"ansible_user": "vagrant"
}
if __name__ == "__main__":
# Reading configuration
here = os.path.dirname(os.path.realpath(__file__ + "/../"))
with open(here + "/config.json", "r") as rf:
config = json.load(rf... | [((308, 321), 'json.load', 'json.load', (['rf'], {}), '(rf)\n', (317, 321), False, 'import json\n'), ((332, 376), 'json.dumps', 'json.dumps', (['config'], {'sort_keys': '(True)', 'indent': '(4)'}), '(config, sort_keys=True, indent=4)\n', (342, 376), False, 'import json\n'), ((1075, 1120), 'jinja2.FileSystemLoader', 'ji... |
lmaurits/harvest | harvest/models/beastsimulator.py | df6b549096da8ae2f4ed38aa2be19c7e82fa60e3 | import os
import harvest.dataframe
from harvest.models.simulator import Simulator
class BeastSimulator(Simulator):
def __init__(self, tree, n_features):
Simulator.__init__(self, tree, n_features)
def generate_beast_xml(self):
# Subclasses should implement this
return None
def ge... | [((168, 210), 'harvest.models.simulator.Simulator.__init__', 'Simulator.__init__', (['self', 'tree', 'n_features'], {}), '(self, tree, n_features)\n', (186, 210), False, 'from harvest.models.simulator import Simulator\n'), ((524, 573), 'os.system', 'os.system', (["('beast %s > /dev/null' % temp_filename)"], {}), "('bea... |
DutChen18/slime-clusters-cuda | assimilator.py | 186d198665a017cf0eacde33765b6cb3cb4aecb5 | # pylint: skip-file
import os
from assimilator import *
from Boinc import boinc_project_path
class SlimeClustersAssimilator(Assimilator):
def __init__(self):
Assimilator.__init__(self)
def assimilate_handler(self, wu, results, canonical_result):
if canonical_result == None:
return... | [((404, 453), 'Boinc.boinc_project_path.project_path', 'boinc_project_path.project_path', (['"""slime-clusters"""'], {}), "('slime-clusters')\n", (435, 453), False, 'from Boinc import boinc_project_path\n'), ((473, 509), 'os.path.join', 'os.path.join', (['dst_dir', '"""results.txt"""'], {}), "(dst_dir, 'results.txt')\n... |
Rubtsowa/modin | modin/core/execution/ray/implementations/cudf_on_ray/dataframe/dataframe.py | 6550939753c76e896ef2bfd65bb9468d6ad161d7 | # Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... | [((2458, 2544), 'modin.error_message.ErrorMessage.catch_bugs_and_request_email', 'ErrorMessage.catch_bugs_and_request_email', (['(axis is not None and axis not in [0, 1])'], {}), '(axis is not None and axis not in\n [0, 1])\n', (2499, 2544), False, 'from modin.error_message import ErrorMessage\n'), ((2590, 2624), 'n... |
mw5868/University | Exoplanet_Population.py | 076c9b001dbfe3765607877be4f89ccf86a88331 | from astropy.table import Table, Column
import matplotlib.pyplot as plt
#url = "https://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets&select=pl_hostname,ra,dec&order=dec&format=csv"
url = "https://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets"
# This... | [((359, 388), 'astropy.table.Table.read', 'Table.read', (['url'], {'format': '"""csv"""'}), "(url, format='csv')\n", (369, 388), False, 'from astropy.table import Table, Column\n'), ((645, 657), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (655, 657), True, 'import matplotlib.pyplot as plt\n'), ((1455, 1... |
marthoc/pykuna | pykuna/errors.py | f5bf02f26e1931b35becde6e1da58fb8bb0cc2d8 | class KunaError(Exception):
pass
class AuthenticationError(KunaError):
"""Raised when authentication fails."""
pass
class UnauthorizedError(KunaError):
"""Raised when an API call fails as unauthorized (401)."""
pass
| [] |
henrimitte/Project-Euler | src/pe_problem74.py | 77fd9f5b076d1ca2e5ed4ef94bf8d32d9ed611eb | from tools import factorial
def solve():
fa = tuple(factorial(x) for x in range(10))
def _sum_factorial_of_digits(n: int) -> int:
s = 0
while n > 0:
s += fa[n % 10]
n //= 10
return s
limit = 1000000
loops = [0 for x in range(limit)]
for i in range(... | [((58, 70), 'tools.factorial', 'factorial', (['x'], {}), '(x)\n', (67, 70), False, 'from tools import factorial\n')] |
ferguscan/thingsboard-gateway | thingsboard_gateway/connectors/modbus/modbus_connector.py | bc20fdb8e46f840b8538a010db2714ec6071fa5b | # Copyright 2022. ThingsBoard
#
# 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 ... | [((3326, 3335), 'queue.Queue', 'Queue', (['(-1)'], {}), '(-1)\n', (3331, 3335), False, 'from queue import Queue\n'), ((1008, 1056), 'thingsboard_gateway.tb_utility.tb_utility.TBUtility.install_package', 'TBUtility.install_package', (['"""pymodbus"""', '""">=2.3.0"""'], {}), "('pymodbus', '>=2.3.0')\n", (1033, 1056), Fa... |
xwu20/wmg_agent | specs/test_gru_on_flat_babyai.py | 25378c8fc54eb6e0e8c9d969760a72e843572f09 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
### CONTROLS (non-tunable) ###
# general
TYPE_OF_RUN = test_episodes # train, test, test_episodes, render
NUM_EPISODES_TO_TEST = 1000
MIN_FINAL_REWARD_FOR_SUCCESS = 1.0
LOAD_MODEL_FROM = models/gru_flat_babyai.pth
SAVE_MODELS_TO = None
# wo... | [] |
meisterT/rules_haskell | haskell/private/actions/runghc.bzl | 7c0a867fc23da104ea8cbff26864894abcf137bc | """runghc support"""
load(":private/context.bzl", "render_env")
load(":private/packages.bzl", "expose_packages", "pkg_info_to_compile_flags")
load(
":private/path_utils.bzl",
"link_libraries",
"ln",
"target_unique_name",
)
load(
":private/set.bzl",
"set",
)
load(":providers.bzl", "get_ghci_extr... | [] |
pymedphys/pymedphys-archive-2019 | tests/dicom/test_header_tweaks.py | 6bb7c8d0da2e93ff56469bb47e65b15ece2ea25e | # Copyright (C) 2019 Cancer Care Associates
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to ... | [((958, 983), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (973, 983), False, 'import os\n'), ((1256, 1309), 'pydicom.write_file', 'pydicom.write_file', (['ORIGINAL_DICOM_FILENAME', 'original'], {}), '(ORIGINAL_DICOM_FILENAME, original)\n', (1274, 1309), False, 'import pydicom\n'), ((1676, ... |
itewk/home-assistant | tests/components/http/test_data_validator.py | 769cf19052f8c9ef374d8ba8ae7705ccc7bf4cf4 | """Test data validator decorator."""
from unittest.mock import Mock
from aiohttp import web
import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.http.data_validator import RequestDataValidator
async def get_client(aiohttp_client, validator):
"""Gener... | [((389, 406), 'aiohttp.web.Application', 'web.Application', ([], {}), '()\n', (404, 406), False, 'from aiohttp import web\n'), ((425, 446), 'unittest.mock.Mock', 'Mock', ([], {'is_running': '(True)'}), '(is_running=True)\n', (429, 446), False, 'from unittest.mock import Mock\n'), ((937, 957), 'voluptuous.Required', 'vo... |
sam-aldis/Conversley | Conversely_Frontend/app/Server/ukjp/templates.py | 1fc30d6b768cc03f727229a52e0879fac3af1e3a | import days
STAGE_INIT = 0
STAGE_CHALLENGE_INIT = 1
STAGE_BOOKED = 2
def createJSONTemplate(data):
pass
messages = [
"Hey {{first_name}}, thankyou for your enquiry to be one of our Transformation Challengers",
"We have 2 Challenges available for you:\n\nThe 8 Week Bikini Challenge which h... | [] |
jeanbez/spack | var/spack/repos/builtin/packages/pagmo2/package.py | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Pagmo2(CMakePackage):
"""Parallel Global Multiobjective Optimizer (and its Python ... | [] |
earthobservatory/ariamh-pub | interferogram/sentinel/fetchCalES.py | f33731e127f38ff33b02e02c07b16793c07651a6 | #!/usr/bin/env python3
import os, sys, re, json, requests, datetime, tarfile, argparse
from pprint import pprint
import numpy as np
from utils.UrlUtils import UrlUtils
server = 'https://qc.sentinel1.eo.esa.int/'
cal_re = re.compile(r'S1\w_AUX_CAL')
def cmdLineParse():
'''
Command line parser.
'''
... | [((225, 252), 're.compile', 're.compile', (['"""S1\\\\w_AUX_CAL"""'], {}), "('S1\\\\w_AUX_CAL')\n", (235, 252), False, 'import os, sys, re, json, requests, datetime, tarfile, argparse\n'), ((329, 426), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Fetch calibration auxiliary files inges... |
stain/conservancy-website | www/conservancy/urls.py | 9e41ddff766fe517a99198d60701193e8b68415e | # Copyright 2005-2008, James Garrison
# Copyright 2010, 2012 Bradley M. Kuhn
# This software's license gives you freedom; you can copy, convey,
# propagate, redistribute, modify and/or redistribute modified versions of
# this program under the terms of the GNU Affero General Public License
# (AGPL) as published by the... | [((1161, 1181), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (1179, 1181), False, 'from django.contrib import admin, admindocs\n'), ((1203, 1228), 'django.conf.urls.url', 'url', (['"""^$"""', 'frontpage.view'], {}), "('^$', frontpage.view)\n", (1206, 1228), False, 'from django.conf.urls ... |
FabienArcellier/spike-graphene-flask | graphene_spike_tests/acceptances/test_query.py | bc7bce571a21826c3da852eb1c2e1904bbab99b4 | import unittest
from unittest.mock import Mock
from graphene import Schema
from graphene.test import Client
from graphene_spike.query import Query
class MainTest(unittest.TestCase):
def setUp(self):
self.schema = Schema(query=Query)
self.client = client = Client(self.schema)
def test_hello_... | [((229, 248), 'graphene.Schema', 'Schema', ([], {'query': 'Query'}), '(query=Query)\n', (235, 248), False, 'from graphene import Schema\n'), ((280, 299), 'graphene.test.Client', 'Client', (['self.schema'], {}), '(self.schema)\n', (286, 299), False, 'from graphene.test import Client\n')] |
davidventasmarin/clikan | clikan.py | 401fe4053a14873872bb246739d55c55f8f6dcfa | from rich import print
from rich.console import Console
from rich.table import Table
import click
from click_default_group import DefaultGroup
import yaml
import os
##from terminaltables import SingleTable
import sys
from textwrap import wrap
import collections
import datetime
import configparser
import pkg_resources ... | [((824, 870), 'click.make_pass_decorator', 'click.make_pass_decorator', (['Config'], {'ensure': '(True)'}), '(Config, ensure=True)\n', (849, 870), False, 'import click\n'), ((2635, 2664), 'click.version_option', 'click.version_option', (['VERSION'], {}), '(VERSION)\n', (2655, 2664), False, 'import click\n'), ((2666, 27... |
RagtagOpen/python-social-auth-ragtag-id | social_auth_ragtag_id/backends.py | 8d8e005231c09535098136213347934e9da7b3f2 | from social_core.backends.oauth import BaseOAuth2
class RagtagOAuth2(BaseOAuth2):
"""Ragtag ID OAuth authentication backend"""
name = "ragtag"
AUTHORIZATION_URL = "https://id.ragtag.org/oauth/authorize/"
ACCESS_TOKEN_URL = "https://id.ragtag.org/oauth/token/"
ACCESS_TOKEN_METHOD = "POST"
REVO... | [] |
angeelgarr/DCPanel | panel/api/models/provider.py | 1901a0f4b1b4273b60d3a218797fb6614d05b4c0 | from django.db import models
from django.contrib import admin
class Provider(models.Model):
name = models.CharField(max_length=50)
domain = models.CharField(max_length=50)
class Meta:
ordering = ['name']
app_label = 'api'
def __str__(self):
return self.domain
@admin.registe... | [((307, 331), 'django.contrib.admin.register', 'admin.register', (['Provider'], {}), '(Provider)\n', (321, 331), False, 'from django.contrib import admin\n'), ((105, 136), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (121, 136), False, 'from django.db import model... |
siddharthumakarthikeyan/Cable-Driven-Parallel-Robots-CDPR-Modelling | trial/src/sender.py | 4e8d991d55ae7da91b3c90773c679f3369a4dafa | #!/usr/bin/env python
# license removed for brevity
import rospy
from std_msgs.msg import String
from gazebo_msgs.msg import LinkState
def talker():
pub = rospy.Publisher('/gazebo/set_link_state', LinkState, queue_size=10)
ppp = LinkState()
rospy.init_node('talker', anonymous=True)
rate = rospy.R... | [((161, 228), 'rospy.Publisher', 'rospy.Publisher', (['"""/gazebo/set_link_state"""', 'LinkState'], {'queue_size': '(10)'}), "('/gazebo/set_link_state', LinkState, queue_size=10)\n", (176, 228), False, 'import rospy\n'), ((239, 250), 'gazebo_msgs.msg.LinkState', 'LinkState', ([], {}), '()\n', (248, 250), False, 'from g... |
kimmokal/CC-Art-Critics | discriminator_dataset.py | af83762a5f22043f279c167cbd58e16737e3ec87 | import torch
from os import listdir, path
from PIL import Image
import torchvision
class DiscriminatorDataset(torch.utils.data.Dataset):
def __init__(self):
super(DiscriminatorDataset, self).__init__()
currentDir = path.dirname(__file__)
abstractDir = path.join(currentDir, 'image_data/abs... | [((238, 260), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (250, 260), False, 'from os import listdir, path\n'), ((283, 327), 'os.path.join', 'path.join', (['currentDir', '"""image_data/abstract"""'], {}), "(currentDir, 'image_data/abstract')\n", (292, 327), False, 'from os import listdir, pat... |
ionata/django-emailmeld | emailmeld/sender.py | 28326933d22957f8737ab8a9564daa9cbfca6d06 | from django.core.mail.message import EmailMessage, EmailMultiAlternatives
from django.utils.translation import ugettext_lazy as _
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
def send_mail_task(subject, message, from_email, recipient_list):
message = EmailMessa... | [((644, 667), 'django.utils.safestring.mark_safe', 'mark_safe', (['html_message'], {}), '(html_message)\n', (653, 667), False, 'from django.utils.safestring import mark_safe\n')] |
sander-vd/HAP-python | tests/test_hap_server.py | 991761ceadfd7796d454d61c87be7f5d4b75d432 | """Tests for the HAPServer."""
from socket import timeout
from unittest.mock import Mock, MagicMock, patch
import pytest
from pyhap import hap_server
@patch('pyhap.hap_server.HAPServer.server_bind', new=MagicMock())
@patch('pyhap.hap_server.HAPServer.server_activate', new=MagicMock())
def test_finish_request_pops_s... | [((426, 432), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (430, 432), False, 'from unittest.mock import Mock, MagicMock, patch\n'), ((924, 985), 'pyhap.hap_server.HAPServer', 'hap_server.HAPServer', (['server_addr', 'amock'], {'handler_type': 'raises'}), '(server_addr, amock, handler_type=raises)\n', (944, 985), Fa... |
charlesashby/marketvault-front-end | app/views/main.py | 758cf8ba1d8486f45eac093ded78a15fc82df3dc | from flask import render_template, Blueprint, request
from app.utils.search import MySQLClient
from app.utils.preprocessor import TextPreprocessor
mainbp = Blueprint("main", __name__)
@mainbp.route("/search", methods=["GET"])
@mainbp.route("/", methods=["GET"])
def home():
stores_by_page = 10
topic = reque... | [((159, 186), 'flask.Blueprint', 'Blueprint', (['"""main"""', '__name__'], {}), "('main', __name__)\n", (168, 186), False, 'from flask import render_template, Blueprint, request\n'), ((315, 340), 'flask.request.args.get', 'request.args.get', (['"""topic"""'], {}), "('topic')\n", (331, 340), False, 'from flask import re... |
tinapiao/Software-IC-Automation | bag_testbenches/ckt_dsn/analog/amplifier/opamp_two_stage.py | 74b23cd94aa6e4658b110e93b5deb635e014f3a6 | # -*- coding: utf-8 -*-
"""This module contains design algorithm for a traditional two stage operational amplifier."""
from typing import TYPE_CHECKING, List, Optional, Dict, Any, Tuple, Sequence
from copy import deepcopy
import numpy as np
import scipy.optimize as sciopt
from bag.math import gcd
from bag.data.lti... | [((6057, 6090), 'bag.util.search.BinaryIterator', 'BinaryIterator', (['i1_min_size', 'None'], {}), '(i1_min_size, None)\n', (6071, 6090), False, 'from bag.util.search import FloatBinaryIterator, BinaryIterator, minimize_cost_golden\n'), ((15101, 15120), 'copy.deepcopy', 'deepcopy', (['top_specs'], {}), '(top_specs)\n',... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.