repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
bernease/whylogs-python | tests/unit/app/test_session.py | cfd2a2f71280537aae584cbd40a752fbe7da647b |
import pytest
from whylogs.app.session import get_or_create_session, get_session, get_logger, reset_default_session, session_from_config
from whylogs.app.config import SessionConfig
from whylogs.app.session import Session
from pandas import util
def test_get_global_session():
_session = None
session = get_o... | [((315, 338), 'whylogs.app.session.get_or_create_session', 'get_or_create_session', ([], {}), '()\n', (336, 338), False, 'from whylogs.app.session import get_or_create_session, get_session, get_logger, reset_default_session, session_from_config\n'), ((361, 374), 'whylogs.app.session.get_session', 'get_session', ([], {}... |
Bemesko/Intelligence-of-Home-GUI | Packages/constants.py | 4580d2d2a6b5f3509e2e0897fd0c9952711ccd2b | import enum
BASELINE = "baseline"
ENERGY = "energy"
MAX_PRICE = "max_price"
START_PRICE = "starting_price"
INCREMENT = "increment"
MIN_PRICE = "min_price"
MAX_LOT_SIZE = "max_lot_size_wh"
NAMESERVER_AGENT_AMOUNT = 3
ATTRIBUTE_LIST_LENGTH = 50
NEXT_ENERGY_CONSUMPTION = "next_energy_consumption"
NEXT_ENERGY_GENERATION ... | [] |
groundupnews/gu | target/tests.py | c7179ee3d058c8749d250d681032a76dc8d599d5 | from django.contrib.auth.models import User
from django.test import TestCase
from django.test import Client
from django.urls import reverse
from target import models
from django.utils import timezone
# Create your tests here.
class URLSWork(TestCase):
@classmethod
def setUpTestData(cls):
target = mod... | [((317, 332), 'target.models.Target', 'models.Target', ([], {}), '()\n', (330, 332), False, 'from target import models\n'), ((432, 446), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (444, 446), False, 'from django.utils import timezone\n'), ((536, 599), 'django.contrib.auth.models.User.objects.create_... |
julienduchesne/jenkinsapi | jenkinsapi/view.py | 369dc54a8d5bb1f4e985c647378b9e1e62c26961 | """
Module for jenkinsapi views
"""
import six
import logging
from jenkinsapi.jenkinsbase import JenkinsBase
from jenkinsapi.job import Job
from jenkinsapi.custom_exceptions import NotFound
log = logging.getLogger(__name__)
class View(JenkinsBase):
"""
View class
"""
def __init__(self, url, name,... | [((199, 226), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (216, 226), False, 'import logging\n'), ((407, 438), 'jenkinsapi.jenkinsbase.JenkinsBase.__init__', 'JenkinsBase.__init__', (['self', 'url'], {}), '(self, url)\n', (427, 438), False, 'from jenkinsapi.jenkinsbase import JenkinsBa... |
jmarangola/cv-chess | core/vision/collection.py | c1bf1754b622e76bc2bc92276b96760c321a8bd9 | """
Autonomous dataset collection of data for jetson nano
John Marangola - marangol@bc.edu
"""
import datasets
import json
from datasets import Board, ChessPiece, PieceColor, PieceType
#from realsense_utils import RealSenseCamera
import preprocessing as pr
import cv2
import pandas as pd
import os
from os.path import... | [((1081, 1130), 'cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (['image_center', 'angle', '(1.0)'], {}), '(image_center, angle, 1.0)\n', (1104, 1130), False, 'import cv2\n'), ((1142, 1216), 'cv2.warpAffine', 'cv2.warpAffine', (['image', 'rot_mat', 'image.shape[1::-1]'], {'flags': 'cv2.INTER_LINEAR'}), '(image, r... |
htwangtw/sbfc | tests/test_sbfc.py | 5119017a643b82efbfaaf373a26f191a51f8283a | import os
import numpy as np
import pandas as pd
from nilearn import datasets
from sbfc.parser import seed_base_connectivity
seed = os.path.dirname(__file__) + "/data/difumo64_pcc.nii.gz"
def _make_data_single_run(confound=True):
adhd_dataset = datasets.fetch_adhd(n_subjects=2)
group_confounds = pd.DataFra... | [((135, 160), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (150, 160), False, 'import os\n'), ((254, 287), 'nilearn.datasets.fetch_adhd', 'datasets.fetch_adhd', ([], {'n_subjects': '(2)'}), '(n_subjects=2)\n', (273, 287), False, 'from nilearn import datasets\n'), ((699, 716), 'numpy.random.... |
ChrisOmeh/xzceb-flask_eng_fr | final_project/machinetranslation/tests/test.py | 6ce4a79539b8ace4bce999c32a9f58aa73827e5c | import unittest
from translator import english_to_french, french_to_english
class TestenglishToFrench(unittest.TestCase):
def test1(self):
self.assertEqual(english_to_french(["Hello"]), "Bonjour")
self.assertNotEqual(english_to_french(["Bonjour"]), "Hello")
class TestfrenchToEnglish(unittest.TestC... | [((513, 528), 'unittest.main', 'unittest.main', ([], {}), '()\n', (526, 528), False, 'import unittest\n'), ((169, 197), 'translator.english_to_french', 'english_to_french', (["['Hello']"], {}), "(['Hello'])\n", (186, 197), False, 'from translator import english_to_french, french_to_english\n'), ((238, 268), 'translator... |
huxian123/mindspore | tests/ut/python/parallel/test_auto_parallel_transformer.py | ec5ba10c82bbd6eccafe32d3a1149add90105bc8 | # Copyright 2019 Huawei Technologies 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 applicable law or agreed to... | [((902, 931), 'mindspore.ops.composite.GradOperation', 'C.GradOperation', ([], {'get_all': '(True)'}), '(get_all=True)\n', (917, 931), True, 'from mindspore.ops import composite as C\n'), ((3233, 3298), 'mindspore.context.set_auto_parallel_context', 'context.set_auto_parallel_context', ([], {'device_num': 'size', 'glob... |
rcbops-qa/cloudcafe | cloudcafe/compute/events/models/common.py | d937f85496aadafbb94a330b9adb8ea18bee79ba | """
Copyright 2015 Rackspace
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
dist... | [] |
sekcheong/openpyxl | openpyxl/drawing/tests/test_shapes.py | e1ba037f171efa348f75431c35a50de5ca277b78 | from __future__ import absolute_import
# Copyright (c) 2010-2017 openpyxl
import pytest
from openpyxl.xml.functions import fromstring, tostring
from openpyxl.tests.helper import compare_xml
@pytest.fixture
def GradientFillProperties():
from ..fill import GradientFillProperties
return GradientFillProperties
... | [((565, 591), 'openpyxl.tests.helper.compare_xml', 'compare_xml', (['xml', 'expected'], {}), '(xml, expected)\n', (576, 591), False, 'from openpyxl.tests.helper import compare_xml\n'), ((756, 771), 'openpyxl.xml.functions.fromstring', 'fromstring', (['src'], {}), '(src)\n', (766, 771), False, 'from openpyxl.xml.functio... |
raysect/source | raysect/core/math/function/float/function3d/interpolate/tests/scripts/generate_3d_splines.py | 11f03089d0379fc7fb4d23c6f60c3d255673cec9 |
# Copyright (c) 2014-2021, Dr Alex Meakins, Raysect Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# ... | [((4268, 4369), 'numpy.array', 'np.array', (['[x_lower - x_extrap_delta_max, (x_lower + x_upper) / 2.0, x_upper +\n x_extrap_delta_max]'], {}), '([x_lower - x_extrap_delta_max, (x_lower + x_upper) / 2.0, x_upper +\n x_extrap_delta_max])\n', (4276, 4369), True, 'import numpy as np\n'), ((4419, 4520), 'numpy.array'... |
girish946/supertokens-python | supertokens_python/recipe_module.py | ce0e7f6035941b3a8d3d1f7ae867224fd9c41c3c | # Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.
#
# This software is licensed under the Apache License, Version 2.0 (the
# "License") as published by the Apache Software Foundation.
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at... | [] |
mihaidumitrescu/flake8-html | tests/__init__.py | d5b62c05fb220a5cd6c777feacd69cb726a42e9a | # -*- coding: utf-8 -*-
"""Tests go in this directory."""
| [] |
Yambottle/dj-workflow-template | datajoint-workflow/{{cookiecutter.github_repo}}/src/{{cookiecutter.__pkg_import_name}}/version.py | a47a354af2f9303c898ef403491e69cfc396d196 | __version__ = "{{cookiecutter._pkg_version}}"
| [] |
shibing624/similarities | examples/benchmarking/benchmark_bm25.py | f573ae158b0e2a908c1ef549784bd88e23cbd9c6 | # -*- coding: utf-8 -*-
"""
@author:XuMing(xuming624@qq.com)
@description:
"""
import datetime
import os
import pathlib
import random
import sys
from loguru import logger
sys.path.append('../..')
from similarities import BM25Similarity
from similarities.utils import http_get
from similarities.data_loader import Searc... | [((173, 197), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (188, 197), False, 'import sys\n'), ((378, 393), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (389, 393), False, 'import random\n'), ((2285, 2324), 'random.sample', 'random.sample', (['remaining_corpus', 'sample'], {}),... |
sergachev/verilog-ethernet | tb/test_arp_64.py | cef6b47bb3b969120cabce3b89b0c98bb47ca6a9 | #!/usr/bin/env python
"""
Copyright (c) 2014-2018 Alex Forencich
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,... | [((3245, 3268), 'eth_ep.EthFrameSource', 'eth_ep.EthFrameSource', ([], {}), '()\n', (3266, 3268), False, 'import eth_ep\n'), ((3919, 3940), 'eth_ep.EthFrameSink', 'eth_ep.EthFrameSink', ([], {}), '()\n', (3938, 3940), False, 'import eth_ep\n'), ((4593, 4618), 'axis_ep.AXIStreamSource', 'axis_ep.AXIStreamSource', ([], {... |
ATRS7391/Discord_Nitro_Generator_And_Checker_Python_Version | NitroGenerator.py | 65c6e6e18e640afb4fc433394a9e646c7fe4f4fa | import random
import sys
import subprocess
def pip_install(module: str):
subprocess.run([sys.executable, "-m", "pip", "-q", "--disable-pip-version-check", "install", module])
try:
import requests
except:
print("'requests' module not found! Trying to install... ")
pip_install("requests")... | [((85, 190), 'subprocess.run', 'subprocess.run', (["[sys.executable, '-m', 'pip', '-q', '--disable-pip-version-check',\n 'install', module]"], {}), "([sys.executable, '-m', 'pip', '-q',\n '--disable-pip-version-check', 'install', module])\n", (99, 190), False, 'import subprocess\n'), ((1912, 1956), 'requests.get'... |
sgravrock/adventofcode | 2015/main/13/part2.py | 1f5263ee242c8446ac1c08d2aef195a0a4595ccb | import sys
import itertools
def readfile(f):
result = {}
for line in f:
fields = line.rstrip().split(" ")
p1 = fields[0]
p2 = fields[10].replace(".", "")
n = int(fields[3])
if fields[2] == "lose":
n *= -1
result[(p1, p2)] = n
return result
def optimal(config):
add_self(config)
diners = set([k[0] f... | [] |
bcgrendel/python_networking | networking/connection/stun_client.py | b4c847d9eeeea078868b8dcb3d385e02eb0b8e96 | import socket
import sys
import traceback
import struct
import threading;
from threading import Thread;
import time;
import datetime;
import json
#import buffered_message;
import hashlib
from Crypto.PublicKey import RSA
from connection_state import ConnectionState
# publickey = RSA.importKey(key_string)
import tcp;
im... | [] |
qanat/wpt | tools/wptserve/tests/functional/test_response.py | 7c61a4594a95682531367b6956d1c37f8b8fd486 | import os
import unittest
import json
import types
from http.client import BadStatusLine
from io import BytesIO
import pytest
wptserve = pytest.importorskip("wptserve")
from .base import TestUsingServer, TestUsingH2Server, doc_root
def send_body_as_header(self):
if self._response.add_required_headers:
s... | [((140, 171), 'pytest.importorskip', 'pytest.importorskip', (['"""wptserve"""'], {}), "('wptserve')\n", (159, 171), False, 'import pytest\n'), ((11826, 11841), 'unittest.main', 'unittest.main', ([], {}), '()\n', (11839, 11841), False, 'import unittest\n'), ((603, 657), 'types.MethodType', 'types.MethodType', (['send_bo... |
ks91/bbc1-pub | bbc1/core/command.py | 6b9c33c6c8aec7d410ba9b704eeeb8c3772012d0 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2017 beyond-blockchain.org.
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 l... | [((646, 673), 'sys.path.extend', 'sys.path.extend', (["['../../']"], {}), "(['../../'])\n", (661, 673), False, 'import sys\n'), ((1197, 1224), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'usage': 'usage'}), '(usage=usage)\n', (1211, 1224), False, 'from argparse import ArgumentParser\n')] |
cmcquinn/cmake-uvision-syncer | main.py | 26f34b79b3102a326ced2b0bca2524a98b69abf4 | """
Usage:
main.py [<project>]
Options:
<project> Path to the .uvprojx file (Keil® µVision5 Project File).
The .uvoptx file (Keil® µVision5 Project Options file) will
be located automatically as it shall be adjacent to the
.uvprojx file, having the same filenam... | [((31972, 31987), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (31978, 31987), False, 'from docopt import docopt\n'), ((32619, 32649), 'os.path.realpath', 'os.path.realpath', (['project_path'], {}), '(project_path)\n', (32635, 32649), False, 'import os\n'), ((32054, 32082), 'os.path.isfile', 'os.path.is... |
lesserwhirls/scipy-cwt | scipy/weave/base_spec.py | ee673656d879d9356892621e23ed0ced3d358621 | class base_converter(object):
"""
Properties:
headers -- list of strings that name the header files needed by this
object.
include_dirs -- list of directories where the header files can be found.
libraries -- list of libraries needed to link to when compiling
... | [((2685, 2706), 'base_info.info_list', 'base_info.info_list', ([], {}), '()\n', (2704, 2706), False, 'import base_info\n')] |
latentai/model-zoo-models | xception/test.py | 70a96e955b3b1245f8417613cd9debdae91b1d28 | #!/usr/bin/env python3
from utils.model_config_helpers import run_model_test
run_model_test()
| [((79, 95), 'utils.model_config_helpers.run_model_test', 'run_model_test', ([], {}), '()\n', (93, 95), False, 'from utils.model_config_helpers import run_model_test\n')] |
alexsosn/MultiPlanarUNet | mpunet/bin/cv_split.py | 2d1cecdee391be8e9f72da95e33077ed82a2183a | from glob import glob
import sys
import os
import numpy as np
import random
from mpunet.utils import create_folders
import argparse
def get_parser():
parser = argparse.ArgumentParser(description="Prepare a data folder for a"
"CV experiment setup.")
parser.add_a... | [((165, 256), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Prepare a data folder for aCV experiment setup."""'}), "(description=\n 'Prepare a data folder for aCV experiment setup.')\n", (188, 256), False, 'import argparse\n'), ((2956, 2979), 'os.path.exists', 'os.path.exists', (['ou... |
gczsjdy/daos | src/client/pydaos/raw/conversion.py | abbd900010562f3acea9c6b1dc2ca98a8d3c71fa | #!/usr/bin/python
"""
(C) Copyright 2018 Intel Corporation.
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 ... | [((1866, 1885), 'uuid.UUID', 'uuid.UUID', (['uuidstr2'], {}), '(uuidstr2)\n', (1875, 1885), False, 'import uuid\n')] |
lvapeab/GroundHog_INMT | experiments/nmt/utils/vocabulary_coverage.py | d5ad1d466eaf5040e99b9aaaa1b28c96402436ce | import cPickle
import argparse
parser = argparse.ArgumentParser(
"Computes the coverage of a shortlist in a corpus file")
parser.add_argument("--vocab",
required=True, help="Vocabulary to use (.pkl)")
parser.add_argument("--text",
required=True, help="Beam size, turn... | [] |
diassor/CollectorCity-Market-Place | stores/apps/inventory/migrations/0001_initial.py | 892ad220b8cf1c0fc7433f625213fe61729522b2 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ProductType'
db.create_table('inventory_producttype', (
('id', self.gf('django... | [((389, 440), 'south.db.db.send_create_signal', 'db.send_create_signal', (['"""inventory"""', "['ProductType']"], {}), "('inventory', ['ProductType'])\n", (410, 440), False, 'from south.db import db\n'), ((1480, 1527), 'south.db.db.send_create_signal', 'db.send_create_signal', (['"""inventory"""', "['Product']"], {}), ... |
vi4m/ralph | src/ralph/deployment/migrations/0005_auto__add_field_archiveddeployment_service__add_field_archiveddeployme.py | 2af767ee23d89be9e6cec0a537350a1ce8840bd1 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ArchivedDeployment.service'
db.add_column('deployment_archiveddeployment', 'service',
... | [((1537, 1600), 'south.db.db.delete_column', 'db.delete_column', (['"""deployment_archiveddeployment"""', '"""service_id"""'], {}), "('deployment_archiveddeployment', 'service_id')\n", (1553, 1600), False, 'from south.db import db\n'), ((1675, 1749), 'south.db.db.delete_column', 'db.delete_column', (['"""deployment_arc... |
RLReed/unotran | SPH/sphbwr_example2.py | b317107e1a39490dda732f86a731872f5207a167 | import numpy as np
import sys
sys.path.append('/homes/rlreed/workspace/unotran/src')
from coarseBounds import computeBounds, Grouping
import pickle
from makeDLPbasis import makeBasis as makeDLP
from makeKLTbasis import makeBasis as makeKLT
import sph
import sph_dgm
import pydgm
def buildGEO(ass_map):
fine_map = [... | [((30, 84), 'sys.path.append', 'sys.path.append', (['"""/homes/rlreed/workspace/unotran/src"""'], {}), "('/homes/rlreed/workspace/unotran/src')\n", (45, 84), False, 'import sys\n'), ((612, 625), 'numpy.cumsum', 'np.cumsum', (['cm'], {}), '(cm)\n', (621, 625), True, 'import numpy as np\n'), ((1025, 1101), 'sph_dgm.DGMSO... |
CentroidChef/oci-python-sdk | src/oci/management_agent/models/management_agent_aggregation_dimensions.py | fa406e27a52b40c70e220c20f52dfe2abe6236a3 | # coding: utf-8
# Copyright (c) 2016, 2021, 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... | [((9062, 9087), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (9081, 9087), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n'), ((5437, 5509), 'oci.util.value_allowed_none_or_none_sentinel', 'value_allowed_none_or_none_sentinel',... |
Bashorun97/BuyCoins-Python-SDK | py_buycoins/sending.py | 5b5e1ca6bfbfb56d30e99a737e431ca35b2e712b | from .gcore.queries import GetNetworkFee, GetBalance
from .gcore.mutations import SendCoin
from typing import List, Optional
from .exc import SendLimitError, InvalidClientObject
class Send:
def __init__(self, address: str, cryptocurrency: str, amount: float):
self.address = address
self.cryptocurr... | [] |
yp2800/snippet | snippet/example/python/url.py | 054af596655007cbec81340bd166489e706fffe6 | # -*- coding: utf-8 -*-
try:
from urlparse import urlparse, urlunsplit
except ImportError:
from urllib.parse import urlparse, urlunsplit
class URL(object):
DEFAULT_SCHEME = ["http", "https"]
def __init__(self, url, allowed_scheme=None):
self._url = url
self.url = urlparse(self._url)
... | [((300, 319), 'urllib.parse.urlparse', 'urlparse', (['self._url'], {}), '(self._url)\n', (308, 319), False, 'from urllib.parse import urlparse, urlunsplit\n'), ((886, 936), 'urllib.parse.urlunsplit', 'urlunsplit', (['(scheme, netloc, url, query, fragment)'], {}), '((scheme, netloc, url, query, fragment))\n', (896, 936)... |
tristen-tooming/netvisor-api-client | netvisor_api_client/services/dimension.py | 37c974dc1e6acf1d0bde7e6298b23ca4d14ffd69 | from .base import Service
from ..requests.dimension import CreateDimensionsRequest, DimensionsListRequest
class DimensionService(Service):
def create(self, data):
request = CreateDimensionsRequest(
self.client,
params={'method': 'add'},
data=data
)
retu... | [] |
ONS-SST/cis_households | cishouseholds/filter.py | e475df5929e6763a46cd05aff1f7e960ccbe8e21 | from typing import List
from typing import Union
from pyspark.sql import DataFrame
from pyspark.sql import functions as F
from pyspark.sql.window import Window
def filter_all_not_null(df: DataFrame, reference_columns: List[str]) -> DataFrame:
"""
Filter rows which have NULL values in all the specified column... | [((1529, 1596), 'pyspark.sql.window.Window.partitionBy', 'Window.partitionBy', (['first_reference_column', 'second_reference_column'], {}), '(first_reference_column, second_reference_column)\n', (1547, 1596), False, 'from pyspark.sql.window import Window\n'), ((2994, 3025), 'pyspark.sql.window.Window.partitionBy', 'Win... |
hpc-unibe-ch/reframe | cscs-checks/cuda/multi_gpu.py | 07f97e25cf4e7319782c37dd1923f7e70a368b99 | # Copyright 2016-2020 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
import os
import reframe.utility.sanity as sn
import reframe as rfm
@rfm.required_version('>=2.16-dev0')
@rfm.simple_test
c... | [((266, 301), 'reframe.required_version', 'rfm.required_version', (['""">=2.16-dev0"""'], {}), "('>=2.16-dev0')\n", (286, 301), True, 'import reframe as rfm\n'), ((765, 833), 'os.path.join', 'os.path.join', (['self.current_system.resourcesdir', '"""CUDA"""', '"""essentials"""'], {}), "(self.current_system.resourcesdir,... |
msgoff/sympy | sympy/series/tests/test_demidovich.py | 1e7daef7514902f5e89718fa957b7b36c6669a10 | from sympy import (
limit,
Symbol,
oo,
sqrt,
Rational,
log,
exp,
cos,
sin,
tan,
pi,
asin,
together,
root,
S,
)
# Numbers listed with the tests refer to problem numbers in the book
# "Anti-demidovich, problemas resueltos, Ed. URSS"
x = Symbol("x")
def test_... | [((297, 308), 'sympy.Symbol', 'Symbol', (['"""x"""'], {}), "('x')\n", (303, 308), False, 'from sympy import limit, Symbol, oo, sqrt, Rational, log, exp, cos, sin, tan, pi, asin, together, root, S\n'), ((429, 439), 'sympy.root', 'root', (['x', '(3)'], {}), '(x, 3)\n', (433, 439), False, 'from sympy import limit, Symbol,... |
jfhbrook/notion-tools | notion/ctx.py | dd7c7fb07f98deaf5bba236aa5b4ea3d09ff0f3d | from notion.client import NotionClient
from notion.settings import Settings
class Context:
def __init__(self):
self.settings = Settings.from_file()
self._client = None
def get_client(self):
if not self._client:
self.settings.validate()
self._client = NotionClie... | [((141, 161), 'notion.settings.Settings.from_file', 'Settings.from_file', ([], {}), '()\n', (159, 161), False, 'from notion.settings import Settings\n'), ((310, 367), 'notion.client.NotionClient', 'NotionClient', ([], {'token_v2': 'self.settings.token', 'monitor': '(False)'}), '(token_v2=self.settings.token, monitor=Fa... |
rgooler/bootstrap-pip | setup.py | 34eaa648c81e3f8213b97cd33bda23b50743122a | #!/usr/bin/env python
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def read(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as f:
return f.read()
install_requires = []
# install_re... | [((227, 247), 'os.path.join', 'os.path.join', (['*paths'], {}), '(*paths)\n', (239, 247), False, 'import os\n')] |
carefree0910/carefree-data | cfdata/tabular/converters/__init__.py | ae0f4ea5724b4efd5d76f2a9d420acf3322c1d19 | from .base import *
from .string import *
from .categorical import *
from .numerical import *
__all__ = ["Converter", "converter_dict"]
| [] |
BronWang/first_github | hello_world.py | 9cdd40458014a448a5121268ebca907e3cba1eee | def hello_world():
"""打印Hello world"""
message = 'hello world'
print(message.title())
hello_world()
| [] |
plasroom46/DesignPattern.Sample | Python/Samples/Observer/UtObserver.py | 86c05c5ae356cb01f3d075f248c45da3e6534d07 | import unittest
from Observers import Observer, ObserverMailServer, ObserverPbx
from Subjects import Subject, SubjectEflow
class UtVisitor(unittest.TestCase):
def test_observer(self):
# Create observers
pbx = ObserverPbx()
ms = ObserverMailServer()
# Create subject
... | [((567, 582), 'unittest.main', 'unittest.main', ([], {}), '()\n', (580, 582), False, 'import unittest\n'), ((233, 246), 'Observers.ObserverPbx', 'ObserverPbx', ([], {}), '()\n', (244, 246), False, 'from Observers import Observer, ObserverMailServer, ObserverPbx\n'), ((260, 280), 'Observers.ObserverMailServer', 'Observe... |
Relintai/pandemonium_engine | modules/voxelman/config.py | 3de05db75a396b497f145411f71eb363572b38ae |
def can_build(env, platform):
return True
def configure(env):
pass
def get_doc_classes():
return [
"WorldArea",
"VoxelLight",
"VoxelLightNode",
"VoxelLevelGenerator",
"VoxelLevelGeneratorFlat",
"VoxelSurfaceMerger",
"VoxelSurfaceSimple",
... | [] |
JonoRicci/Advent-Of-Code | Python/2021/day_04/day_04.py | 1c092410d6ece195f4689788af4b1091acf10fbb | """
Day 04
"""
from logger import logger
def main() -> None:
"""
Import the puzzle input, process and display the results.
"""
puzzle_input = import_list()
logger.debug(puzzle_input)
final_score = play_bingo(puzzle_input)
for result in final_score:
logger.info(f"The final score i... | [((180, 206), 'logger.logger.debug', 'logger.debug', (['puzzle_input'], {}), '(puzzle_input)\n', (192, 206), False, 'from logger import logger\n'), ((1236, 1288), 'logger.logger.debug', 'logger.debug', (['f""" Winning numbers: {winning_numbers}"""'], {}), "(f' Winning numbers: {winning_numbers}')\n", (1248, 1288), Fals... |
HPI-Information-Systems/TimeEval | timeeval_experiments/algorithms/eif.py | 9b2717b89decd57dd09e04ad94c120f13132d7b8 | from durations import Duration
from typing import Any, Dict, Optional
from timeeval import Algorithm, TrainingType, InputDimensionality
from timeeval.adapters import DockerAdapter
from timeeval.params import ParameterConfig
_eif_parameters: Dict[str, Dict[str, Any]] = {
"extension_level": {
"defaultValue": None,
... | [((1500, 1631), 'timeeval.adapters.DockerAdapter', 'DockerAdapter', ([], {'image_name': '"""registry.gitlab.hpi.de/akita/i/eif"""', 'skip_pull': 'skip_pull', 'timeout': 'timeout', 'group_privileges': '"""akita"""'}), "(image_name='registry.gitlab.hpi.de/akita/i/eif', skip_pull=\n skip_pull, timeout=timeout, group_pr... |
KEHANG/deepchem | deepchem/models/tf_new_models/graph_models.py | 367bea14cab47b1093bf106e0c196bb02d55c755 | """
Convenience classes for assembling graph models.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "Han Altae-Tran and Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"
import tensorflow as tf
f... | [((893, 903), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (901, 903), True, 'import tensorflow as tf\n'), ((2882, 2892), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (2890, 2892), True, 'import tensorflow as tf\n'), ((966, 987), 'deepchem.models.tf_new_models.graph_topology.GraphTopology', 'GraphTopology', (... |
IIKovalenko/python-sdk | yandex/cloud/access/access_pb2.py | 980e2c5d848eadb42799132b35a9f58ab7b27157 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: yandex/cloud/access/access.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf i... | [((511, 537), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (535, 537), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((3654, 3709), 'google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper', 'enum_type_wrapper.EnumTypeWrapper', (['_ACCESSBINDI... |
SyafiqTermizi/questionbank | questionbank/users/urls.py | 33e58db1a1610a85bd30a85d2f52e819bc27058b | from django.urls import path
from .views import (
UserListView, UserUpdateView, UserProfileView, UserDeleteView,
AcceptInvitationView, SpecialtyListView, SpecialtyCreateView, SpecialtyUpdateView,
SpecialtyDeleteView
)
app_name = 'users'
urlpatterns = [
path('', UserListView.as_view(), name='list'),
... | [] |
Zoufalc/qiskit-machine-learning | qiskit_machine_learning/algorithms/regressors/neural_network_regressor.py | aae3941214cd9667a53b643f229d11d0bff32c60 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | [((6402, 6450), 'numpy.random.rand', 'np.random.rand', (['self._neural_network.num_weights'], {}), '(self._neural_network.num_weights)\n', (6416, 6450), True, 'import numpy as np\n'), ((5164, 5211), 'numpy.zeros', 'np.zeros', (['(1, self._neural_network.num_weights)'], {}), '((1, self._neural_network.num_weights))\n', ... |
fbob/mplFOAM | residuals.py | 90c9a970ba9975ce115ef5a66eb22fc463b54003 | #!/usr/bin/env python
# encoding: utf-8
import sys
import getopt
import re
import os
import pylab as plt
import numpy as np
# Define the variables for which the residuals will be plotted
variables = ["Ux", "Uy", "T", "p_rgh", "k", "epsilon"]
# Get the arguments of the script
def usage():
print("Usage: residuals.... | [((2258, 2290), 'pylab.xlabel', 'plt.xlabel', (['"""Time(s)/Iterations"""'], {}), "('Time(s)/Iterations')\n", (2268, 2290), True, 'import pylab as plt\n'), ((2291, 2326), 'pylab.ylabel', 'plt.ylabel', (['"""Residuals (Log Scale)"""'], {}), "('Residuals (Log Scale)')\n", (2301, 2326), True, 'import pylab as plt\n'), ((2... |
empiricalstateofmind/personal_website | content_generator/vitae.py | cb361f9fd6bd1b1dc8dd39c87cc003d847ae4a2c | # Generate the vitae.json file used to populate the Vitae section of the website.
import pandas as pd
import re
from datetime import datetime
from collections import defaultdict
import json
# Publications
def create_publications(filepath):
publications = pd.read_excel(filepath, sheet_name='publicati... | [((275, 344), 'pandas.read_excel', 'pd.read_excel', (['filepath'], {'sheet_name': '"""publications"""', 'endcoding': '"""utf-8"""'}), "(filepath, sheet_name='publications', endcoding='utf-8')\n", (288, 344), True, 'import pandas as pd\n'), ((416, 433), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n... |
tomekr/cement | cement/ext/ext_generate.py | fece8629c48bcd598fd61d8aa7457a5df4c4f831 | """
Cement generate extension module.
"""
import re
import os
import inspect
import yaml
import shutil
from .. import Controller, minimal_logger, shell
from ..utils.version import VERSION, get_version
LOG = minimal_logger(__name__)
class GenerateTemplateAbstractBase(Controller):
class Meta:
pass
de... | [((3977, 4006), 'shutil.copytree', 'shutil.copytree', (['source', 'dest'], {}), '(source, dest)\n', (3992, 4006), False, 'import shutil\n'), ((4414, 4444), 'os.path.join', 'os.path.join', (['path', '"""generate"""'], {}), "(path, 'generate')\n", (4426, 4444), False, 'import os\n'), ((5491, 5507), 'os.listdir', 'os.list... |
Kvoti/ditto | ditto/core/__init__.py | eb4efb241e54bf679222d14afeb71d9d5441c122 | from . import forms
from . import views
ADMIN_ROLE = "Administrator"
MEMBER_ROLE = "Member"
GUEST_ROLE = "Guest"
DEFAULT_ROLES = [ADMIN_ROLE, MEMBER_ROLE, GUEST_ROLE]
| [] |
salwator/training_stats | training_stats/hrm.py | 3f3bacbaa01e90e8658cf5b66bede42a37e3fb6e | from .gpxfile import get_hr_measurements
from .utils import interpolate
from operator import itemgetter
def __calculate_moving_sums(points, window):
""" Calculates hr moving sums of the window len """
time, hrs = zip(*points)
moving_sum = sum(hrs[0:window])
sums = [(time[0], moving_sum)]
for i, t ... | [((819, 832), 'operator.itemgetter', 'itemgetter', (['(1)'], {}), '(1)\n', (829, 832), False, 'from operator import itemgetter\n')] |
mozilla-releng/staging-mozilla-vpn-client | scripts/utils/import_languages.py | f31d3762a607ccf2d7c6a016f7b800305fbf0113 | #! /usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import xml.etree.ElementTree as ET
import os
import sys
import shutil
import ate... | [((401, 412), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (410, 412), False, 'import os\n'), ((475, 492), 'os.chdir', 'os.chdir', (['workdir'], {}), '(workdir)\n', (483, 492), False, 'import os\n'), ((493, 527), 'atexit.register', 'atexit.register', (['os.chdir', 'prevdir'], {}), '(os.chdir, prevdir)\n', (508, 527), Fa... |
Velgaster/Discord-User-Vote | cogs/filter.py | 4aacc0bf01a11b948fa5355a3775ef8c7ae9751e | from discord.ext import commands
import discord
def setup(client):
client.add_cog(KeyWordFilter(client))
class KeyWordFilter(commands.Cog):
def __init__(self, client):
self.client = client
self.log_ch = self.client.get_channel(int(self.client.SETTINGS.LOG_CHANNEL))
@commands.Cog.listene... | [((300, 323), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (321, 323), False, 'from discord.ext import commands\n'), ((669, 684), 'discord.Embed', 'discord.Embed', ([], {}), '()\n', (682, 684), False, 'import discord\n'), ((708, 728), 'discord.Colour.red', 'discord.Colour.red', ([], {... |
sai-krishna-msk/KickAssist | api/app.py | 7fb256e3ef4beff231332f6491ebb975f3fe4b43 | from ml_model.model import KickModel
import numpy as np
import pandas as pd
import eli5
import joblib
import flask
from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
model_oh = joblib.load('ml_model/estimators/model_oh.sav')
model_hel = joblib.load('ml_model/estimators/model_hel.sav')
e... | [((182, 197), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (187, 197), False, 'from flask import Flask, render_template, request, jsonify\n'), ((210, 257), 'joblib.load', 'joblib.load', (['"""ml_model/estimators/model_oh.sav"""'], {}), "('ml_model/estimators/model_oh.sav')\n", (221, 257), False, 'import ... |
littleK0i/SnowDDL | snowddl/resolver/primary_key.py | b24cb3676e41fec8876d61a101ba242e7272a18f | from snowddl.blueprint import PrimaryKeyBlueprint
from snowddl.resolver.abc_schema_object_resolver import AbstractSchemaObjectResolver, ResolveResult, ObjectType
class PrimaryKeyResolver(AbstractSchemaObjectResolver):
def get_object_type(self) -> ObjectType:
return ObjectType.PRIMARY_KEY
def get_exis... | [] |
tetov/ITA19 | modules/module0/02_datastructures_and_geometry/datastructures_2b.py | 1af68a8885caf83acd98f4136d0286539ccbe63b | import os
import compas
from compas.datastructures import Mesh
from compas_rhino.artists import MeshArtist
HERE = os.path.dirname(__file__)
DATA = os.path.join(HERE, 'data')
FILE = os.path.join(DATA, 'faces.obj')
mesh = Mesh.from_obj(FILE)
artist = MeshArtist(mesh, layer="Mesh")
artist.draw_vertices(
color={ke... | [((116, 141), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (131, 141), False, 'import os\n'), ((149, 175), 'os.path.join', 'os.path.join', (['HERE', '"""data"""'], {}), "(HERE, 'data')\n", (161, 175), False, 'import os\n'), ((183, 214), 'os.path.join', 'os.path.join', (['DATA', '"""faces.ob... |
tankishev/Python | OOP/Exercises/First_steps_in_OOP_Exercises/8_pokemon/project/pokemon.py | 60e511fc901f136b88c681f77f209fe2f8c46447 | # The Pokemon class should receive a name (string) and health (int) upon initialization.
# It should also have a method called pokemon_details that returns the information about the pokemon:
# "{pokemon_name} with health {pokemon_health}"
class Pokemon:
def __init__(self, name: str, health: int) -> None:
... | [] |
ONSdigital/ons_utils | tests/test_pandas.py | 5ff0952c174984deb601af8ad4c21f26c7b24623 | """Tests for the pandas helpers in the pd_helpers.py module."""
import pytest
from pandas.testing import assert_frame_equal
from tests.conftest import create_dataframe
from ons_utils.pandas import *
def test_nested_dict_to_df():
"""Test for nested_dict_to_df."""
input_d = {
'bones': {
'f... | [((1278, 1315), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""test shell"""'}), "(reason='test shell')\n", (1294, 1315), False, 'import pytest\n'), ((1603, 1640), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""test shell"""'}), "(reason='test shell')\n", (1619, 1640), False, 'import pytest\n'... |
seanfisk/lsf-ibutils | lsf_ibutils/ibsub/__init__.py | a22c738376d656ab38f4bfa3572d4693288098cb | """:mod:`lsf_ibutils.ibsub` -- Interactive batch submission utility
"""
| [] |
PaperDevil/pyconfigger | build/lib/configger/fishes/__init__.py | 75c6e3f74e6e70d8ec9565397e2be9ae8815d44e | import os
splited_path = os.path.realpath(__file__).split('\\')[:-1]
fish_path = '\\'.join(splited_path)
fish_json_name = "fish.json"
fish_json_path = os.path.join(fish_path, fish_json_name)
| [((153, 192), 'os.path.join', 'os.path.join', (['fish_path', 'fish_json_name'], {}), '(fish_path, fish_json_name)\n', (165, 192), False, 'import os\n'), ((26, 52), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (42, 52), False, 'import os\n')] |
IntuitionEngineeringTeam/RedBlackPy | setup.py | 99630408153bea7494415c402eb2d9881f3168ee | #
# Created by Soldoskikh Kirill.
# Copyright 2018 Intuition. All rights reserved.
#
import os
import platform
from setuptools import setup
from setuptools.command.build_ext import build_ext
from distutils.extension import Extension
from Cython.Build import cythonize
from rbp_setup_tools.code_generation import gener... | [((1751, 1807), 'rbp_setup_tools.code_generation.generate_from_cython_src', 'generate_from_cython_src', (['src_1', 'output_1', 'TYPES[:-1]', '(0)'], {}), '(src_1, output_1, TYPES[:-1], 0)\n', (1775, 1807), False, 'from rbp_setup_tools.code_generation import generate_from_cython_src\n'), ((1808, 1860), 'rbp_setup_tools.... |
kishan2064/hashpy1 | source/accounts/views.py | 2f8c6fddb07e80e9a7b37a5632ed8ab8bf68d264 | from django.contrib.auth import login, authenticate, REDIRECT_FIELD_NAME, get_user_model
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.views import PasswordResetView as BasePasswordResetView, SuccessURLAllowedHostsMixin
from django.shortcuts impor... | [((1157, 1173), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (1171, 1173), False, 'from django.contrib.auth import login, authenticate, REDIRECT_FIELD_NAME, get_user_model\n'), ((2194, 2224), 'django.utils.decorators.method_decorator', 'method_decorator', (['csrf_protect'], {}), '(csrf_prot... |
INDElab/conversationkg | conversationkg/kgs/writers.py | 8bfe09b0afb4954f633a9287f723c61dcd21ce46 | from ..conversations.corpus import Conversation
from ..conversations.emails import Email
from collections import Counter
import matplotlib
import pandas as pd
import json
class JSONWriter:
def __init__(self, kg):
self.kg = kg
self.entities = kg.entities()
self.triples = kg.triples
... | [((4697, 4846), 'pandas.DataFrame.from_records', 'pd.DataFrame.from_records', (['records'], {'columns': "['type', 'node_type', 'node_id', 'node_u', 'node_t', 'node_dtopic',\n 'node_dtopic_rate', 'lat', 'lng']"}), "(records, columns=['type', 'node_type', 'node_id',\n 'node_u', 'node_t', 'node_dtopic', 'node_dtopic... |
shikew/Handwriting-calculator | model-test.py | 5e0da9f8ceac6dcc815139c6855dfc6fb5af909f | import numpy as np
from PIL import Image
from keras.models import load_model
img_gray = Image.open('1002.png')
number = np.array(img_gray)
print(number.shape)
print('准备的图片的shape:',number.flatten().shape)
print('原number:',number)
number = number.astype('float32')
number = number/255 #归一化
number = number.flatten()
pri... | [((89, 111), 'PIL.Image.open', 'Image.open', (['"""1002.png"""'], {}), "('1002.png')\n", (99, 111), False, 'from PIL import Image\n'), ((121, 139), 'numpy.array', 'np.array', (['img_gray'], {}), '(img_gray)\n', (129, 139), True, 'import numpy as np\n'), ((367, 393), 'keras.models.load_model', 'load_model', (['"""mnist-... |
khrushjing/node-gdal-async | deps/libgdal/gyp-formats/ogr_mem.gyp | 6546b0c8690f2db677d5385b40b407523503b314 | {
"includes": [
"../common.gypi"
],
"targets": [
{
"target_name": "libgdal_ogr_mem_frmt",
"type": "static_library",
"sources": [
"../gdal/ogr/ogrsf_frmts/mem/ogrmemdatasource.cpp",
"../gdal/ogr/ogrsf_frmts/mem/ogrmemlayer.cpp",
"../gdal/ogr/ogrsf_frmts/mem/ogrmemdriver.cpp"
],
"include... | [] |
nantille/iblviewer | iblviewer/volume.py | a5dad67e8f4b99a535297ba0803caf07b1107ca1 | from dataclasses import dataclass, field
from typing import Mapping, List, Any
from datetime import datetime
import logging
import pandas as pd
import glob
import numpy as np
import logging
import os
from collections import OrderedDict
import nrrd
import vtk
import vedo
from vtk.util.numpy_support import numpy_to_vtk
... | [((753, 787), 'dataclasses.field', 'field', ([], {'default_factory': 'unique_name'}), '(default_factory=unique_name)\n', (758, 787), False, 'from dataclasses import dataclass, field\n'), ((841, 874), 'dataclasses.field', 'field', ([], {'default_factory': 'Collection'}), '(default_factory=Collection)\n', (846, 874), Fal... |
LaudateCorpus1/ml-cread | modeling/dataset.py | b5d5aa87faa0ddad0b41b6b0672395a8bf6147ae | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2021 Apple Inc. All Rights Reserved.
#
'''
Dataset file
'''
import sys
import time
import json
import copy
from itertools import chain
from tqdm import tqdm, trange
import torch
from torch.utils.data import DataLoader, RandomSampler
SPECIAL_TOKENS = {... | [((4975, 4987), 'json.load', 'json.load', (['f'], {}), '(f)\n', (4984, 4987), False, 'import json\n'), ((5050, 5095), 'tqdm.tqdm', 'tqdm', (['data'], {'disable': 'self.args.disable_display'}), '(data, disable=self.args.disable_display)\n', (5054, 5095), False, 'from tqdm import tqdm, trange\n'), ((5604, 5626), 'copy.de... |
schuster-rainer/hy | hy/lex/lexer.py | d969ed63d67c4a9070fd41a8fbff35da845e0619 | # Copyright (c) 2013 Nicolas Dandrimont <nicolas.dandrimont@crans.org>
#
# 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,... | [((1169, 1185), 'rply.LexerGenerator', 'LexerGenerator', ([], {}), '()\n', (1183, 1185), False, 'from rply import LexerGenerator\n')] |
solideveloper/afs-210 | week6/shuffle.py | 2ba0bb7c7617cd3169907458f657696a6987689d | # Python provides a built-in method called random.shuffle that will shuffle the list data type. Do not use this.
# For this assignment, you are to create your own shuffle algorithm that will take as input a sorted list and randomly shuffle the items before returning the list. Try to make your algorithm as efficient a... | [((755, 775), 'random.randint', 'random.randint', (['(0)', 'i'], {}), '(0, i)\n', (769, 775), False, 'import random\n')] |
pr3sto/workbox | workbox/workbox/lib/helpers.py | 558147a1a387dcfbe03be0fbc366d1d793364da6 | # -*- coding: utf-8 -*-
"""Template Helpers used in workbox"""
import logging
import socket
from datetime import datetime
from markupsafe import Markup
import psutil
import tg
log = logging.getLogger(__name__)
def current_year():
""" Return current year. """
now = datetime.now()
return now.strftime('%Y... | [((184, 211), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (201, 211), False, 'import logging\n'), ((278, 292), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (290, 292), False, 'from datetime import datetime\n'), ((415, 436), 'psutil.process_iter', 'psutil.process_iter', ([... |
IshitaTakeshi/Tadataka | tadataka/dataset/new_tsukuba.py | 852c7afb904503005e51884408e1492ef0be836f | import csv
import os
from pathlib import Path
from xml.etree import ElementTree as ET
from tqdm import tqdm
from scipy.spatial.transform import Rotation
from skimage.io import imread
import numpy as np
from tadataka.camera import CameraModel, CameraParameters, FOV
from tadataka.dataset.frame import Frame
from tadatak... | [((420, 434), 'xml.etree.ElementTree.parse', 'ET.parse', (['path'], {}), '(path)\n', (428, 434), True, 'from xml.etree import ElementTree as ET\n'), ((680, 714), 'numpy.fromstring', 'np.fromstring', (['depth_text'], {'sep': '""" """'}), "(depth_text, sep=' ')\n", (693, 714), True, 'import numpy as np\n'), ((2450, 2486)... |
enamrik/krogon | krogon/maybe.py | a41a10ed346b7198509929ed9ba1e9fcf778dc78 | from typing import Callable, TypeVar, Union, Tuple
from krogon.infix import Infix
A = TypeVar('A')
B = TypeVar('B')
E = TypeVar('E')
Maybe = Union[Tuple['just', A], Tuple['nothing']]
def just(value=None):
return "just", value
def nothing():
return "nothing", None
def from_value(value) -> Maybe[B]:
r... | [((87, 99), 'typing.TypeVar', 'TypeVar', (['"""A"""'], {}), "('A')\n", (94, 99), False, 'from typing import Callable, TypeVar, Union, Tuple\n'), ((104, 116), 'typing.TypeVar', 'TypeVar', (['"""B"""'], {}), "('B')\n", (111, 116), False, 'from typing import Callable, TypeVar, Union, Tuple\n'), ((121, 133), 'typing.TypeVa... |
EbersonDias/html-css | Python (desafios)/desafio 009.py | b05ec122dc7649656bcfce92dc92ded127bbb2cf | # Desafio 009
# Faça um programa que leia um numero inteiro qualquer
# e mostre na tela a sua tabuada.
n = int(input('digite um numero. '))
r1 = n * 1
r2 = (n * 2)
r3 = (n * 3)
r4 = (n * 4)
r5 = (n * 5)
r6 = (n * 6)
r7 = (n * 7)
r8 = (n * 8)
r9 = (n * 9)
r10 = (n * 10)
print('A Tabuada de {} é'.format(n))
print ('{} x... | [] |
supercatex/TelloEdu | tools/__init__.py | 8f434dbc9866be3025cb119175c40f1d2d7fb5f3 | from tools.TelloEdu import TelloEdu
from tools.Controller import *
from tools.SocketObject import SocketClient | [] |
congnt95/neutron | neutron/agent/ovsdb/native/helpers.py | 6a73a362c5ff5b7c28c15a49f47a9900c0d2b4e1 | # Copyright (c) 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [((861, 909), 'neutron.conf.agent.ovs_conf.register_ovs_agent_opts', 'agent_ovs_conf.register_ovs_agent_opts', (['cfg.CONF'], {}), '(cfg.CONF)\n', (899, 909), True, 'from neutron.conf.agent import ovs_conf as agent_ovs_conf\n'), ((910, 954), 'neutron.conf.plugins.ml2.drivers.ovs_conf.register_ovs_opts', 'ml2_ovs_conf.r... |
kira607/config_loader | conlo/serializer/json_serializer.py | 024f33d48fee1635dfa9ed286f84bb96f22c134a | import json
from .base_serializer import BaseSerializer
class JsonSerializer(BaseSerializer):
'''Json serializer.'''
def _serialize(self, data: dict, **kwargs) -> str:
return json.dumps(data)
def _deserialize(self, data: str, **kwargs) -> dict:
return json.loads(data)
| [((195, 211), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (205, 211), False, 'import json\n'), ((285, 301), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (295, 301), False, 'import json\n')] |
AlBan52/API_weather | console_weather.py | 86779a2da622ad7a4537070e5c28a04235415161 | import requests
locations = ['Лондон', 'Шереметьево', 'Череповец']
payload = {'mnTq': '', 'lang': 'ru'}
for location in locations:
response = requests.get(f'http://wttr.in/{location}', params=payload)
response.raise_for_status()
print(response.text)
| [((148, 206), 'requests.get', 'requests.get', (['f"""http://wttr.in/{location}"""'], {'params': 'payload'}), "(f'http://wttr.in/{location}', params=payload)\n", (160, 206), False, 'import requests\n')] |
Torniojaws/vortech-backend | migrations/versions/576712576c48_added_model_for_photo_comments.py | f775a97eeae089fa720088d86fe92d40bc5d65bc | """Added model for photo comments
Revision ID: 576712576c48
Revises: 75bb906df167
Create Date: 2018-03-30 02:06:22.877079
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '576712576c48'
down_revision = '75bb906df167'
branch_labels = None
depends_o... | [((1124, 1155), 'alembic.op.drop_table', 'op.drop_table', (['"""CommentsPhotos"""'], {}), "('CommentsPhotos')\n", (1137, 1155), False, 'from alembic import op\n'), ((792, 868), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['PhotoID']", "['Photos.PhotoID']"], {'ondelete': '"""CASCADE"""'}), "(['Photo... |
m3sserschmitt/basic-http | __init__.py | bc09a888b44a11154e2cc9bfaf46fc9fd3a79b82 | import basic_http.session
basic_http.session.LIB_VERSION = 'v0.0.4-beta'
basic_http.session.DEFAULT_AGENT = 'basic-http version ' + basic_http.session.LIB_VERSION
| [] |
truthiswill/usaspending-api | usaspending_api/etl/helpers.py | bd7d915442e2ec94cc830c480ceeffd4479be6c0 | from datetime import datetime
import warnings
import logging
from django.db.models import Q, Case, Value, When
from django.core.cache import caches, CacheKeyWarning
import django.apps
from usaspending_api.references.models import Agency, Location, RefCountryCode
from usaspending_api.references.helpers import canonica... | [((463, 511), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'CacheKeyWarning'], {}), "('ignore', CacheKeyWarning)\n", (484, 511), False, 'import warnings\n'), ((3005, 3046), 'usaspending_api.references.helpers.canonicalize_location_dict', 'canonicalize_location_dict', (['location_dict'], {}), '(lo... |
DevAerial/flask-api-template | {{cookiecutter.project_name}}/{{cookiecutter.app_name}}/extensions.py | 6d3f745f2dacb793c4bdc6aaaceb86eb472efe55 | from flask_marshmallow import Marshmallow{% if cookiecutter.use_celery == 'yes'%}
from celery import Celery
celery = Celery(){% endif %}
ma = Marshmallow()
| [] |
young-astronomer/vlpy | code/mapplot.py | 7fd434d307a7cc3593f84a7c6c2f4a4a86865afe | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 21 11:11:56 2020
This program is use to plot polarization map from vlbi fits image.
You should specify the input fits images by -i or --infile,
output file by -o or --output,
contour levs by -l or --levs
contour base by -c or --cmul
polarization... | [((1750, 1812), 'matplotlib.patches.Ellipse', 'Ellipse', (['bpos', 'bmaj', 'bmin'], {'angle': 'bpa', 'ec': '"""k"""', 'facecolor': '"""gray"""'}), "(bpos, bmaj, bmin, angle=bpa, ec='k', facecolor='gray')\n", (1757, 1812), False, 'from matplotlib.patches import Ellipse\n'), ((2222, 2240), 'matplotlib.pyplot.get_cmap', '... |
pizhi/umbrella | umbrella/api/v1/router.py | 95027e6e11a6c8df2ab5f7c202b0c1d2183f839a | # Copyright 2011 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/licenses/LICENSE-2.0
#
# Unless requ... | [((836, 857), 'umbrella.api.v1.api.create_resource', 'api.create_resource', ([], {}), '()\n', (855, 857), False, 'from umbrella.api.v1 import api\n')] |
butala/TomograPy | exemples/test_thomson_simu.py | a1da41f1e0b7406a1b770e56428789c54175de20 | #!/usr/bin/env python
import time
import numpy as np
import tomograpy
import lo
# object
obj = tomograpy.centered_cubic_map(10, 64)
obj[:] = tomograpy.phantom.shepp_logan(obj.shape)
# data
radius = 200
a = tomograpy.fov(obj, radius)
data = tomograpy.centered_stack(a, 128, n_images=60, radius=radius, max_lon=np.pi)
# m... | [((95, 131), 'tomograpy.centered_cubic_map', 'tomograpy.centered_cubic_map', (['(10)', '(64)'], {}), '(10, 64)\n', (123, 131), False, 'import tomograpy\n'), ((141, 181), 'tomograpy.phantom.shepp_logan', 'tomograpy.phantom.shepp_logan', (['obj.shape'], {}), '(obj.shape)\n', (170, 181), False, 'import tomograpy\n'), ((20... |
ulope/geopy | geopy/geocoders/google.py | 605d0d84137a93949ad03820fa31dc2dab77f089 | import logging
from urllib import urlencode
from urllib2 import urlopen
import simplejson
import xml
from xml.parsers.expat import ExpatError
from geopy.geocoders.base import Geocoder
from geopy import Point, Location, util
class Google(Geocoder):
"""Geocoder using the Google Maps API."""
def __init__(... | [] |
hiankun/py_sandbox | interactive_grabcut/repo/drag2draw.py | 6623edd0c8ab17641e1ce09fba7da34c4865fc4f | # source: https://www.youtube.com/watch?v=U0sVp1xLiyo
from tkinter import *
def paint(event):
color = 'red'
x1, y1 = (event.x-1), (event.y-1)
x2, y2 = (event.x+1), (event.y+1)
c.create_oval(x1,y1,x2,y2,fill=color,outline=color)
master = Tk()
c = Canvas(master, width=600, height=400, bg='white')
c.pa... | [] |
lin483/Funny-Nations | migrations/20220114_03_Heqaz-insert-default-serverinfo.py | 2bb1cd23a3d5f1e4a4854c73ac27f62c98127ef6 | """
insert default serverInfo
"""
from yoyo import step
__depends__ = {'20220114_02_lHBKM-new-table-serverinfo'}
steps = [
step("INSERT INTO `serverInfo` (`onlineMinute`) VALUES (0);")
]
| [((130, 191), 'yoyo.step', 'step', (['"""INSERT INTO `serverInfo` (`onlineMinute`) VALUES (0);"""'], {}), "('INSERT INTO `serverInfo` (`onlineMinute`) VALUES (0);')\n", (134, 191), False, 'from yoyo import step\n')] |
slawqo/python-neutronclient | neutronclient/osc/v2/vpnaas/ipsec_site_connection.py | ee08644c5f2424a40c70010dcf0fa2ad84809bfc | # Copyright 2017 FUJITSU LIMITED
# 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 req... | [((1058, 1085), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1075, 1085), True, 'from oslo_log import log as logging\n'), ((5978, 6014), 'neutronclient._i18n._', '_', (['"""Create an IPsec site connection"""'], {}), "('Create an IPsec site connection')\n", (5979, 6014), False, 'fr... |
AlaricGilbert/ArknightsAutoHelper | Arknights/flags.py | 9e2db0c4e0d1be30856df731ab192da396121d94 | TINY_WAIT = 1
SMALL_WAIT = 3
MEDIUM_WAIT = 5
BIG_WAIT = 10
SECURITY_WAIT = 15
BATTLE_FINISH_DETECT = 12
BATTLE_NONE_DETECT_TIME = 90
BATTLE_END_SIGNAL_MAX_EXECUTE_TIME = 15
# 关键动作的偏移
FLAGS_START_BATTLE_BIAS = (50, 25)
FLAGS_ENSURE_TEAM_INFO_BIAS = (25, 50)
# 正方形偏移
FLAGS_CLICK_BIAS_TINY = (3, 3)
FLAGS_CLICK_BIAS_SMAL... | [] |
Conky5/elasticsearch-py | elasticsearch/client/shutdown.py | 93543a7fee51c0da6e898c9155bdb5f965c5bb53 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... | [] |
RechercheTech/sushi-chef-arvind-gupta-toys | sushichef.py | 2b381d8942c16ed16b4a44d8fc020fe0a81a18c0 | #!/usr/bin/env python
import os
import requests
import re
import shutil
from arvind import ArvindVideo, ArvindLanguage, YOUTUBE_CACHE_DIR
from bs4 import BeautifulSoup
from bs4.element import NavigableString
from ricecooker.chefs import SushiChef
from ricecooker.classes.files import YouTubeVideoFile
from ricecooker... | [((522, 533), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (531, 533), False, 'import os\n'), ((551, 591), 'os.path.join', 'os.path.join', (['ROOT_DIR_PATH', '"""downloads"""'], {}), "(ROOT_DIR_PATH, 'downloads')\n", (563, 591), False, 'import os\n'), ((616, 655), 'os.path.join', 'os.path.join', (['DOWNLOADS_PATH', '"""... |
lndba/apasa_backend | api/views/domain.py | e0bb96e22a22f6e2a5a2826f225388113473e7e2 | from rest_framework.viewsets import ModelViewSet,GenericViewSet
from rest_framework.response import Response
from api.serializers.domain import *
from api.pagination.page import MyPageNumberPagination
from api.models import *
class MDomainListViewSet(ModelViewSet):
queryset = MasterDomainName.objects.all().order... | [((779, 803), 'api.pagination.page.MyPageNumberPagination', 'MyPageNumberPagination', ([], {}), '()\n', (801, 803), False, 'from api.pagination.page import MyPageNumberPagination\n'), ((1023, 1036), 'rest_framework.response.Response', 'Response', (['res'], {}), '(res)\n', (1031, 1036), False, 'from rest_framework.respo... |
yuenliou/leetcode | 90-subsets-ii.py | e8a1c6cae6547cbcb6e8494be6df685f3e7c837c | #!/usr/local/bin/python3.7
# -*- coding: utf-8 -*-
from typing import List
class Solution:
def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
"""
题解:https://leetcode-cn.com/problems/subsets/solution/c-zong-jie-liao-hui-su-wen-ti-lei-xing-dai-ni-gao-/
"""
def backtrack(sta... | [] |
climberwb/bert-pli | tools/output_tool.py | 0e6eda7a23b7502c86eab4c0d889fad1bbb57155 | import json
from .accuracy_tool import gen_micro_macro_result
def null_output_function(data, config, *args, **params):
return ""
def basic_output_function(data, config, *args, **params):
which = config.get("output", "output_value").replace(" ", "").split(",")
temp = gen_micro_macro_result(da... | [((414, 448), 'json.dumps', 'json.dumps', (['result'], {'sort_keys': '(True)'}), '(result, sort_keys=True)\n', (424, 448), False, 'import json\n')] |
Vjrx/airship-drydock | python/drydock_provisioner/ingester/plugins/deckhand.py | 315fb9864e6d55a66d5266f76c160be55d22c98b | # Copyright 2017 AT&T Intellectual Property. All other 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... | [((1180, 1218), 'beaker.util.parse_cache_config_options', 'parse_cache_config_options', (['cache_opts'], {}), '(cache_opts)\n', (1206, 1218), False, 'from beaker.util import parse_cache_config_options\n'), ((1334, 1380), 'logging.getLogger', 'logging.getLogger', (['"""drydock.ingester.deckhand"""'], {}), "('drydock.ing... |
nreplogle/ros2-migration-tools | porting_tools/package_xml_porter.py | 8e422731dea52df19da6de780319a17516f60f7c | # Copyright 2019 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://www.apache.org/licenses/LICENSE-2.0
#
# or in the "licens... | [((1008, 1041), 'xml.etree.ElementTree.Element', 'etree.Element', (['tag'], {'attrib': 'attrib'}), '(tag, attrib=attrib)\n', (1021, 1041), True, 'import xml.etree.ElementTree as etree\n'), ((5375, 5401), 'xml.etree.ElementTree.parse', 'etree.parse', (['"""package.xml"""'], {}), "('package.xml')\n", (5386, 5401), True, ... |
giuseppe/quay | endpoints/api/permission_models_interface.py | a1b7e4b51974edfe86f66788621011eef2667e6a | import sys
from abc import ABCMeta, abstractmethod
from collections import namedtuple
from six import add_metaclass
class SaveException(Exception):
def __init__(self, other):
self.traceback = sys.exc_info()
super(SaveException, self).__init__(str(other))
class DeleteException(Exception):
de... | [((456, 489), 'collections.namedtuple', 'namedtuple', (['"""Role"""', "['role_name']"], {}), "('Role', ['role_name'])\n", (466, 489), False, 'from collections import namedtuple\n'), ((606, 715), 'collections.namedtuple', 'namedtuple', (['"""UserPermission"""', "['role_name', 'username', 'is_robot', 'avatar', 'is_org_me... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.