repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
ruslan-ok/ServerApps | apart/search.py | 541aa12f1933054a12f590ce78544178be374669 | from django.db.models import Q
from hier.search import SearchResult
from .models import app_name, Apart, Meter, Bill, Service, Price
def search(user, query):
result = SearchResult(query)
lookups = Q(name__icontains=query) | Q(addr__icontains=query)
items = Apart.objects.filter(user = user.id).filter(l... | [((172, 191), 'hier.search.SearchResult', 'SearchResult', (['query'], {}), '(query)\n', (184, 191), False, 'from hier.search import SearchResult\n'), ((448, 472), 'django.db.models.Q', 'Q', ([], {'info__icontains': 'query'}), '(info__icontains=query)\n', (449, 472), False, 'from django.db.models import Q\n'), ((1301, 1... |
MRebolle/Battery-Robot | pyrevolve/experiment_management.py | 1b97e8c77cf7eff7d5cc7e417b4e5ec97e4011e7 | import os
import shutil
import numpy as np
from pyrevolve.custom_logging.logger import logger
import sys
class ExperimentManagement:
# ids of robots in the name of all types of files are always phenotype ids, and the standard for id is 'robot_ID'
def __init__(self, settings):
self.settings = settings... | [((346, 384), 'os.path.dirname', 'os.path.dirname', (['self.settings.manager'], {}), '(self.settings.manager)\n', (361, 384), False, 'import os\n'), ((419, 510), 'os.path.join', 'os.path.join', (['manager_folder', '"""data"""', 'self.settings.experiment_name', 'self.settings.run'], {}), "(manager_folder, 'data', self.s... |
nudglabs/books-python-wrappers | books/model/Instrumentation.py | 8844eca8fe681542644a70749b72a6dc4e48c171 | #$Id$
class Instrumentation:
"""This class is used tocreate object for instrumentation."""
def __init__(self):
"""Initialize parameters for Instrumentation object."""
self.query_execution_time = ''
self.request_handling_time = ''
self.response_write_time = ''
self.page_c... | [] |
sophiaalthammer/parm | DPR/setup.py | ecf2dce5ee225b18e1ed3736a86696cc81e0797c | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from setuptools import setup
with open("README.md") as f:
readme = f.read()
setup(
name="dpr",
version="... | [((284, 941), 'setuptools.setup', 'setup', ([], {'name': '"""dpr"""', 'version': '"""0.1.0"""', 'description': '"""Facebook AI Research Open Domain Q&A Toolkit"""', 'url': '"""https://github.com/facebookresearch/DPR/"""', 'classifiers': "['Intended Audience :: Science/Research',\n 'License :: OSI Approved :: MIT Lic... |
BillionsRichard/pycharmWorkspace | leetcode/hard/smallest_range/srcs/a_with_ordered_dict.py | 709e2681fc6d85ff52fb25717215a365f51073aa | # encoding: utf-8
"""
@version: v1.0
@author: Richard
@license: Apache Licence
@contact: billions.richard@qq.com
@site:
@software: PyCharm
@time: 2019/9/12 20:37
"""
from pprint import pprint as pp
from operator import itemgetter
import time
from collections import OrderedDict
from hard.smallest_range.srcs.... | [((571, 582), 'time.time', 'time.time', ([], {}), '()\n', (580, 582), False, 'import time\n'), ((858, 869), 'time.time', 'time.time', ([], {}), '()\n', (867, 869), False, 'import time\n'), ((981, 994), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (992, 994), False, 'from collections import OrderedDict\n'... |
davidyum/Particle-Cloud-Framework | pcf/particle/gcp/storage/storage.py | f6325a60a3838f86bd73bf4071438e12f9c68f8d | from pcf.core.gcp_resource import GCPResource
from pcf.core import State
import logging
from google.cloud import storage
from google.cloud import exceptions
logger = logging.getLogger(__name__)
class Storage(GCPResource):
"""
This is the implementation of Google's storage service.
"""
flavor = "stor... | [((167, 194), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (184, 194), False, 'import logging\n')] |
CIMCB/cimcb | cimcb/utils/smooth.py | 5d30f80423ed94e1068871b30e465b38d451581a | import numpy as np
def smooth(a, WSZ):
# a: NumPy 1-D array containing the data to be smoothed
# WSZ: smoothing window size needs, which must be odd number,
# as in the original MATLAB implementation
if WSZ % 2 == 0:
WSZ = WSZ - 1
out0 = np.convolve(a, np.ones(WSZ, dtype=int), 'valid') / W... | [((331, 355), 'numpy.arange', 'np.arange', (['(1)', '(WSZ - 1)', '(2)'], {}), '(1, WSZ - 1, 2)\n', (340, 355), True, 'import numpy as np\n'), ((462, 497), 'numpy.concatenate', 'np.concatenate', (['(start, out0, stop)'], {}), '((start, out0, stop))\n', (476, 497), True, 'import numpy as np\n'), ((283, 306), 'numpy.ones'... |
jmarine/ezeeai | ezeeai/core/extensions/best_exporter.py | 091b4ce3bc5794c534084bff3301b15ba8a9be1a | from __future__ import absolute_import
import abc
import os
import json
import glob
import shutil
from tensorflow.python.estimator import gc
from tensorflow.python.estimator import util
from tensorflow.python.estimator.canned import metric_keys
from tensorflow.python.framework import errors_impl
from tensorflow.pytho... | [((627, 651), 'tensorflow.python.estimator.util.fn_args', 'util.fn_args', (['compare_fn'], {}), '(compare_fn)\n', (639, 651), False, 'from tensorflow.python.estimator import util\n'), ((6454, 6529), 'tensorflow.python.estimator.exporter._SavedModelExporter', '_SavedModelExporter', (['name', 'serving_input_receiver_fn',... |
mgorny/pkgcore | src/pkgcore/restrictions/restriction.py | ab4a718aa1626f4edeb385383f5595a1e262b0dc | # Copyright: 2005-2012 Brian Harring <ferringb@gmail.com
# Copyright: 2006 Marien Zwart <marienz@gentoo.org>
# License: BSD/GPL2
"""
base restriction class
"""
from functools import partial
from snakeoil import caching, klass
from snakeoil.currying import pretty_docs
class base(object, metaclass=caching.WeakInstMe... | [((4966, 4999), 'functools.partial', 'partial', (['cls'], {'node_type': 'node_type'}), '(cls, node_type=node_type)\n', (4973, 4999), False, 'from functools import partial\n'), ((5214, 5238), 'snakeoil.currying.pretty_docs', 'pretty_docs', (['result', 'doc'], {}), '(result, doc)\n', (5225, 5238), False, 'from snakeoil.c... |
kkaarreell/keylime | keylime/migrations/versions/8da20383f6e1_extend_ip_field.py | e12658bb6dc945b694e298b8ac337a204ab86ed2 | """extend_ip_field
Revision ID: 8da20383f6e1
Revises: eeb702f77d7d
Create Date: 2021-01-14 10:50:56.275257
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "8da20383f6e1"
down_revision = "eeb702f77d7d"
branch_labels = None
depends_on = None
def upgrade(engine_n... | [((557, 593), 'alembic.op.batch_alter_table', 'op.batch_alter_table', (['"""verifiermain"""'], {}), "('verifiermain')\n", (577, 593), False, 'from alembic import op\n'), ((670, 690), 'sqlalchemy.String', 'sa.String', ([], {'length': '(15)'}), '(length=15)\n', (679, 690), True, 'import sqlalchemy as sa\n'), ((698, 719),... |
Tatsuya26/processamento_de_linguagens | token_train/quickdemo(1)(1).py | e89ab8461bcf3264a79f10b7ebc2208eff271c6c | import ply.lex as lex
tokens =["NUM","OPERADORES"]
t_NUM = '\d+'
t_OPERADORES = '[+|*|-]'
t_ignore='\n\t '
def t_error(t):
print("Erro")
print(t)
lexer = lex.lex()
# 1+2 1-2 1*2
# ola mundo
import sys
for line in sys.stdin:
lexer.input(line)
for tok in lexer:
print(tok) | [((167, 176), 'ply.lex.lex', 'lex.lex', ([], {}), '()\n', (174, 176), True, 'import ply.lex as lex\n')] |
Ecotrust/ucsrb | ucsrb/migrations/0013_auto_20180710_2040.py | 29d97cf1f21537aaf24f38e7dedc7c8cfccf1f12 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-07-10 20:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ucsrb', '0012_auto_20180710_1249'),
]
operations = [
migrations.AddField(
... | [((415, 449), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (434, 449), False, 'from django.db import migrations, models\n'), ((598, 651), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'default': 'None', 'null': '(True)'}), '(blan... |
fei-protocol/checkthechain | src/ctc/protocols/fei_utils/analytics/payload_crud.py | ec838f3d0d44af228f45394d9ba8d8eb7f677520 | from __future__ import annotations
import typing
from ctc import spec
from . import timestamp_crud
from . import metric_crud
from . import analytics_spec
async def async_create_payload(
*,
blocks: typing.Sequence[spec.BlockNumberReference] | None = None,
timestamps: typing.Sequence[int] | None = None,
... | [] |
mbz/models | research/video_prediction/prediction_model.py | 98dcd8dbcb1027e4b22f79113018df30da4b8590 | # Copyright 2016 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [((14752, 14879), 'tensorflow.contrib.slim.layers.fully_connected', 'slim.layers.fully_connected', (['cdna_input', '(DNA_KERN_SIZE * DNA_KERN_SIZE * num_masks)'], {'scope': '"""cdna_params"""', 'activation_fn': 'None'}), "(cdna_input, DNA_KERN_SIZE * DNA_KERN_SIZE *\n num_masks, scope='cdna_params', activation_fn=No... |
prashantsharma04/bazel_java_rules | junit5/rules.bzl | 4f80fbe70e1778aa8e3e0ee8aa2f1efc3e44a462 | load("@rules_jvm_external//:defs.bzl", "artifact")
# For more information see
# - https://github.com/bmuschko/bazel-examples/blob/master/java/junit5-test/BUILD
# - https://github.com/salesforce/bazel-maven-proxy/tree/master/tools/junit5
# - https://github.com/junit-team/junit5-samples/tree/master/junit5-jupiter-starte... | [] |
fangedward/pylot | tests/mocked_carla.py | a742b3789ee8e7fa2d692ae22bda1e2960ed9345 | # This module provides mocked versions of classes and functions provided
# by Carla in our runtime environment.
class Location(object):
""" A mock class for carla.Location. """
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
class Rotation(object):
""" A mock class... | [] |
Zweizack/fuzzy-rainbow | rgb_to_cmyk.py | f69f7eb59971d28a9093a03c1911b41e23cddf2a | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
ee = '\033[1m'
green = '\033[32m'
yellow = '\033[33m'
cyan = '\033[36m'
line = cyan+'-' * 0x2D
print(ee+line)
R,G,B = [float(X) / 0xFF for X in input(f'{yellow}RGB: {green}').split()]
K = 1-max(R,G,B)
C,M,Y = [round(float((1-X-K)/(1-K) * 0x64),1) for X in [R,G,B]]
K = r... | [] |
JukeboxPipeline/jukedj | docs/updatedoc.py | d4159961c819c26792a278981ee68106ee15f3f3 | #!/usr/bin/env python
"""Builds the documentaion. First it runs gendoc to create rst files for the source code. Then it runs sphinx make.
.. Warning:: This will delete the content of the output directory first! So you might loose data.
You can use updatedoc.py -nod.
Usage, just call::
updatedoc.py -h
"... | [] |
vitormrts/sorting-algorithms | sort/selectionsort.py | 5571ce522a7fd33f976fa05b264ed2c253c221b3 | def selection_sort(A): # O(n^2)
n = len(A)
for i in range(n-1): # percorre a lista
min = i
for j in range(i+1, n): # encontra o menor elemento da lista a partir de i + 1
if A[j] < A[min]:
min = j
A[i], A[min] = A[min], A[i] # insere o elemento na posicao corre... | [] |
manuel1618/bridgeOptimizer | BridgeOptimizer/scriptBuilder/ScriptBuilderBoundaryConditions.py | 273bbf27b2c6273e4aaca55debbd9a10bebf7042 | import os
from typing import List, Tuple
from BridgeOptimizer.datastructure.hypermesh.LoadCollector import LoadCollector
from BridgeOptimizer.datastructure.hypermesh.LoadStep import LoadStep
from BridgeOptimizer.datastructure.hypermesh.Force import Force
from BridgeOptimizer.datastructure.hypermesh.SPC import SPC
cla... | [] |
islamspahic/python-uup | Lekcija08/script01.py | ea7c9c655ad8e678bca5ee52138836732266799f | tajniBroj = 51
broj = 2
while tajniBroj != broj:
broj = int(input("Pogodite tajni broj: "))
if tajniBroj == broj:
print("Pogodak!")
elif tajniBroj < broj:
print("Tajni broj je manji od tog broja.")
else:
print("Tajni broj je veci od tog broja.")
print("Kraj programa")
| [] |
FrostByte266/neupy | tests/algorithms/memory/test_cmac.py | 4b7127e5e4178b0cce023ba36542f5ad3f1d798c | import numpy as np
from sklearn import metrics
from neupy import algorithms
from base import BaseTestCase
class CMACTestCase(BaseTestCase):
def test_cmac(self):
X_train = np.reshape(np.linspace(0, 2 * np.pi, 100), (100, 1))
X_train_before = X_train.copy()
X_test = np.reshape(np.linspace(... | [((371, 386), 'numpy.sin', 'np.sin', (['X_train'], {}), '(X_train)\n', (377, 386), True, 'import numpy as np\n'), ((444, 458), 'numpy.sin', 'np.sin', (['X_test'], {}), '(X_test)\n', (450, 458), True, 'import numpy as np\n'), ((475, 563), 'neupy.algorithms.CMAC', 'algorithms.CMAC', ([], {'quantization': '(100)', 'associ... |
Smotko/ggrc-core | src/ggrc_workflows/models/task_group_object.py | b3abb58b24e7559960d71a94ba79c75539e7fe29 | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from sqlalchemy.ext.associationproxy import association_proxy
from ggrc import db... | [((653, 690), 'ggrc.db.Column', 'db.Column', (['db.Integer'], {'nullable': '(False)'}), '(db.Integer, nullable=False)\n', (662, 690), False, 'from ggrc import db\n'), ((707, 743), 'ggrc.db.Column', 'db.Column', (['db.String'], {'nullable': '(False)'}), '(db.String, nullable=False)\n', (716, 743), False, 'from ggrc impo... |
ahmednofal/DFFRAM | verification/tb_template.py | 7d7ebc28befe12ec3f232c0d2f5b8ea786227d45 | # Copyright ©2020-2021 The American University in Cairo and the Cloud V Project.
#
# This file is part of the DFFRAM Memory Compiler.
# See https://github.com/Cloud-V/DFFRAM for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... | [] |
krystianbajno/stocks | services/stocks-api/app/api/clients/coinbase/CoinbaseResponse.py | 0a1a9283cb6debe36cfe01308eb4bc0b85217a02 | class CoinbaseResponse:
bid = 0
ask = 0
product_id = None
def set_bid(self, bid):
self.bid = float(bid)
def get_bid(self):
return self.bid
def set_ask(self, ask):
self.ask = float(ask)
def get_ask(self):
return self.ask
def get_product_id(self):
... | [] |
bzah/xclim | xclim/indices/_anuclim.py | 18ceee3f1db2d39355913c1c60ec32ddca6baccc | # noqa: D100
from typing import Optional
import numpy as np
import xarray
from xclim.core.units import (
convert_units_to,
declare_units,
pint_multiply,
rate2amount,
units,
units2pint,
)
from xclim.core.utils import ensure_chunk_size
from ._multivariate import (
daily_temperature_range,
... | [((1421, 1482), 'xclim.core.units.declare_units', 'declare_units', ([], {'tasmin': '"""[temperature]"""', 'tasmax': '"""[temperature]"""'}), "(tasmin='[temperature]', tasmax='[temperature]')\n", (1434, 1482), False, 'from xclim.core.units import convert_units_to, declare_units, pint_multiply, rate2amount, units, units2... |
vhrspvl/vhrs-bvs | bvs/background_verification/report/checks_status_report/checks_status_report.py | 56667039d9cc09ad0b092e5e6c5dd6598ff41e7b | # Copyright (c) 2013, VHRS and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, msgprint
from frappe.utils import (cint, cstr, date_diff, flt, getdate, money_in_words,
nowdate, rounded, today)
from datet... | [((751, 799), 'frappe.get_doc', 'frappe.get_doc', (['"""Checks Group"""', 'app.checks_group'], {}), "('Checks Group', app.checks_group)\n", (765, 799), False, 'import frappe\n'), ((12871, 12888), 'frappe._', '_', (['"""Project Name"""'], {}), "('Project Name')\n", (12872, 12888), False, 'from frappe import _, msgprint\... |
TeamOfProfGuo/few_shot_baseline | dataset/dataset.py | f9ac87b9d309fc417589350d3ce61d3612e2be91 | import os
DEFAULT_ROOT = './materials'
datasets_dt = {}
def register(name):
def decorator(cls):
datasets_dt[name] = cls
return cls
return decorator
def make(name, **kwargs):
if kwargs.get('root_path') is None:
kwargs['root_path'] = os.path.join(DEFAULT_ROOT, name)
dataset =... | [((274, 306), 'os.path.join', 'os.path.join', (['DEFAULT_ROOT', 'name'], {}), '(DEFAULT_ROOT, name)\n', (286, 306), False, 'import os\n')] |
YiXiaoCuoHuaiFenZi/proto-formatter | src/proto_formatter/syntax_parser.py | ac8c913a8c3854e840aa4f015c026e58ee023b0b | from .comment import CommentParser
from .protobuf import Protobuf
from .proto_structures import Syntax
class SyntaxParser():
@classmethod
def parse_and_add(cls, proto_obj: Protobuf, line, top_comment_list):
if proto_obj.syntax is not None:
raise 'multiple syntax detected!'
proto_... | [] |
mgp-git/Flask | IPL/app/core/views.py | f56be0192a3aac550a1dae46394352a68bd53d3d | from flask import render_template, request, Blueprint
core = Blueprint('core', __name__)
@core.route("/", methods=['GET', 'POST'])
def home():
return render_template('home.html')
@core.route("/about")
def about():
return render_template('about.html')
@core.route('/search', methods=['GET', 'POST'])
def se... | [((62, 89), 'flask.Blueprint', 'Blueprint', (['"""core"""', '__name__'], {}), "('core', __name__)\n", (71, 89), False, 'from flask import render_template, request, Blueprint\n'), ((157, 185), 'flask.render_template', 'render_template', (['"""home.html"""'], {}), "('home.html')\n", (172, 185), False, 'from flask import ... |
tdilauro/circulation-core | tests/test_s3.py | 8086ca8cbedd5f4b2a0c44df97889d078ff79aac | # encoding: utf-8
import functools
import os
from urllib.parse import urlsplit
import boto3
import botocore
import pytest
from botocore.exceptions import BotoCoreError, ClientError
from mock import MagicMock
from parameterized import parameterized
from ..mirror import MirrorUploader
from ..model import (
DataSour... | [((3093, 3170), 'os.environ.get', 'os.environ.get', (['"""SIMPLIFIED_TEST_MINIO_ENDPOINT_URL"""', '"""http://localhost:9000"""'], {}), "('SIMPLIFIED_TEST_MINIO_ENDPOINT_URL', 'http://localhost:9000')\n", (3107, 3170), False, 'import os\n'), ((3218, 3276), 'os.environ.get', 'os.environ.get', (['"""SIMPLIFIED_TEST_MINIO_... |
vanshdevgan/lbry-sdk | lbry/scripts/set_build.py | 3624a3b450945235edcf76971e18c898fba67455 | """Set the build version to be 'qa', 'rc', 'release'"""
import sys
import os
import re
import logging
log = logging.getLogger()
log.addHandler(logging.StreamHandler())
log.setLevel(logging.DEBUG)
def get_build_type(travis_tag=None):
if not travis_tag:
return "qa"
log.debug("getting build type for ta... | [((110, 129), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (127, 129), False, 'import logging\n'), ((145, 168), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (166, 168), False, 'import logging\n'), ((351, 401), 're.match', 're.match', (['"""v\\\\d+\\\\.\\\\d+\\\\.\\\\d+rc\\\\d+$"""'... |
gbl1124/hfrd | backend/jenkins/pipelines/ansible/utils/testplan_gen.py | 327d7c1e18704d2e31a2649b40ae1d90353ebe24 |
#!/usr/bin/python
import yaml
import os
import ast
import sys
from collections import OrderedDict
curr_dir = os.getcwd()
work_dir = sys.argv[1]
network_type = sys.argv[2]
testplan_dict = {}
testplan_dict["name"] = "System performance test"
testplan_dict["description"] = "This test is to create as much chaincode com... | [] |
cyber-fighters/dblib | dblib/test_lib.py | 9743122a55bc265f7551dd9283f381678b2703e4 | """Collection of tests."""
import pytest
import dblib.lib
f0 = dblib.lib.Finding('CD spook', 'my_PC', 'The CD drive is missing.')
f1 = dblib.lib.Finding('Unplugged', 'my_PC', 'The power cord is unplugged.')
f2 = dblib.lib.Finding('Monitor switched off', 'my_PC', 'The monitor is switched off.')
def test_add_remove(... | [((797, 821), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeError)\n', (810, 821), False, 'import pytest\n')] |
YuanyuanNi/azure-cli | src/azure-cli/azure/cli/command_modules/policyinsights/_completers.py | 63844964374858bfacd209bfe1b69eb456bd64ca | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [((695, 727), 'azure.cli.core.commands.client_factory.get_subscription_id', 'get_subscription_id', (['cmd.cli_ctx'], {}), '(cmd.cli_ctx)\n', (714, 727), False, 'from azure.cli.core.commands.client_factory import get_subscription_id\n'), ((1497, 1519), 'azure.mgmt.policyinsights.models.QueryOptions', 'QueryOptions', ([]... |
CodeBrew-LTD/django-hordak | hordak/migrations/0011_auto_20170225_2222.py | efdfe503bf38b0a283790c5b4d27bd6bb28155e4 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-25 22:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_smalluuid.models
class Migration(migrations.Migration):
dependencies = [("hordak",... | [((524, 617), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (540, 617), False, 'from django.db import migrations, models\... |
devilnotcry77/devil_not_cry | Bot Telegram.py | a9d342d053c788ec6db2d1c5967ed55104b40045 | from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
TOKEN = "Token for you bot"
bot = Bot(token=TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(command=['start', 'help'])
async def send_welcome(msg: types.Message):
await msg.reply_to_message(f'Добро ... | [((146, 162), 'aiogram.Bot', 'Bot', ([], {'token': 'TOKEN'}), '(token=TOKEN)\n', (149, 162), False, 'from aiogram import Bot, types\n'), ((169, 184), 'aiogram.dispatcher.Dispatcher', 'Dispatcher', (['bot'], {}), '(bot)\n', (179, 184), False, 'from aiogram.dispatcher import Dispatcher\n'), ((620, 646), 'aiogram.utils.ex... |
danlgz/django-wysiwyg-redactor | redactor/utils.py | 755927ea2cb9db203c4a002b4da7ebfbf989dd64 | from django.core.exceptions import ImproperlyConfigured
from importlib import import_module
try:
from django.utils.encoding import force_text
except ImportError:
from django.utils.encoding import force_unicode as force_text
from django.utils.functional import Promise
import json
def import_class(path):
... | [((582, 608), 'importlib.import_module', 'import_module', (['module_path'], {}), '(module_path)\n', (595, 608), False, 'from importlib import import_module\n'), ((1364, 1397), 'json.dumps', 'json.dumps', (['data'], {'cls': 'LazyEncoder'}), '(data, cls=LazyEncoder)\n', (1374, 1397), False, 'import json\n'), ((460, 489),... |
DrGFreeman/PyTools | timedpid.py | 795e06b5a07f49a990df3c545d2d103b16dd8b4d | # timedpid.py
# Source: https://github.com/DrGFreeman/PyTools
#
# MIT License
#
# Copyright (c) 2017 Julien de la Bruere-Terreault <drgfreeman@tuta.io>
#
# 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 th... | [((1876, 1887), 'time.time', 'time.time', ([], {}), '()\n', (1885, 1887), False, 'import time\n'), ((2996, 3007), 'time.time', 'time.time', ([], {}), '()\n', (3005, 3007), False, 'import time\n'), ((4658, 4669), 'time.time', 'time.time', ([], {}), '()\n', (4667, 4669), False, 'import time\n')] |
bernd-clemenz/pmon | pmon/zmq_responder.py | 8b61de4864ffed2d7ee224c283090ed1948533ae | #
# -*- coding: utf-8-*-
# receives messages via zmq and executes some simple
# operations.
#
# (c) ISC Clemenz & Weinbrecht GmbH 2018
#
import json
import requests
import zmq
import pmon
class ZmqResponder(object):
context = None
socket = None
def __init__(self):
"""
Constructor.
... | [((693, 707), 'zmq.Context', 'zmq.Context', (['(1)'], {}), '(1)\n', (704, 707), False, 'import zmq\n'), ((1160, 1176), 'json.loads', 'json.loads', (['_msg'], {}), '(_msg)\n', (1170, 1176), False, 'import json\n'), ((2287, 2336), 'requests.post', 'requests.post', (['url'], {'data': 'payload', 'headers': 'headers'}), '(u... |
sanskrit/padmini | test/test_substitute.py | 8e7e8946a7d2df9c941f689ea4bc7b6ebb7ca1d0 | from padmini import operations as op
def test_yatha():
before = ("tAs", "Tas", "Ta", "mip")
after = ("tAm", "tam", "ta", "am")
for i, b in enumerate(before):
assert op.yatha(b, before, after) == after[i]
"""
def test_ti():
assert S.ti("ta", "e") == "te"
assert S.ti("AtAm", "e") == "Ate"... | [((188, 214), 'padmini.operations.yatha', 'op.yatha', (['b', 'before', 'after'], {}), '(b, before, after)\n', (196, 214), True, 'from padmini import operations as op\n')] |
kmhambleton/LSST-TVSSC.github.io | TVSaffiliations/extractemails_nogui.py | 2391fcdeddf83321825532aa7d7682b5dcf567f0 | # coding: utf-8
#just prints the emails of members of a group to stdout,
#both primary and secondary members
# run as
# $python extractemails_nogui.py "Tidal Disruption Events"
from __future__ import print_function
'__author__' == 'Federica Bianco, NYU - GitHub: fedhere'
import sys
import pandas as pd
from argparse im... | [((604, 663), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Selecting members by subgroup"""'}), "(description='Selecting members by subgroup')\n", (618, 663), False, 'from argparse import ArgumentParser\n'), ((1147, 1257), 'pandas.read_csv', 'pd.read_csv', (["('https://docs.google.com/spreadshe... |
Obsidian-Development/JDBot | cogs/owner.py | 315b0782126ac36fe934ac3ba2d7132710d58651 | from discord.ext import commands, menus
import utils
import random , discord, os, importlib, mystbin, typing, aioimgur, functools, tweepy
import traceback, textwrap
from discord.ext.menus.views import ViewMenuPages
class Owner(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(brief="a c... | [((293, 341), 'discord.ext.commands.command', 'commands.command', ([], {'brief': '"""a command to send mail"""'}), "(brief='a command to send mail')\n", (309, 341), False, 'from discord.ext import commands, menus\n'), ((1418, 1436), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (1434, 1436), Fal... |
valassi/mg5amc_test | tests/input_files/full_sm_UFO/function_library.py | 2e04f23353051f64e1604b23105fe3faabd32869 | # This file is part of the UFO.
#
# This file contains definitions for functions that
# are extensions of the cmath library, and correspond
# either to functions that are in cmath, but inconvenient
# to access from there (e.g. z.conjugate()),
# or functions that are simply not defined.
#
#
from __future__ import absol... | [] |
hackerwins/polyaxon | cli/polyaxon/managers/cli.py | ff56a098283ca872abfbaae6ba8abba479ffa394 | #!/usr/bin/python
#
# Copyright 2019 Polyaxon, 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 o... | [((2323, 2359), 'distutils.version.LooseVersion', 'LooseVersion', (['config.current_version'], {}), '(config.current_version)\n', (2335, 2359), False, 'from distutils.version import LooseVersion\n'), ((2362, 2394), 'distutils.version.LooseVersion', 'LooseVersion', (['config.min_version'], {}), '(config.min_version)\n',... |
fossabot/duckql-python | duckql/properties/tests/test_null.py | b4aead825ee456d9758db89830c7bca9d5d5106e | import pytest
from duckql.properties import Null
@pytest.fixture(scope="module")
def valid_instance() -> Null:
return Null()
def test_string(valid_instance: Null):
assert str(valid_instance) == 'NULL'
def test_obj(valid_instance: Null):
assert valid_instance.obj == 'properties.Null'
def test_json_p... | [((53, 83), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (67, 83), False, 'import pytest\n'), ((125, 131), 'duckql.properties.Null', 'Null', ([], {}), '()\n', (129, 131), False, 'from duckql.properties import Null\n')] |
sotaoverride/backup | openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/lib/gobject-introspection/giscanner/codegen.py | ca53a10b72295387ef4948a9289cb78ab70bc449 | # -*- Mode: Python -*-
# GObject-Introspection - a framework for introspecting GObject libraries
# Copyright (C) 2010 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; eith... | [((5221, 5266), 'os.path.relpath', 'os.path.relpath', (['self.out_h_filename', 'src_dir'], {}), '(self.out_h_filename, src_dir)\n', (5236, 5266), False, 'import os\n'), ((5169, 5202), 'os.path.realpath', 'os.path.realpath', (['self.out_c.name'], {}), '(self.out_c.name)\n', (5185, 5202), False, 'import os\n')] |
mehrdad-shokri/nevergrad | nevergrad/parametrization/utils.py | 7b68b00c158bf60544bc45997560edf733fb5812 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import sys
import shutil
import tempfile
import subprocess
import typing as tp
from pathlib import Path
from ne... | [((2787, 2817), 'os.environ.get', 'os.environ.get', (['self.key', 'None'], {}), '(self.key, None)\n', (2801, 2817), False, 'import os\n'), ((2902, 2917), 'pathlib.Path', 'Path', (['self.name'], {}), '(self.name)\n', (2906, 2917), False, 'from pathlib import Path\n'), ((4849, 4973), 'subprocess.Popen', 'subprocess.Popen... |
airbornum/-Complete-Python-Scripting-for-Automation | Section 20/2.Document-transfer_files.py | bc053444f8786259086269ca1713bdb10144dd74 | import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname='54.165.97.91',username='ec2-user',password='paramiko123',port=22)
sftp_client=ssh.open_sftp()
#sftp_client.get('/home/ec2-user/paramiko_download.txt','paramiko_downloaded_file.txt')
#sftp_c... | [((23, 43), 'paramiko.SSHClient', 'paramiko.SSHClient', ([], {}), '()\n', (41, 43), False, 'import paramiko\n'), ((77, 101), 'paramiko.AutoAddPolicy', 'paramiko.AutoAddPolicy', ([], {}), '()\n', (99, 101), False, 'import paramiko\n')] |
gmpreussner/Varriount.NimLime | nimlime_core/utils/internal_tools.py | 33da0424248bf9360c2a7cbca4a22da7a8020785 | # coding=utf-8
"""
Internal tools for NimLime development & testing.
"""
from pprint import pprint
import sublime
try:
from cProfile import Profile
except ImportError:
from profile import Profile
from functools import wraps
from pstats import Stats
try:
from StringIO import StringIO
except ImportError:
... | [((658, 667), 'profile.Profile', 'Profile', ([], {}), '()\n', (665, 667), False, 'from profile import Profile\n'), ((382, 438), 'sublime.message_dialog', 'sublime.message_dialog', (['"""NimLime running in debug mode."""'], {}), "('NimLime running in debug mode.')\n", (404, 438), False, 'import sublime\n'), ((892, 903),... |
dmvieira/driftage | test/unit/test_monitor.py | 830188aa341029cc2a643b2b3b50e625953a35eb | import orjson
from asynctest import TestCase, Mock, patch
from freezegun import freeze_time
from driftage.monitor import Monitor
class TestMonitor(TestCase):
def setUp(self):
self.monitor = Monitor(
"user_test@local", "pass_test", "identif"
)
def tearDown(self):
self.mon... | [((709, 759), 'asynctest.patch', 'patch', (['"""driftage.monitor.WaitMonitorSubscriptions"""'], {}), "('driftage.monitor.WaitMonitorSubscriptions')\n", (714, 759), False, 'from asynctest import TestCase, Mock, patch\n'), ((1020, 1045), 'freezegun.freeze_time', 'freeze_time', (['"""1989-08-12"""'], {}), "('1989-08-12')\... |
travisluong/fastarg | examples/todo_advanced/main.py | b21d5307ce6b296aa16f30bf220ca2ead8e9d4d3 | import fastarg
import commands.todo as todo
import commands.user as user
app = fastarg.Fastarg(description="productivity app", prog="todo")
@app.command()
def hello_world(name: str):
"""hello world"""
print("hello " + name)
app.add_fastarg(todo.app, name="todo")
app.add_fastarg(user.app, name="user")
if __n... | [((80, 140), 'fastarg.Fastarg', 'fastarg.Fastarg', ([], {'description': '"""productivity app"""', 'prog': '"""todo"""'}), "(description='productivity app', prog='todo')\n", (95, 140), False, 'import fastarg\n')] |
rwilhelm/aiormq | tests/test_channel.py | 9aa278e61d16ba18748f5f5a3fc76d0a273fd14a | import asyncio
import uuid
import pytest
from aiomisc_pytest.pytest_plugin import TCPProxy
import aiormq
async def test_simple(amqp_channel: aiormq.Channel):
await amqp_channel.basic_qos(prefetch_count=1)
assert amqp_channel.number
queue = asyncio.Queue()
deaclare_ok = await amqp_channel.queue_dec... | [((257, 272), 'asyncio.Queue', 'asyncio.Queue', ([], {}), '()\n', (270, 272), False, 'import asyncio\n'), ((1354, 1369), 'asyncio.Queue', 'asyncio.Queue', ([], {}), '()\n', (1367, 1369), False, 'import asyncio\n'), ((3581, 3596), 'asyncio.Queue', 'asyncio.Queue', ([], {}), '()\n', (3594, 3596), False, 'import asyncio\n... |
culbertm/NSttyPython | nitro-python/nssrc/com/citrix/netscaler/nitro/resource/stat/mediaclassification/__init__.py | ff9f6aedae3fb8495342cd0fc4247c819cf47397 | __all__ = ['mediaclassification_stats'] | [] |
joeghodsi/interview-questions | balanced_parens.py | 3e4eb76891245ce978cb9171e87d60e3b292b0a8 | '''
Problem description:
Given a string, determine whether or not the parentheses are balanced
'''
def balanced_parens(str):
'''
runtime: O(n)
space : O(1)
'''
if str is None:
return True
open_count = 0
for char in str:
if char == '(':
open_count += 1
... | [] |
pyllyukko/plaso | plaso/parsers/winreg_plugins/ccleaner.py | 7533db2d1035ca71d264d6281ebd5db2d073c587 | # -*- coding: utf-8 -*-
"""Parser for the CCleaner Registry key."""
import re
from dfdatetime import time_elements as dfdatetime_time_elements
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import definitions
from plaso.parsers import winreg_parser
from plaso.parsers.winr... | [((6270, 6332), 'plaso.parsers.winreg_parser.WinRegistryParser.RegisterPlugin', 'winreg_parser.WinRegistryParser.RegisterPlugin', (['CCleanerPlugin'], {}), '(CCleanerPlugin)\n', (6316, 6332), False, 'from plaso.parsers import winreg_parser\n'), ((2611, 2731), 're.compile', 're.compile', (['"""([0-9][0-9])/([0-9][0-9])/... |
ejconlon/pushpluck | pushpluck/base.py | 4e5b8bcff6fe3955e8f25638268569f901815b5a | from abc import ABCMeta, abstractmethod
from dataclasses import dataclass
from typing import Any, TypeVar
X = TypeVar('X')
class Closeable(metaclass=ABCMeta):
@abstractmethod
def close(self) -> None:
""" Close this to free resources and deny further use. """
raise NotImplementedError()
cla... | [((112, 124), 'typing.TypeVar', 'TypeVar', (['"""X"""'], {}), "('X')\n", (119, 124), False, 'from typing import Any, TypeVar\n'), ((941, 963), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (950, 963), False, 'from dataclasses import dataclass\n')] |
CAB-LAB/cube-performance-test | test/cuberead/highres/test_default_high_res.py | 0ca7dbb56b2937004fb63f8aafdff21fb76263d4 | import time
import pytest
from test import config
from test.cube_utils import CubeUtils
ITERATIONS_NUM = getattr(config, 'iterations_num', 1)
ROUNDS_NUM = getattr(config, 'rounds_num', 10)
class TestDefaultHighRes:
@pytest.fixture(scope="class", autouse=True)
def cube_default(self):
cube_utils = Cu... | [((225, 268), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""', 'autouse': '(True)'}), "(scope='class', autouse=True)\n", (239, 268), False, 'import pytest\n'), ((496, 646), 'pytest.mark.benchmark', 'pytest.mark.benchmark', ([], {'group': '"""Cube reading for small area spatial analysis high-res"""', 't... |
dyoshiha/mindmeld | tests/components/test_dialogue_flow.py | 95f0e8482594f00040766a2ee687e9c9338f5a74 | import pytest
from mindmeld.components import Conversation
def assert_reply(directives, templates, *, start_index=0, slots=None):
"""Asserts that the provided directives contain the specified reply
Args:
directives (list[dict[str, dict]]): list of directives returned by application
templates ... | [((1209, 1300), 'mindmeld.components.Conversation', 'Conversation', ([], {'app': 'async_kwik_e_mart_app', 'app_path': 'kwik_e_mart_app_path', 'force_sync': '(True)'}), '(app=async_kwik_e_mart_app, app_path=kwik_e_mart_app_path,\n force_sync=True)\n', (1221, 1300), False, 'from mindmeld.components import Conversation... |
nextzlog/mine | mine/src/main/python/SVM.py | 49ef0bea4796920d8696dc5f076f86c0ab17be80 | import os,sys
import webbrowser
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.cm as cm
import matplotlib.pylab as plt
from matplotlib import ticker
plt.rcParams['font.family'] = 'monospace'
fig = plt.figure()
rect = fig.add_subplot(111, aspect='equal')
data0 = np.loadtxt('data0.dat', del... | [((69, 90), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (83, 90), False, 'import matplotlib\n'), ((228, 240), 'matplotlib.pylab.figure', 'plt.figure', ([], {}), '()\n', (238, 240), True, 'import matplotlib.pylab as plt\n'), ((293, 331), 'numpy.loadtxt', 'np.loadtxt', (['"""data0.dat"""'], {'de... |
rsrdesarrollo/sarna | sarna/report_generator/scores.py | 0c1f44e06a932520b70e505585a5469b77f6302e | from sarna.model.enums import Score, Language
from sarna.report_generator import make_run
from sarna.report_generator.locale_choice import locale_choice
from sarna.report_generator.style import RenderStyle
def score_to_docx(score: Score, style: RenderStyle, lang: Language):
ret = make_run(getattr(style, score.nam... | [((332, 358), 'sarna.report_generator.locale_choice.locale_choice', 'locale_choice', (['score', 'lang'], {}), '(score, lang)\n', (345, 358), False, 'from sarna.report_generator.locale_choice import locale_choice\n')] |
waittrue/wireless | tests/hwsim/test_ap_open.py | 3c64f015dc62aec4da0b696f45cc4bcf41594c5d | # Open mode AP tests
# Copyright (c) 2014, Qualcomm Atheros, Inc.
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import struct
import subprocess
import time
import os
import hostapd
import hwsim_utils
from tshark impo... | [] |
andreakropp/datarobot-user-models | task_templates/pipelines/python3_pytorch_regression/model_utils.py | 423ab8c703a545491ad6013a0b7efa3119e2c0fc | #!/usr/bin/env python
# coding: utf-8
# pylint: disable-all
from __future__ import absolute_import
from sklearn.preprocessing import LabelEncoder
from pathlib import Path
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.optim as optim
class BinModel(nn.Module):
expected_target... | [((3164, 3176), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (3174, 3176), True, 'import torch.nn as nn\n'), ((3327, 3341), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (3339, 3341), False, 'from sklearn.preprocessing import LabelEncoder\n'), ((4120, 4155), 'torch.save', 'torch.save', ... |
mlandriau/surveysim | py/surveysim/weather.py | e7a323d6c4031b1b8df25e776dbe81188fbe8860 | """Simulate stochastic observing weather conditions.
The simulated conditions include seeing, transparency and the dome-open fraction.
"""
from __future__ import print_function, division, absolute_import
from datetime import datetime
import numpy as np
import astropy.time
import astropy.table
import astropy.units a... | [((3159, 3186), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (3180, 3186), True, 'import numpy as np\n'), ((6535, 6558), 'numpy.ones', 'np.ones', (['num_rows', 'bool'], {}), '(num_rows, bool)\n', (6542, 6558), True, 'import numpy as np\n'), ((9727, 9745), 'numpy.any', 'np.any', (['(o... |
takeratta/ga-dev-tools | lib/csv_writer.py | 19dcf7c750af8214e5a306fc0f8e2b28bef7bb40 | # coding=utf-8
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | [((2465, 2484), 'StringIO.StringIO', 'StringIO.StringIO', ([], {}), '()\n', (2482, 2484), False, 'import StringIO\n'), ((2503, 2550), 'csv.writer', 'csv.writer', (['self.queue'], {'dialect': 'dialect'}), '(self.queue, dialect=dialect, **kwds)\n', (2513, 2550), False, 'import csv\n'), ((2590, 2628), 'codecs.getincrement... |
yuwenxianglong/zhxsh.github.io | resdata/TensorFlow/RNN_Prediction/stockPrediction202005201318.py | 427d14b787e55df26e03a069288815b14ab6b534 | # -*- coding: utf-8 -*-
"""
@Project : RNN_Prediction
@Author : Xu-Shan Zhao
@Filename: stockPrediction202005201318.py
@IDE : PyCharm
@Time1 : 2020-05-20 13:18:46
@Time2 : 2020/5/20 13:18
@Month1 : 5月
@Month2 : 五月
"""
import tushare as ts
import tensorflow as tf
import pandas as pd
from sklearn.model_select... | [((394, 420), 'tushare.get_hist_data', 'ts.get_hist_data', (['"""300750"""'], {}), "('300750')\n", (410, 420), True, 'import tushare as ts\n'), ((1660, 1704), 'tensorflow.keras.optimizers.Adam', 'tf.keras.optimizers.Adam', ([], {'learning_rate': '(0.01)'}), '(learning_rate=0.01)\n', (1684, 1704), True, 'import tensorfl... |
MuShMe/MuShMe | src/mushme.py | dbc9b940c827039016d7917d535882b47d7d8e5b | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from src import app
import os
import shutil
from flask import Flask, render_template, session, request, flash, url_for, redirect
from Forms import ContactForm, LoginForm, editForm, ReportForm, CommentForm, searchForm, AddPlaylist
from flask.ext.mail import Message, Mail
fro... | [] |
Xtuden-com/language | language/labs/drkit/evaluate.py | 70c0328968d5ffa1201c6fdecde45bbc4fec19fc | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | [((1051, 1136), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""ground_truth_file"""', 'None', '"""File with ground truth answers."""'], {}), "('ground_truth_file', None,\n 'File with ground truth answers.')\n", (1070, 1136), False, 'from absl import flags\n'), ((1154, 1252), 'absl.flags.DEFINE_string', 'fl... |
jlashner/ares | tests/adv/test_pop_sfrd.py | 6df2b676ded6bd59082a531641cb1dadd475c8a8 | """
test_pop_models.py
Author: Jordan Mirocha
Affiliation: UCLA
Created on: Fri Jul 15 15:23:11 PDT 2016
Description:
"""
import ares
import matplotlib.pyplot as pl
PB = ares.util.ParameterBundle
def test():
# Create a simple population
pars_1 = PB('pop:fcoll') + PB('sed:bpass')
pop_fcoll = ares.po... | [((313, 356), 'ares.populations.GalaxyPopulation', 'ares.populations.GalaxyPopulation', ([], {}), '(**pars_1)\n', (346, 356), False, 'import ares\n'), ((885, 928), 'ares.populations.GalaxyPopulation', 'ares.populations.GalaxyPopulation', ([], {}), '(**pars_2)\n', (918, 928), False, 'import ares\n')] |
corgiclub/CorgiBot_telegram | venv/lib/python3.7/site-packages/leancloud/engine/utils.py | a63d91a74ee497b9a405e93bd3b303367ef95268 | # coding: utf-8
import time
import hashlib
import leancloud
from leancloud._compat import to_bytes
__author__ = 'asaka <lan@leancloud.rocks>'
def sign_by_key(timestamp, key):
return hashlib.md5(to_bytes('{0}{1}'.format(timestamp, key))).hexdigest()
| [] |
eyler94/ee674AirplaneSim | AirplaneLQR/chap4LQR/mavsim_chap4.py | 3ba2c6e685c2688a7f372475a7cd1f55f583d10e | """
mavsimPy
- Chapter 4 assignment for Beard & McLain, PUP, 2012
- Update history:
12/27/2018 - RWB
1/17/2019 - RWB
"""
import sys
sys.path.append('..')
import numpy as np
import parameters.simulation_parameters as SIM
from chap2.mav_viewer import mav_viewer
# from chap2.video_writer import ... | [((158, 179), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (173, 179), False, 'import sys\n'), ((596, 608), 'chap2.mav_viewer.mav_viewer', 'mav_viewer', ([], {}), '()\n', (606, 608), False, 'from chap2.mav_viewer import mav_viewer\n'), ((650, 663), 'chap3.data_viewer.data_viewer', 'data_viewer'... |
THU-DA-6D-Pose-Group/self6dpp | core/self6dpp/tools/ycbv/ycbv_pbr_so_mlBCE_Double_3_merge_train_real_uw_init_results_with_refined_poses_to_json.py | c267cfa55e440e212136a5e9940598720fa21d16 | import os.path as osp
import sys
import numpy as np
import mmcv
from tqdm import tqdm
from functools import cmp_to_key
cur_dir = osp.dirname(osp.abspath(__file__))
PROJ_ROOT = osp.normpath(osp.join(cur_dir, "../../../../"))
sys.path.insert(0, PROJ_ROOT)
from lib.pysixd import inout, misc
from lib.utils.bbox_utils impo... | [((225, 254), 'sys.path.insert', 'sys.path.insert', (['(0)', 'PROJ_ROOT'], {}), '(0, PROJ_ROOT)\n', (240, 254), False, 'import sys\n'), ((142, 163), 'os.path.abspath', 'osp.abspath', (['__file__'], {}), '(__file__)\n', (153, 163), True, 'import os.path as osp\n'), ((190, 223), 'os.path.join', 'osp.join', (['cur_dir', '... |
jadbin/guniflask | tests/test_app/rest_app/rest_app/services/account_service.py | 36253a962c056abf34884263c6919b02b921ad9c | from flask import abort
from guniflask.context import service
from ..config.jwt_config import jwt_manager
@service
class AccountService:
accounts = {
'root': {
'authorities': ['role_admin'],
'password': '123456',
}
}
def login(self, username: str, password: str):
... | [((432, 442), 'flask.abort', 'abort', (['(403)'], {}), '(403)\n', (437, 442), False, 'from flask import abort\n'), ((780, 790), 'flask.abort', 'abort', (['(404)'], {}), '(404)\n', (785, 790), False, 'from flask import abort\n')] |
jhh67/chapel | test/library/draft/DataFrames/psahabu/AddSeries.py | f041470e9b88b5fc4914c75aa5a37efcb46aa08f | import pandas as pd
I = ["A", "B", "C", "D", "E"]
oneDigit = pd.Series([1, 2, 3, 4, 5], pd.Index(I))
twoDigit = pd.Series([10, 20, 30, 40, 50], pd.Index(I))
print "addends:"
print oneDigit
print twoDigit
print
print "sum:"
print oneDigit + twoDigit
print
I2 = ["A", "B", "C"]
I3 = ["B", "C", "D", "E"]
X = pd.Series(... | [] |
shawcx/nelly | nelly/parser.py | 8075b92e20064a117f9ab5a6d8ad261d21234111 | #
# (c) 2008-2020 Matthew Shaw
#
import sys
import os
import re
import logging
import nelly
from .scanner import Scanner
from .program import Program
from .types import *
class Parser(object):
def __init__(self, include_dirs=[]):
self.include_dirs = include_dirs + [ os.path.join(nelly.root, 'grammars... | [((440, 477), 'os.path.join', 'os.path.join', (['nelly.root', '"""rules.lex"""'], {}), "(nelly.root, 'rules.lex')\n", (452, 477), False, 'import os\n'), ((804, 837), 'os.path.dirname', 'os.path.dirname', (['grammarFile.name'], {}), '(grammarFile.name)\n', (819, 837), False, 'import os\n'), ((3384, 3458), 'nelly.error',... |
zhinst/Qcodes | qcodes/utils/installation_info.py | d95798bd08d57bb8cddd460fdb4a5ff25f19215c | """
This module contains helper functions that provide information about how
QCoDeS is installed and about what other packages are installed along with
QCoDeS
"""
import sys
from typing import Dict, List, Optional
import subprocess
import json
import logging
import requirements
if sys.version_info >= (3, 8):
from ... | [((519, 546), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (536, 546), False, 'import logging\n'), ((837, 961), 'subprocess.run', 'subprocess.run', (["['python', '-m', 'pip', 'list', '-e', '--no-index', '--format=json']"], {'check': '(True)', 'stdout': 'subprocess.PIPE'}), "(['python', ... |
brandonrobertz/foia-pdf-processing-system | documents/views.py | 025516b5e2234df16741237c4208cd484f577370 | from django.shortcuts import render
from django.http import JsonResponse
from .models import FieldCategory
def fieldname_values(request):
if request.method == "GET":
fieldname = request.GET['fieldname']
query = request.GET.get('q')
q_kwargs= dict(
fieldname=fieldname,
... | [((1146, 1176), 'django.http.JsonResponse', 'JsonResponse', (["{'status': 'ok'}"], {}), "({'status': 'ok'})\n", (1158, 1176), False, 'from django.http import JsonResponse\n'), ((811, 841), 'django.http.JsonResponse', 'JsonResponse', (["{'status': 'ok'}"], {}), "({'status': 'ok'})\n", (823, 841), False, 'from django.htt... |
mjuenema/python-terrascript | tests/test_provider_Mongey_kafka_connect.py | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | # tests/test_provider_Mongey_kafka-connect.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:20:11 UTC)
def test_provider_import():
import terrascript.provider.Mongey.kafka_connect
def test_resource_import():
from terrascript.resource.Mongey.kafka_connect import kafka_connect_connector
# T... | [] |
nicholsont/catalog_app | application.py | 011e4c35401aa1128a4cf1ca99dd808da7a759e6 | from flask import Flask, render_template, request, redirect, jsonify, g
from flask import url_for, flash, make_response
from flask import session as login_session
from sqlalchemy import create_engine, asc
from sqlalchemy.orm import sessionmaker
from models import Base, Category, Item, User
from oauth2client.client impo... | [((448, 463), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (453, 463), False, 'from flask import Flask, render_template, request, redirect, jsonify, g\n'), ((905, 942), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///catalog.db"""'], {}), "('sqlite:///catalog.db')\n", (918, 942), False, 'fro... |
nooproject/noo | noo/impl/utils/__init__.py | 238711c55faeb1226a4e5339cd587a312c4babac | from .echo import echo, set_quiet
from .errors import NooException, cancel
from .store import STORE, FileStore, Store
__all__ = (
"FileStore",
"NooException",
"Store",
"STORE",
"cancel",
"echo",
"set_quiet",
)
| [] |
aliang8/ai2thor | ai2thor/server.py | 3ef92cf5437e2d60127c77bd59d5b7394eebb36c | # Copyright Allen Institute for Artificial Intelligence 2017
"""
ai2thor.server
Handles all communication with Unity through a Flask service. Messages
are sent to the controller using a pair of request/response queues.
"""
import json
import logging
import sys
import os
import os.path
try:
from queue import Em... | [((633, 662), 'logging.getLogger', 'logging.getLogger', (['"""werkzeug"""'], {}), "('werkzeug')\n", (650, 662), False, 'import logging\n'), ((2804, 2835), 'numpy.frombuffer', 'np.frombuffer', (['buf'], {'dtype': 'dtype'}), '(buf, dtype=dtype)\n', (2817, 2835), True, 'import numpy as np\n'), ((2909, 2928), 'numpy.flip',... |
ooreilly/mydocstring | setup.py | 077cebfb86575914d343bd3291b9e6c5e8beef94 | from setuptools import setup
setup(name='mydocstring',
version='0.2.7',
description="""A tool for extracting and converting Google-style docstrings to
plain-text, markdown, and JSON.""",
url='http://github.com/ooreilly/mydocstring',
author="Ossian O'Reilly",
license='MIT',
pa... | [((31, 531), 'setuptools.setup', 'setup', ([], {'name': '"""mydocstring"""', 'version': '"""0.2.7"""', 'description': '"""A tool for extracting and converting Google-style docstrings to\n plain-text, markdown, and JSON."""', 'url': '"""http://github.com/ooreilly/mydocstring"""', 'author': '"""Ossian O\'Reilly"""',... |
Cologler/anyser-python | anyser/impls/bson.py | 52afa0a62003adcfe269f47d81863e00381d8ff9 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2020~2999 - Cologler <skyoflw@gmail.com>
# ----------
#
# ----------
import bson
import struct
from ..err import SerializeError
from ..abc import *
from ..core import register_format
@register_format('bson', '.bson')
class BsonSerializer(ISerializer):
format_name = 'bson... | [((522, 545), 'bson.loads', 'bson.loads', (['b'], {}), '(b, **kwargs)\n', (532, 545), False, 'import bson\n'), ((810, 835), 'bson.dumps', 'bson.dumps', (['obj'], {}), '(obj, **kwargs)\n', (820, 835), False, 'import bson\n')] |
KevinMFong/pyhocon | tests/test_config_parser.py | 091830001f2d44f91f0f8281fb119c87fd1f6660 | # -*- encoding: utf-8 -*-
import json
import os
import shutil
import tempfile
from collections import OrderedDict
from datetime import timedelta
from pyparsing import ParseBaseException, ParseException, ParseSyntaxException
import mock
import pytest
from pyhocon import (ConfigFactory, ConfigParser, ConfigSubstitution... | [((2066, 2153), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""forbidden_char"""', "['+', '`', '^', '?', '!', '@', '*', '&']"], {}), "('forbidden_char', ['+', '`', '^', '?', '!', '@',\n '*', '&'])\n", (2089, 2153), False, 'import pytest\n'), ((2350, 2403), 'pytest.mark.parametrize', 'pytest.mark.paramet... |
cgeller/WorldOnRails | scenario_runner/srunner/scenariomanager/scenario_manager.py | d8aa9f7ae67a6b7b71a2fc5ba86bb2a44f221bef | #!/usr/bin/env python
# Copyright (c) 2018-2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides the ScenarioManager implementation.
It must not be modified and is for reference only!
"""
from __future__ ... | [((2400, 2418), 'srunner.scenariomanager.timer.GameTime.restart', 'GameTime.restart', ([], {}), '()\n', (2416, 2418), False, 'from srunner.scenariomanager.timer import GameTime\n'), ((2721, 2748), 'srunner.scenariomanager.carla_data_provider.CarlaDataProvider.cleanup', 'CarlaDataProvider.cleanup', ([], {}), '()\n', (27... |
disfated/edgedb | edb/schema/referencing.py | 8d78f4a2a578f80780be160ba5f107f5bdc79063 | #
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http... | [((34717, 34750), 'edb.common.struct.Field', 'struct.Field', (['bool'], {'default': '(False)'}), '(bool, default=False)\n', (34729, 34750), False, 'from edb.common import struct\n'), ((12110, 12124), 'hashlib.sha1', 'hashlib.sha1', ([], {}), '()\n', (12122, 12124), False, 'import hashlib\n'), ((3477, 3550), 'edb.errors... |
Jakuko99/effectb | tools.py | ab6688ce3679cdd2cf43038f7bfef67dabf97c1b | from calendar import month_name
class Tools:
def __init__(self):
self.output = ""
def formatDate(self, date):
elements = date.split("-")
return f"{elements[2]}. {month_name[int(elements[1])]} {elements[0]}"
def shortenText(self, string, n): #return first n sentences from strin... | [] |
csadsl/poc_exp | Bugscan_exploits-master/exp_list/exp-2307.py | e3146262e7403f19f49ee2db56338fa3f8e119c9 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#__Author__ = 烽火戏诸侯
#_PlugName_ = Shop7z /admin/lipinadd.asp越权访问
import re
def assign(service, arg):
if service == "shop7z":
return True, arg
def audit(arg):
payload = 'admin/lipinadd.asp'
target = arg + payload
code, head,res, errcode... | [] |
dlangerm/core | homeassistant/components/hue/light.py | 643acbf9484fd05161d7e9f2228c9c92a5ce7d0b | """Support for the Philips Hue lights."""
from __future__ import annotations
from datetime import timedelta
from functools import partial
import logging
import random
import aiohue
import async_timeout
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_EFFECT,
ATTR_FL... | [((1183, 1203), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(5)'}), '(seconds=5)\n', (1192, 1203), False, 'from datetime import timedelta\n'), ((1215, 1242), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1232, 1242), False, 'import logging\n'), ((6930, 7002), 'functools.partial... |
dmtvanzanten/ezdxf | src/ezdxf/math/bulge.py | 6fe9d0aa961e011c87768aa6511256de21a662dd | # Copyright (c) 2018-2021 Manfred Moitzi
# License: MIT License
# source: http://www.lee-mac.com/bulgeconversion.html
# source: http://www.afralisp.net/archive/lisp/Bulges1.htm
from typing import Any, TYPE_CHECKING, Tuple
import math
from ezdxf.math import Vec2
if TYPE_CHECKING:
from ezdxf.eztypes import Vertex
_... | [((3789, 3806), 'ezdxf.math.Vec2', 'Vec2', (['start_point'], {}), '(start_point)\n', (3793, 3806), False, 'from ezdxf.math import Vec2\n'), ((704, 711), 'ezdxf.math.Vec2', 'Vec2', (['p'], {}), '(p)\n', (708, 711), False, 'from ezdxf.math import Vec2\n'), ((714, 746), 'ezdxf.math.Vec2.from_angle', 'Vec2.from_angle', (['... |
aspose-email/Aspose.Email-for-Java | Plugins/Aspose.Email Java for Python/tests/ProgrammingEmail/ManageAttachments/ManageAttachments.py | cf4567e54f7979e7296c99bcae2c6477385d7735 | # To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
#if __name__ == "__main__":
# print "Hello World"
from ProgrammingEmail import ManageAttachments
import jpype
import os.path
asposeapispath... | [] |
asmeurer/mypython | mypython/keys.py | ae984926739cc2bb3abe70566762d7b4052ed0ae | from prompt_toolkit.key_binding.bindings.named_commands import (accept_line,
self_insert, backward_delete_char, beginning_of_line)
from prompt_toolkit.key_binding.bindings.basic import if_no_repeat
from prompt_toolkit.key_binding.bindings.basic import load_basic_bindings
from prompt_toolkit.key_binding.bindings.ema... | [((1867, 1880), 'prompt_toolkit.key_binding.KeyBindings', 'KeyBindings', ([], {}), '()\n', (1878, 1880), False, 'from prompt_toolkit.key_binding import KeyBindings, merge_key_bindings\n'), ((4468, 4497), 're.compile', 're.compile', (['"""\\\\S *(\\\\n *\\\\n)"""'], {}), "('\\\\S *(\\\\n *\\\\n)')\n", (4478, 4497), Fals... |
gusugusu1018/simmobility-prod | demand/preday_model_estimation/isg.py | d30a5ba353673f8fd35f4868c26994a0206a40b6 | from biogeme import *
from headers import *
from loglikelihood import *
from statistics import *
from nested import *
#import random
cons_work= Beta('cons for work', 0,-10,10,0)
cons_edu = Beta('cons for education',0,-50,10,0)
cons_shopping = Beta('cons for shopping',0,-10,10,0)
cons_... | [] |
freestyletime/HumanResourceManagement | HRMS/app/__init__.py | 4ec7f453fdae28d1a412d740849c9ee186757df8 | # 初始化模块
from config import Config
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
# 数据库操作对象
db = SQLAlchemy()
# 创建app
def create_app():
# flask操作对象
app = Flask(__name__)
# 通过配置文件读取并应用配置
app.config.from_object(Config)
# 初始化数据库
db.init_app(app)
# 员工管理子系统
from app.view i... | [((114, 126), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (124, 126), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((181, 196), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (186, 196), False, 'from flask import Flask\n')] |
NicolasMenendez/oracles-dashboard | listener/src/ethereum_connection.py | 789e4a771c9f7064a19a85ef1b4f44bcbbac1a10 | import json
import web3
class EthereumConnection():
def __init__(self, url_node):
self._url_node = url_node
self._node_provider = web3.HTTPProvider(self._url_node)
self._w3 = web3.Web3(self._node_provider)
@property
def w3(self):
return self._w3
@property
def url_... | [((152, 185), 'web3.HTTPProvider', 'web3.HTTPProvider', (['self._url_node'], {}), '(self._url_node)\n', (169, 185), False, 'import web3\n'), ((205, 235), 'web3.Web3', 'web3.Web3', (['self._node_provider'], {}), '(self._node_provider)\n', (214, 235), False, 'import web3\n')] |
JuliaMota/ross | ross/stochastic/st_results.py | 88c2fa69d9a583dcdc33eab8deb35c797ebf4ef8 | """STOCHASTIC ROSS plotting module.
This module returns graphs for each type of analyses in st_rotor_assembly.py.
"""
import numpy as np
from plotly import express as px
from plotly import graph_objects as go
from plotly import io as pio
from plotly.subplots import make_subplots
from ross.plotly_theme import tableau_... | [((2441, 2463), 'numpy.sort', 'np.sort', (['conf_interval'], {}), '(conf_interval)\n', (2448, 2463), True, 'import numpy as np\n'), ((2485, 2504), 'numpy.sort', 'np.sort', (['percentile'], {}), '(percentile)\n', (2492, 2504), True, 'import numpy as np\n'), ((2601, 2612), 'plotly.graph_objects.Figure', 'go.Figure', ([],... |
ben9583/PrisonersDilemmaTournament | code/prisonersDilemma.py | 8227c05f835c93a0b30feb4207a7d7c631e670a0 | import os
import itertools
import importlib
import numpy as np
import random
STRATEGY_FOLDER = "exampleStrats"
RESULTS_FILE = "results.txt"
pointsArray = [[1,5],[0,3]] # The i-j-th element of this array is how many points you receive if you do play i, and your opponent does play j.
moveLabels = ["D","C"]
#... | [((1069, 1125), 'importlib.import_module', 'importlib.import_module', (["(STRATEGY_FOLDER + '.' + pair[0])"], {}), "(STRATEGY_FOLDER + '.' + pair[0])\n", (1092, 1125), False, 'import importlib\n'), ((1137, 1193), 'importlib.import_module', 'importlib.import_module', (["(STRATEGY_FOLDER + '.' + pair[1])"], {}), "(STRATE... |
paepcke/json_to_relation | json_to_relation/mysqldb.py | acfa58d540f8f51d1d913d0c173ee3ded1b6c2a9 | # Copyright (c) 2014, Stanford University
# 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, this list of conditions and the ... | [((6940, 7019), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'dir': '"""/tmp"""', 'prefix': '"""userCountryTmp"""', 'suffix': '""".csv"""'}), "(dir='/tmp', prefix='userCountryTmp', suffix='.csv')\n", (6967, 7019), False, 'import tempfile\n'), ((2736, 2806), 'pymysql.connect', 'pymysql.connect', (... |
treys/crypto-key-derivation | tools/xkeydump.py | 789900bd73160db9a0d406c7c7f00f5f299aff73 | #!./venv/bin/python
from lib.mbp32 import XKey
from lib.utils import one_line_from_stdin
xkey = XKey.from_xkey(one_line_from_stdin())
print(xkey)
print("Version:", xkey.version)
print("Depth:", xkey.depth)
print("Parent FP:", xkey.parent_fp.hex())
print("Child number:", xkey.child_number_with_tick())
print("Chain cod... | [((113, 134), 'lib.utils.one_line_from_stdin', 'one_line_from_stdin', ([], {}), '()\n', (132, 134), False, 'from lib.utils import one_line_from_stdin\n')] |
meder411/Tangent-Images | examples/compute_angular_resolution.py | 6def4d7b8797110e54f7faa2435973771d9e9722 | from spherical_distortion.util import *
sample_order = 9 # Input resolution to examine
def ang_fov(s):
print('Spherical Resolution:', s)
for b in range(s):
dim = tangent_image_dim(b, s) # Pixel dimension of tangent image
corners = tangent_image_corners(b, s) # Corners of each tangent image
... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.