repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
Ibrahem3amer/bala7 | cms/tests/test_views.py | 70638c121ea85ff0e6a650c5f2641b0b3b04d6d0 | from django.core.urlresolvers import resolve
from django.urls import reverse
from django.test import TestCase, RequestFactory
from django.http import HttpRequest, Http404
from django.contrib.auth.models import User
from unittest import skip
from users.models import University, Faculty, Department, UserProfile
from cms.... | [((450, 551), 'django.contrib.auth.models.User.objects.create', 'User.objects.create', ([], {'username': '"""test_username"""', 'email': '"""tesssst@test.com"""', 'password': '"""secrettt23455"""'}), "(username='test_username', email='tesssst@test.com',\n password='secrettt23455')\n", (469, 551), False, 'from django... |
geometatqueens/RCNN | 3D/Train_Module_3D.py | 2e1e67264969f05a2f554595577dfb1025938245 | """The present code is the Version 1.0 of the RCNN approach to perform MPS
in 3D for categorical variables. It has been developed by S. Avalos and J. Ortiz in the
Geometallurygical Group at Queen's University as part of a PhD program.
The code is not free of bugs but running end-to-end.
Any comments and further i... | [((941, 952), 'time.time', 'time.time', ([], {}), '()\n', (950, 952), False, 'import time\n'), ((3421, 3525), 'External_Functions_3D.CreateGraph_4ConvNets_4HL_NFeaConv_wdnhxwdnh_BN_3D', 'fns_nested.CreateGraph_4ConvNets_4HL_NFeaConv_wdnhxwdnh_BN_3D', ([], {'HyperPar': 'HyperPar', 'LocModel': 'LocModel'}), '(HyperPar=\n... |
steuke/django_feature_flags_example | feature_flags_project/feature_flags/providers.py | 00e33378999d6d567c37593c17289405fc7b5847 | import logging
from typing import Dict
from django.http import HttpRequest
logger = logging.getLogger(__name__)
class FeatureFlagProvider:
def is_feature_enabled(self, feature_name: str, user_id: str = None, attributes: Dict = None):
raise NotImplementedError("You must override FeatureFlagProvider.is_fe... | [((86, 113), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (103, 113), False, 'import logging\n'), ((946, 1069), 'django.conf.settings.FEATURE_FLAG_PROVIDER.is_feature_enabled', 'settings.FEATURE_FLAG_PROVIDER.is_feature_enabled', ([], {'feature_name': 'feature_name', 'user_id': '"""dont... |
roch1990/aiohttp-blog | src/app/database/__init__.py | 32e7b76b5b293d4517631ea82dfa2b268a1662eb | from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base() | [((64, 82), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (80, 82), False, 'from sqlalchemy.ext.declarative import declarative_base\n')] |
timcera/plottoolbox | src/plottoolbox/functions/kde.py | b5f4b634d366eb5ba244e2f1fd33a7ef0eba7298 | # -*- coding: utf-8 -*-
"""Collection of functions for the manipulation of time series."""
from __future__ import absolute_import, division, print_function
import itertools
import os
import warnings
import mando
import numpy as np
import pandas as pd
from mando.rst_text_formatter import RSTHelpFormatter
from tstoolb... | [((365, 398), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (388, 398), False, 'import warnings\n'), ((402, 473), 'mando.command', 'mando.command', (['"""kde"""'], {'formatter_class': 'RSTHelpFormatter', 'doctype': '"""numpy"""'}), "('kde', formatter_class=RSTHelpFormatte... |
3verlyn/DL-abstract-argumentation | src/models/GNN.py | 885e442077f5f8e576092c6648077e00ceb79dff | from collections import OrderedDict
import torch
import torch.nn as nn
from torch_geometric.data.batch import Batch
class GNN(nn.Module):
def __init__(self, mp_steps, **config):
super().__init__()
self.mp_steps = mp_steps
self.update_fns = self.assign_update_fns()
self.readout_fns... | [((642, 669), 'torch.bincount', 'torch.bincount', (['batch.batch'], {}), '(batch.batch)\n', (656, 669), False, 'import torch\n')] |
vivek-r-2000/BoundaryNet | configs/baselines/DACN/GNN/GCN_res_layer.py | fce8d51a516646c1001116d03872dbba9e4c5082 | import math
import torch
import torch.nn as nn
from torch.nn.modules.module import Module
from GNN.GCN_layer import GraphConvolution
class GraphResConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(self, state_dim, name=''):
super(GraphRes... | [((407, 449), 'GNN.GCN_layer.GraphConvolution', 'GraphConvolution', (['state_dim', "('%s_1' % name)"], {}), "(state_dim, '%s_1' % name)\n", (423, 449), False, 'from GNN.GCN_layer import GraphConvolution\n'), ((471, 513), 'GNN.GCN_layer.GraphConvolution', 'GraphConvolution', (['state_dim', "('%s_2' % name)"], {}), "(sta... |
lukasvosyka/mtools | mtools/util/logfile.py | b94620cef48a9eb71b6a7fa93ad88f70cd36982f | #!/usr/bin/env python3
from __future__ import print_function
import os
import re
import sys
from datetime import datetime
from math import ceil
from mtools.util.input_source import InputSource
from mtools.util.logevent import LogEvent
class LogFile(InputSource):
"""Log file wrapper class. Handles open file str... | [((7241, 7255), 'mtools.util.logevent.LogEvent', 'LogEvent', (['line'], {}), '(line)\n', (7249, 7255), False, 'from mtools.util.logevent import LogEvent\n'), ((14595, 14645), 're.search', 're.search', (['"""(\\\\d\\\\.\\\\d\\\\.\\\\d+)"""', 'logevent.line_str'], {}), "('(\\\\d\\\\.\\\\d\\\\.\\\\d+)', logevent.line_str)... |
Tillsten/pyqtgraph | tests/svg.py | 0045863165fe526988c58cf4f8232ae2d261a5ee | """
SVG export test
"""
import test
import pyqtgraph as pg
app = pg.mkQApp()
class SVGTest(test.TestCase):
#def test_plotscene(self):
#pg.setConfigOption('foreground', (0,0,0))
#w = pg.GraphicsWindow()
#w.show()
#p1 = w.addPlot()
#p2 = w.addPlot()
#p1.plot([1... | [((65, 76), 'pyqtgraph.mkQApp', 'pg.mkQApp', ([], {}), '()\n', (74, 76), True, 'import pyqtgraph as pg\n'), ((2116, 2136), 'test.unittest.main', 'test.unittest.main', ([], {}), '()\n', (2134, 2136), False, 'import test\n'), ((704, 729), 'pyqtgraph.QtGui.QGraphicsScene', 'pg.QtGui.QGraphicsScene', ([], {}), '()\n', (727... |
jedicontributors/pythondataintegrator | src/api/models/enums/apschedulerevents.py | 3e877b367ab9b20185476128ec053db41087879f | EVENT_SCHEDULER_STARTED = EVENT_SCHEDULER_START = 2 ** 0
EVENT_SCHEDULER_SHUTDOWN = 2 ** 1
EVENT_SCHEDULER_PAUSED = 2 ** 2
EVENT_SCHEDULER_RESUMED = 2 ** 3
EVENT_EXECUTOR_ADDED = 2 ** 4
EVENT_EXECUTOR_REMOVED = 2 ** 5
EVENT_JOBSTORE_ADDED = 2 ** 6
EVENT_JOBSTORE_REMOVED = 2 ** 7
EVENT_ALL_JOBS_REMOVED = 2 ** 8
EVENT_JO... | [] |
mrninhvn/matter | scripts/build/build/targets.py | c577b233db9d2f3a6f87108a062b1699a40c5169 | # Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [((4433, 4455), 'itertools.combinations', 'combinations', (['items', '(2)'], {}), '(items, 2)\n', (4445, 4455), False, 'from itertools import combinations\n'), ((3092, 3130), 'os.path.join', 'os.path.join', (['output_prefix', 'self.name'], {}), '(output_prefix, self.name)\n', (3104, 3130), False, 'import os\n'), ((7412... |
TRINITRONIC/musegan | src/musegan/data.py | 0a62e0303a8ff357d7f385dcc6edba76afb132b2 | """This file contains functions for loading and preprocessing pianoroll data.
"""
import logging
import numpy as np
import tensorflow.compat.v1 as tf
from musegan.config import SHUFFLE_BUFFER_SIZE, PREFETCH_SIZE
LOGGER = logging.getLogger(__name__)
# --- Data loader ----------------------------------------------------... | [((221, 248), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (238, 248), False, 'import logging\n'), ((437, 454), 'numpy.load', 'np.load', (['filename'], {}), '(filename)\n', (444, 454), True, 'import numpy as np\n'), ((1379, 1403), 'numpy.random.randint', 'np.random.randint', (['(-5)', '... |
PushpneetSingh/Hello-world | Python/hello-world-pt-BR.py | def0f44737e02fb40063cd347e93e456658e2532 | print(u"Olá mundo!") | [] |
saidulislam/flask-bootcamp-2 | 02-static-templates-files/02_html_template.py | 4ba8f5e012aa0159275ab264f0247815dcf635e6 | from flask import Flask,
app = Flask(__name__)
@app.route("/")
def homepage():
return "Paws Rescue Center 🐾"
@app.route("/about")
def about():
return """We are a non-profit organization working as an animal rescue center.
We aim to help you connect with purrfect furbaby for you!
The ani... | [] |
arpastrana/compas | src/compas/datastructures/mesh/bbox.py | ed677a162c14dbe562c82d72f370279259faf7da | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas.geometry import bounding_box
from compas.geometry import bounding_box_xy
__all__ = [
'mesh_bounding_box',
'mesh_bounding_box_xy',
]
def mesh_bounding_box(mesh):
"""Compute the (axis... | [((852, 869), 'compas.geometry.bounding_box', 'bounding_box', (['xyz'], {}), '(xyz)\n', (864, 869), False, 'from compas.geometry import bounding_box\n'), ((1405, 1425), 'compas.geometry.bounding_box_xy', 'bounding_box_xy', (['xyz'], {}), '(xyz)\n', (1420, 1425), False, 'from compas.geometry import bounding_box_xy\n'), ... |
Lars-H/federated_crop | crop/source_selection/__init__.py | 8e936926462aa5df5a9b8e6b42b061a3623fddf4 | from naive import NaiveSourceSelection
from star_based import StarBasedSourceSelection
from utils import AskSourceSelector, HybridSourceSelector, StatSourceSelector
from charset_selector import CharSet_Selector | [] |
Mhaiyang/iccv | base3_plus.py | 04a8ee52c2323d7ff5cdf03c0be1466e8180d2eb | """
@Time : 201/21/19 10:47
@Author : TaylorMei
@Email : mhy845879017@gmail.com
@Project : iccv
@File : base3_plus.py
@Function:
""" | [] |
oknuutti/hw_visnav | visnav/algo/orig/tools.py | 5254b8bdd146548413554c00e6e76264a2540e8b | import math
import time
import numpy as np
import numba as nb
import quaternion # adds to numpy # noqa # pylint: disable=unused-import
import sys
import scipy
from astropy.coordinates import SkyCoord
from scipy.interpolate import RectBivariateSpline
from scipy.interpolate import NearestNDInterpolator
# from scipy.s... | [((1674, 1706), 'quaternion.as_rotation_matrix', 'quaternion.as_rotation_matrix', (['q'], {}), '(q)\n', (1703, 1706), False, 'import quaternion\n'), ((2797, 2810), 'numpy.max', 'np.max', (['normD'], {}), '(normD)\n', (2803, 2810), True, 'import numpy as np\n'), ((3136, 3155), 'numpy.array', 'np.array', (['(x, y, z)'], ... |
Tarekbouamer/Image-Retrieval-for-Image-Based-Localization | cirtorch/filters/sobel.py | fcad9af4f558bebb3cbec1d08e49603a452f439d | import torch
import torch.nn as nn
import torch.nn.functional as F
from .kernels import (
get_spatial_gradient_kernel2d,
get_spatial_gradient_kernel3d,
normalize_kernel2d
)
def spatial_gradient(input, mode='sobel', order=1, normalized=True):
"""
Computes the first order image derivative in bo... | [((2916, 2951), 'torch.sqrt', 'torch.sqrt', (['(gx * gx + gy * gy + eps)'], {}), '(gx * gx + gy * gy + eps)\n', (2926, 2951), False, 'import torch\n'), ((1255, 1299), 'torch.nn.functional.conv3d', 'F.conv3d', (['padded_inp', 'kernel_flip'], {'padding': '(0)'}), '(padded_inp, kernel_flip, padding=0)\n', (1263, 1299), Tr... |
xu6148152/Binea_Python_Project | PythonCookbook/concurrent_test/findrobots.py | d943eb5f4685d08f080b372dcf1a7cbd5d63efed | # -*- encoding: utf-8 -*-
import gzip
import io
import glob
from concurrent import futures
def find_robots(filename):
'''
Find all of the hosts that access robots.txt in a single log file
'''
robots = set()
with gzip.open(filename) as f:
for line in io.TextIOWrapper(f, encoding='ascii'):
... | [((567, 598), 'glob.glob', 'glob.glob', (["(logdir + '/*.log.gz')"], {}), "(logdir + '/*.log.gz')\n", (576, 598), False, 'import glob\n'), ((235, 254), 'gzip.open', 'gzip.open', (['filename'], {}), '(filename)\n', (244, 254), False, 'import gzip\n'), ((281, 318), 'io.TextIOWrapper', 'io.TextIOWrapper', (['f'], {'encodi... |
sreynit02/RunestoneServer | docker/setup.py | 2d72fd1c26264a8d7d88e2bccfe9bfbb4d8b9a98 | # ******************************************************************
# |docname| - Provide `docker_tools.py` as the script `docker-tools`
# ******************************************************************
from setuptools import setup
setup(
name="runestone-docker-tools",
version="0.1",
install_requires=[... | [((237, 397), 'setuptools.setup', 'setup', ([], {'name': '"""runestone-docker-tools"""', 'version': '"""0.1"""', 'install_requires': "['click']", 'entry_points': "{'console_scripts': ['docker-tools = docker_tools:cli']}"}), "(name='runestone-docker-tools', version='0.1', install_requires=[\n 'click'], entry_points={... |
AbhinavSingh-21f1002369/AFKZenCoders | PS12/api2.py | 344475e7d5d60c09637b0bec28c5dab1befe2b65 | from flask import Flask, render_template, request, jsonify,send_file, redirect,session, url_for
from werkzeug import secure_filename
import os
import utilities, queries
import logger
from flask_cors import CORS, cross_origin
from datetime import timedelta
app = Flask(__name__)
CORS(app)
cors = CORS(app, resources={r"/*... | [] |
Fassial/Air-Writing-with-TL | cnnblstm_with_adabn/cnnblstm_with_adabn.py | 9b9047c5bd5aef3a869e2d5166be1c0cf0c5ccf0 | import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import matplotlib.pyplot as plt
# local model
import sys
sys.path.append("../network")
import Coral
from lstm import LSTMHardSigmoid
from AdaBN import AdaBN
sys.path.append("../network/Aut... | [((189, 218), 'sys.path.append', 'sys.path.append', (['"""../network"""'], {}), "('../network')\n", (204, 218), False, 'import sys\n'), ((289, 330), 'sys.path.append', 'sys.path.append', (['"""../network/AutoEncoder"""'], {}), "('../network/AutoEncoder')\n", (304, 330), False, 'import sys\n'), ((13068, 13093), 'torch.c... |
woffett/emmental | src/emmental/model.py | 87884fcd89662cca45f0ea0f78cff73380cc47c8 | """Emmental model."""
import itertools
import logging
import os
from collections import defaultdict
from collections.abc import Iterable
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
import numpy as np
import torch
from numpy import ndarray
from torch import Tensor, nn as nn
from torch.nn i... | [((604, 631), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (621, 631), False, 'import logging\n'), ((14036, 14051), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (14049, 14051), False, 'import torch\n'), ((18511, 18526), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (18524, ... |
jangxx/OVRT_Soundpad | server/ws_server.py | 2f9b2cd19421bc7b5586a3dcded2998d381ba688 | import asyncio, json
from config import Config
from soundpad_manager import SoundpadManager
from version import BRIDGE_VERSION
import websockets
from sanic.log import logger
# yes I know that it's very lazy to run a separate WS and HTTP server, when both could be run on the same port
# I don't like sanics ... | [((886, 944), 'sanic.log.logger.info', 'logger.info', (['f"""Websocket server is running on port {port}"""'], {}), "(f'Websocket server is running on port {port}')\n", (897, 944), False, 'from sanic.log import logger\n'), ((3359, 3418), 'json.dumps', 'json.dumps', (["{'type': 'event', 'event': event, 'data': data}"], {... |
CityPulse/dynamic-bus-scheduling | tests/route_generator_test.py | 7516283be5a374fe0a27715f4facee11c847f39f | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
- LICENCE
The MIT License (MIT)
Copyright (c) 2016 Eleftherios Anagnostopoulos for Ericsson AB (EU FP7 CityPulse Project)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software... | [] |
gian1312/suchen | tensorforce/tests/test_model_save_restore.py | df863140fd8df1ac2e195cbdfa4756f09f962270 | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import unittest
import pytest
from tensorforce import TensorForceError
from tensorforce.core.networks import LayeredNetwork
from tensorforce.models import DistributionModel
from tensorforce.tests.minimal_test ... | [((944, 961), 'tensorforce.tests.minimal_test.MinimalTest', 'MinimalTest', (['spec'], {}), '(spec)\n', (955, 961), False, 'from tensorforce.tests.minimal_test import MinimalTest\n'), ((1591, 1619), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (1605, 1619), False, 'import pytest\n... |
lihuiba/SoftSAN | guid.py | 1b8ab2cae92b7aac34211909b27d4ebe595275d7 | import random
import messages_pb2 as msg
def assign(x, y):
x.a=y.a; x.b=y.b; x.c=y.c; x.d=y.d
def isZero(x):
return (x.a==0 and x.b==0 and x.c==0 and x.d==0)
def setZero(x):
x.a=0; x.b=0; x.c=0; x.d=0
def toStr(x):
return "%08x-%08x-%08x-%08x" % (x.a, x.b, x.c, x.d)
def toTuple(x):
return (x.a,... | [((363, 373), 'messages_pb2.Guid', 'msg.Guid', ([], {}), '()\n', (371, 373), True, 'import messages_pb2 as msg\n'), ((512, 541), 'random.randint', 'random.randint', (['(0)', '(4294967295)'], {}), '(0, 4294967295)\n', (526, 541), False, 'import random\n'), ((552, 581), 'random.randint', 'random.randint', (['(0)', '(4294... |
kronael/mango-explorer | mango/__init__.py | 6292c089c2a3d1ff2cf0b50b815849451a50ec39 | # In --strict mode, mypy complains about imports unless they're done this way.
#
# It complains 'Module has no attribute ABC' or 'Module "mango" does not explicitly export
# attribute "XYZ"; implicit reexport disabled'. We could dial that back by using the
# --implicit-reexport parameter, but let's keep things strict.
... | [((17390, 17410), 'decimal.getcontext', 'decimal.getcontext', ([], {}), '()\n', (17408, 17410), False, 'import decimal\n')] |
MariannaJan/LettersOfSherlock | letters_of_sherlock.py | cf356c002078d4e0e6bcf1a669bc8b358680460f | import lettercounter as lc
#Books form Gutenberg Project: https://www.gutenberg.org/ebooks/author/69
lc.showPlots(text_directory_pathname="./Books/",
title="Sir Arthur Conan Doyle's favourite letters",
legend_label_main="in Doyle's stories") | [((103, 253), 'lettercounter.showPlots', 'lc.showPlots', ([], {'text_directory_pathname': '"""./Books/"""', 'title': '"""Sir Arthur Conan Doyle\'s favourite letters"""', 'legend_label_main': '"""in Doyle\'s stories"""'}), '(text_directory_pathname=\'./Books/\', title=\n "Sir Arthur Conan Doyle\'s favourite letters",... |
mwaitzman/GOF2BountyBot | BB/bbObjects/items/bbTurret.py | b66026228b752b07ac4734ca74b60730dbd74995 | from .bbItem import bbItem
from ...bbConfig import bbData
class bbTurret(bbItem):
dps = 0.0
def __init__(self, name, aliases, dps=0.0, value=0, wiki="", manufacturer="", icon="", emoji=""):
super(bbTurret, self).__init__(name, aliases, value=value, wiki=wiki, manufacturer=manufacturer, icon=icon, emoj... | [] |
s-maibuecher/what_can_i_cook | what_can_i_cook/urls.py | 07d0eb1e1862fad299477b800654e895d7f8829a | from django.urls import path
from what_can_i_cook.views import WCICFilterView, WCICResultView
app_name = "wcic"
urlpatterns = [
path("", WCICFilterView.as_view(), name="wcic-start"),
path("results/", WCICResultView.as_view(), name="wcic-results"),
]
| [((145, 169), 'what_can_i_cook.views.WCICFilterView.as_view', 'WCICFilterView.as_view', ([], {}), '()\n', (167, 169), False, 'from what_can_i_cook.views import WCICFilterView, WCICResultView\n'), ((212, 236), 'what_can_i_cook.views.WCICResultView.as_view', 'WCICResultView.as_view', ([], {}), '()\n', (234, 236), False, ... |
justchris1/scap-security-guide | shared/templates/grub2_bootloader_argument/template.py | 030097afa80041fcdffc537a49c09896efedadca | import ssg.utils
def preprocess(data, lang):
data["arg_name_value"] = data["arg_name"] + "=" + data["arg_value"]
if lang == "oval":
# escape dot, this is used in oval regex
data["escaped_arg_name_value"] = data["arg_name_value"].replace(".", "\\.")
# replace . with _, this is used in t... | [] |
NNDEV1/NMTWithLuongAttention | preprocess.py | e6f11d9e8c5f999d413fa0dc51219e979a8f975c | import tensorflow as tf
import os
import contractions
import tensorflow as tf
import pandas as pd
import numpy as np
import time
import rich
from rich.progress import track
import spacy
from config import params
#Preprocessing Text
class preprocess_text():
def __init__(self):
pass
def remove_pa... | [((736, 758), 'contractions.fix', 'contractions.fix', (['text'], {}), '(text)\n', (752, 758), False, 'import contractions\n'), ((1591, 1619), 'spacy.load', 'spacy.load', (['"""en_core_web_sm"""'], {}), "('en_core_web_sm')\n", (1601, 1619), False, 'import spacy\n'), ((1635, 1664), 'spacy.load', 'spacy.load', (['"""de_co... |
johannesulf/dsigma | setup.py | 729337c94669f4a0fdacb51b175df1e13e26304c | from setuptools import setup, find_packages
from distutils.extension import Extension
from distutils.command.sdist import sdist
try:
from Cython.Build import cythonize
USE_CYTHON = True
except ImportError:
USE_CYTHON = False
ext = 'pyx' if USE_CYTHON else 'c'
extensions = [Extension(
'dsigma.precomput... | [((462, 483), 'Cython.Build.cythonize', 'cythonize', (['extensions'], {}), '(extensions)\n', (471, 483), False, 'from Cython.Build import cythonize\n'), ((548, 591), 'Cython.Build.cythonize', 'cythonize', (["['dsigma/precompute_engine.pyx']"], {}), "(['dsigma/precompute_engine.pyx'])\n", (557, 591), False, 'from Cython... |
jtfan3/face_detection | face_detector/modules/mod_faceDetection.py | 82e3bc839bf12c956f3166c07012912a0638048f | import cv2
import mediapipe as mp
class FaceDetection():
# initialize the face detection class with arguments from https://google.github.io/mediapipe/solutions/face_detection.html
def __init__(self, model_selection = 0, threshold = 0.5):
self.model_selection = model_selection
self.threshold = t... | [((410, 535), 'mediapipe.solutions.face_detection.FaceDetection', 'mp.solutions.face_detection.FaceDetection', ([], {'model_selection': 'self.model_selection', 'min_detection_confidence': 'self.threshold'}), '(model_selection=self.\n model_selection, min_detection_confidence=self.threshold)\n', (451, 535), True, 'im... |
bmj-hackathon/ethberlinzwei-babelfish_3_0 | backend/0_publish_audio.py | e986ad1b9fa896f20d7cdd296d130d804f55ecfa | import sys
import logging
# loggers_dict = logging.Logger.manager.loggerDict
#
# logger = logging.getLogger()
# logger.handlers = []
#
# # Set level
# logger.setLevel(logging.DEBUG)
#
# # FORMAT = "%(asctime)s - %(levelno)s - %(module)-15s - %(funcName)-15s - %(message)s"
# # FORMAT = "%(asctime)s %(levelno)s: %(modul... | [((1639, 1691), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Publish audio"""'}), "(description='Publish audio')\n", (1662, 1691), False, 'import argparse\n'), ((3251, 3276), 'squid_py.config.Config', 'Config', (['OCEAN_CONFIG_PATH'], {}), '(OCEAN_CONFIG_PATH)\n', (3257, 3276), False, ... |
guillerminaamorin/pyRofex | src/pyRofex/components/messages.py | 14fd623ab1f1a3213e51a9454485ed478912075f | # -*- coding: utf-8 -*-
"""
pyRofex.components.messages
Defines APIs messages templates
"""
# Template for a Market Data Subscription message
MARKET_DATA_SUBSCRIPTION = '{{"type":"smd","level":1, "entries":[{entries}],"products":[{symbols}]}}'
# Template for an Order Subscription message
ORDER_SUBSCRIPTION = ... | [] |
duboviy/async | course/task_6/flask_app.py | 5055daddc66e5335fb772aeb59493cc63e4a2739 | #!/usr/bin/env python3.4
from flask import Flask
import requests
from fibonacci import fibonacci as fib
app = Flask(__name__)
@app.route('/count/<key>')
def count(key):
return requests.get('http://127.0.0.1:8080/count/{}'.format(key)).text
@app.route('/fibonacci/<n>')
def fibonacci(n):
return str(fib(int(... | [((112, 127), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (117, 127), False, 'from flask import Flask\n')] |
Patralos/nexpose-client-python | nexpose/nexpose_vulnerabilityexception.py | bec81da29883b1b004046e29a9e7f7a6686467c1 | # Future Imports for py2/3 backwards compat.
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from builtins import object
from .xml_utils import get_attribute, get_content_of
from future import standard_library
standard_library.install_aliases()
def fix_null... | [((271, 305), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (303, 305), False, 'from future import standard_library\n')] |
captainTOKIO/Premchand_Aug2022_fullstack_august_python1 | myproject/IND_Project/backend/signup/apps.py | 5fbbdd106a764c2f862cf933fdcd69d6bf4ebdf0 | from django.apps import AppConfig
class SignupConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'signup'
| [] |
cherish-web/pymc | pymc/mc_enum.py | 9c322abfdcceca0a78b633d85da23e1290c036c8 | # _*_ coding: utf-8 _*_
# @Time : 2021/3/29 上午 08:57
# @Author : cherish_peng
# @Email : 1058386071@qq.com
# @File : cmd.py
# @Software : PyCharm
from enum import Enum
class EnumSubTitle(Enum):
Request4e = 0x5400
# 请求
Request = 0x5000
# 应答
Respond = 0xD000
Respond4e = 0xD400
class EnumEndC... | [] |
getsentry/sentry-data-schemas | py/sentry_data_schemas/__init__.py | 6b49188a66a24663737c4f5cf4708fe992d011c2 | from importlib.resources import path
from jsonschema_typed import JSONSchema
with path("sentry_data_schemas", "event.schema.json") as schema_path:
EventData = JSONSchema["var:sentry_data_schemas:schema_path"]
| [((83, 131), 'importlib.resources.path', 'path', (['"""sentry_data_schemas"""', '"""event.schema.json"""'], {}), "('sentry_data_schemas', 'event.schema.json')\n", (87, 131), False, 'from importlib.resources import path\n')] |
faroit/deep-fireball | predict.py | b37d08cb5b15359c363e7816fc7c163c1709a5ac | # elsewhere...
import pandas as pd
from keras.models import model_from_json
import random
import sys
import numpy as np
maxlen = 15
step = 3
df = pd.read_pickle('articles.pandas')
text = str.join(' ', df.text.tolist())
chars = set(text)
print('total chars:', len(chars))
char_indices = dict((c, i) for i, c in enumer... | [((149, 182), 'pandas.read_pickle', 'pd.read_pickle', (['"""articles.pandas"""'], {}), "('articles.pandas')\n", (163, 182), True, 'import pandas as pd\n'), ((1068, 1095), 'sys.stdout.write', 'sys.stdout.write', (['generated'], {}), '(generated)\n', (1084, 1095), False, 'import sys\n'), ((708, 717), 'numpy.log', 'np.log... |
Zavioer/SIR-simulation-IBM-ESI | tests/simulation/test_container.py | 45a7b1d4f0e3cec8dcd8284e00f25386b6e77c58 | import unittest
from simulation import container
from simulation import person
class ContainerTestCase(unittest.TestCase):
def setUp(self) -> None:
self.box = container.Container(100, 1000, 300, 1, 0.5)
self.s_instance = person.Person(x=0, y=0, infection_probability=0.25,
... | [((4184, 4199), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4197, 4199), False, 'import unittest\n'), ((173, 216), 'simulation.container.Container', 'container.Container', (['(100)', '(1000)', '(300)', '(1)', '(0.5)'], {}), '(100, 1000, 300, 1, 0.5)\n', (192, 216), False, 'from simulation import container\n'),... |
Tratty/pontoon | pontoon/base/migrations/0007_auto_20150710_0944.py | ecb903d72f9274f02137b16669cc3c5859f6329c | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import pontoon.base.models
class Migration(migrations.Migration):
dependencies = [
("base", "0006_auto_20150602_0616"),
]
operations = [
migrations.AddField(
model_name="... | [((380, 523), 'django.db.models.CommaSeparatedIntegerField', 'models.CommaSeparatedIntegerField', ([], {'blank': '(True)', 'max_length': '(11)', 'verbose_name': "b'CLDR Plurals'", 'validators': '[pontoon.base.models.validate_cldr]'}), "(blank=True, max_length=11, verbose_name=\n b'CLDR Plurals', validators=[pontoon.... |
ufo2011/platformio-core | platformio/project/commands/init.py | 0ceae62701731f8b32c34d7993a34dea34aea59c | # Copyright (c) 2014-present PlatformIO <contact@platformio.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 appli... | [((1497, 1572), 'click.command', 'click.command', (['"""init"""'], {'short_help': '"""Initialize a project or update existing"""'}), "('init', short_help='Initialize a project or update existing')\n", (1510, 1572), False, 'import click\n'), ((1759, 1848), 'click.option', 'click.option', (['"""-b"""', '"""--board"""'], ... |
DeveloperLY/Python-practice | 12_module_release/message/__init__.py | 85062afee1dc6b60b7011b0e3800b65fc9b9e9b2 | from . import send_message
from . import receive_message | [] |
peopledoc/django-guardian | guardian/decorators.py | 459827c2329975113cbf0d11f4fd476b5689a055 | from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseForbidden, HttpResponseRedirect
from django.utils.functional import wraps
from django.utils.http import urlquote
from django.db.models import Model... | [] |
mpgarate/OST-fauxra | images/forms.py | d2aa554a082b14268c72220a0b19f2a306deb4d2 | from django import forms
from django.forms import ModelForm
from images.models import Image
class ImageForm(ModelForm):
class Meta:
model = Image
| [] |
MORIMOTO520212/Arm-crawler | WebIOPi-0.7.1/python/webiopi/devices/analog/__init__.py | 95dca0ea9485e4c20a0910687362010604331b55 | # Copyright 2012-2013 Eric Ptak - trouch.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | [((1370, 1400), 'webiopi.decorators.rest.request', 'request', (['"""GET"""', '"""analog/count"""'], {}), "('GET', 'analog/count')\n", (1377, 1400), False, 'from webiopi.decorators.rest import request, response\n'), ((1406, 1420), 'webiopi.decorators.rest.response', 'response', (['"""%d"""'], {}), "('%d')\n", (1414, 142... |
dtroyer/osc-loco | osc_choochoo/tests/v1/test_train.py | 57119ab84528933da9cbcd57dcd4f5b842a58186 | # Copyright 2013 Nebula 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 agreed to... | [((1438, 1469), 'osc_choochoo.v1.train.TrainList', 'train.TrainList', (['self.app', 'None'], {}), '(self.app, None)\n', (1453, 1469), False, 'from osc_choochoo.v1 import train\n'), ((2209, 2240), 'osc_choochoo.v1.train.TrainShow', 'train.TrainShow', (['self.app', 'None'], {}), '(self.app, None)\n', (2224, 2240), False,... |
darioncassel/OmniCrawl | scripts/firefox-wrapper.py | 62317e07340df7eb758a1b8de80679b6d4293d49 | #!/usr/bin/env python3
import sys
from os.path import dirname, abspath, join
import subprocess
# Note this does not resolve symbolic links
# https://stackoverflow.com/a/17806123
FIREFOX_BINARY = join(dirname(abspath(__file__)), 'firefox')
argvs = list(sys.argv)
argvs[0] = FIREFOX_BINARY
# geckdriver will run `firef... | [((1105, 1133), 'subprocess.check_call', 'subprocess.check_call', (['argvs'], {}), '(argvs)\n', (1126, 1133), False, 'import subprocess\n'), ((417, 445), 'subprocess.check_call', 'subprocess.check_call', (['argvs'], {}), '(argvs)\n', (438, 445), False, 'import subprocess\n'), ((210, 227), 'os.path.abspath', 'abspath', ... |
whiteyhat/pretix | src/pretix/base/payment.py | 34d1fcf077a92765cd796d81d1aa6695d4801a9a | import json
import logging
from collections import OrderedDict
from decimal import ROUND_HALF_UP, Decimal
from typing import Any, Dict, Union
import pytz
from django import forms
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.dispatch import receiver
from django.fo... | [((1331, 1358), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1348, 1358), False, 'import logging\n'), ((36977, 37042), 'django.dispatch.receiver', 'receiver', (['register_payment_providers'], {'dispatch_uid': '"""payment_free"""'}), "(register_payment_providers, dispatch_uid='payment_f... |
sag-tgo/EPL_assert_demo | tests/AssertFail/run.py | a43541e4472dfab7da6538ae9f220b5e042d158c | from pysys.basetest import BaseTest
from apama.correlator import CorrelatorHelper
import os
class PySysTest(BaseTest):
def execute(self):
corr = CorrelatorHelper(self, name='correlator')
corr.start(logfile='correlator.log')
corr.injectEPL(os.getenv('APAMA_HOME','') + '/monitors/ManagementImpl.mon')
corr.injec... | [((149, 190), 'apama.correlator.CorrelatorHelper', 'CorrelatorHelper', (['self'], {'name': '"""correlator"""'}), "(self, name='correlator')\n", (165, 190), False, 'from apama.correlator import CorrelatorHelper\n'), ((247, 274), 'os.getenv', 'os.getenv', (['"""APAMA_HOME"""', '""""""'], {}), "('APAMA_HOME', '')\n", (256... |
Ziftr/stellard | src/beast/python/beast/env/ReadEnvFile_test.py | 626514cbbb2c6c2b6844315ca98a2bfcbca0b43d | from __future__ import absolute_import, division, print_function, unicode_literals
from unittest import TestCase
from beast.env.ReadEnvFile import read_env_file
from beast.util import Terminal
Terminal.CAN_CHANGE_COLOR = False
JSON = """
{
"FOO": "foo",
"BAR": "bar bar bar",
"CPPFLAGS": "-std=c++11 -frtti -fno... | [((805, 824), 'beast.env.ReadEnvFile.read_env_file', 'read_env_file', (['JSON'], {}), '(JSON)\n', (818, 824), False, 'from beast.env.ReadEnvFile import read_env_file\n'), ((883, 901), 'beast.env.ReadEnvFile.read_env_file', 'read_env_file', (['ENV'], {}), '(ENV)\n', (896, 901), False, 'from beast.env.ReadEnvFile import ... |
pptnz/swa_team2 | signin/tests.py | 253ae83d73c00245d359574d6a16f4eba9830950 | import json
from django.test import TestCase
from django.contrib.auth.models import User
from .models import CustomUser
from django.apps import apps
from .apps import SigninConfig
class SignInTest(TestCase):
def setUp(self):
self.django_user = User.objects.create_user(username='testusername', password='t... | [((259, 333), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', ([], {'username': '"""testusername"""', 'password': '"""testpassword"""'}), "(username='testusername', password='testpassword')\n", (283, 333), False, 'from django.contrib.auth.models import User\n'), ((522, 551), 'django.a... |
EliHar/BinaryTree-ADT | tree/list/BinaryNode.py | bf220eb8ccb04f6fee7d7a67ef7e9cd00cc6a4c1 | __author__ = 'Elias Haroun'
class BinaryNode(object):
def __init__(self, data, left, right):
self.data = data
self.left = left
self.right = right
def getData(self):
return self.data
def getLeft(self):
return self.left
def getRight(self):
return self.r... | [] |
AbrahmAB/booleannet | boolean2/tokenizer.py | a07124047d18a5b7265e050a234969ac58970c7a | """
Main tokenizer.
"""
from itertools import *
import sys, random
import util
import ply.lex as lex
class Lexer:
"""
Lexer for boolean rules
"""
literals = '=*,'
tokens = (
'LABEL', 'ID','STATE', 'ASSIGN', 'EQUAL',
'AND', 'OR', 'NOT',
'NUMBER', 'LPAREN','RPAREN', 'COMMA'... | [] |
tomzhang/aiida_core | aiida/cmdline/params/options/test_interactive.py | 949810e9f3daff0f748c5c9aa1dde4f5222bb49b | """Unit tests for the InteractiveOption."""
from __future__ import absolute_import
import unittest
import click
from click.testing import CliRunner
from click.types import IntParamType
from aiida.cmdline.params.options.interactive import InteractiveOption
from aiida.cmdline.params.options import NON_INTERACTIVE
cla... | [((1079, 1094), 'click.command', 'click.command', ([], {}), '()\n', (1092, 1094), False, 'import click\n'), ((1104, 1172), 'click.option', 'click.option', (['"""--opt"""'], {'prompt': '"""Opt"""', 'cls': 'InteractiveOption'}), "('--opt', prompt='Opt', cls=InteractiveOption, **kwargs)\n", (1116, 1172), False, 'import cl... |
fabmiz/osf.io | scripts/migration/migrate_registered_meta.py | 8d86af3f0a6e5388bd5b18383e68e27b65a66247 | """
Changes existing registered_meta on a node to new schema layout
required for the prereg-prize
"""
import json
import sys
import logging
from modularodm import Q
from framework.mongo import database as db
from framework.mongo.utils import from_mongo
from framework.transactions.context import TokuTransaction
from ... | [((497, 524), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (514, 524), False, 'import logging\n'), ((1081, 1103), 'website.app.init_app', 'init_app', ([], {'routes': '(False)'}), '(routes=False)\n', (1089, 1103), False, 'from website.app import init_app\n'), ((1138, 1185), 'scripts.util... |
hypernicon/pyec | pyec/distribution/bayes/structure/basic.py | 7072835c97d476fc45ffc3b34f5c3ec607988e6d | """
Copyright (C) 2012 Alan J Lockett
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,... | [] |
pingrunhuang/CodeChallenge | graph/tsp.py | a8e5274e04c47d851836197907266418af4f1a22 | """
given a fully connected undirected graph(If no path exists between two cities, adding an arbitrarily long edge will complete the graph without affecting the optimal tour),
find the path with the lowest cost in total for a salesman to travel from a given start vertex
"""
import time
class Edge:
def __init__(sel... | [] |
only-romano/junkyard | projects/code_combat/8_Cloudrip_Mountain/471-Distracting_Dungeon/distracting_dungeon.py | b60a25b2643f429cdafee438d20f9966178d6f36 | def moveBothTo(point):
while hero.distanceTo(point) > 1:
hero.move(point)
hero.command(peasant, "move", point)
peasant = hero.findNearest(hero.findFriends())
while True:
hero.command(peasant, "buildXY", "decoy", peasant.pos.x + 2, peasant.pos.y)
var nextPoint = {"x": hero.pos.x,... | [] |
pflun/learningAlgorithms | firstBadVersion.py | 3101e989488dfc8a56f1bf256a1c03a837fe7d97 | # The isBadVersion API is already defined for you.
# @param version, an integer
# @return a bool
# def isBadVersion(version):
class Solution(object):
def firstBadVersion(self, n):
start = 1
end = n
while start + 1 < end:
mid = start + (end - start) / 2
if isBadVersi... | [] |
QizaiMing/ergo-project-manager | issues/migrations/0001_initial.py | 2b02b2ab6d9e48bfccbbca8c05180b07177dcb77 | # Generated by Django 2.2.12 on 2020-05-01 03:34
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
op... | [((248, 305), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (279, 305), False, 'from django.db import migrations, models\n'), ((435, 528), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
ffffff0x/python-hacker | com/binghe/hacker/tools/script/ak/check_virus.py | a2dc7f9031669a86bd2c87892c0a8c1e54bb2a79 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: gbk -*-
# Date: 2019/2/22
# Created by 冰河
# Description 将生成的bindshell.exe提交到vscan.novirusthanks.org检测
# 用法 python check_virus.py -f bindshell.exe
# 博客 https://blog.csdn.net/l1028386804
import re
import httplib
import time
import os
import optparse... | [] |
LoganHaug/reminder-bot | cogs/remind.py | 1bb1853b79e0299240a214e947e8bc29ed34e46e | import asyncio
from typing import Union
import datetime
import time
from discord.ext import commands
import yaml
from cogs import checks
import database
import utils
# Loads the repeating interval dictionary
with open("conversions.yml", "r") as conversion_file:
conversion_dict = yaml.load(conversion_file, Loade... | [((346, 364), 'utils.get_prefix', 'utils.get_prefix', ([], {}), '()\n', (362, 364), False, 'import utils\n'), ((288, 334), 'yaml.load', 'yaml.load', (['conversion_file'], {'Loader': 'yaml.Loader'}), '(conversion_file, Loader=yaml.Loader)\n', (297, 334), False, 'import yaml\n'), ((3895, 4313), 'discord.ext.commands.comm... |
csengor/toraman_py | setup.py | 5cb7b39ae073ecc2adcb7cea83b79492ac5aa485 | import setuptools
from toraman.version import __version__
with open('README.md', 'r') as input_file:
long_description = input_file.read()
setuptools.setup(
name='toraman',
version=__version__,
author='Çağatay Onur Şengör',
author_email='contact@csengor.com',
description='A computer-assisted t... | [((615, 641), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (639, 641), False, 'import setuptools\n')] |
li-ar/declarations.com.ua | declarations_site/cms_pages/migrations/0015_auto_20150615_0201.py | 343cd86cc5a4bd895f2859ed896728f6416ac223 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms_pages', '0014_homepage_news_count'),
]
operations = [
migrations.AlterField(
model_name='newspage',
... | [((355, 403), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'verbose_name': '"""Лід"""'}), "(blank=True, verbose_name='Лід')\n", (371, 403), False, 'from django.db import models, migrations\n')] |
nightlessbaron/pytorch-lightning | tests/models/test_grad_norm.py | 239bea5c29cef0d1a0cfb319de5dbc9227aa2a53 | # Copyright The PyTorch Lightning team.
#
# 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 i... | [((2047, 2097), 'unittest.mock.patch.dict', 'mock.patch.dict', (['os.environ', "{'PL_DEV_DEBUG': '1'}"], {}), "(os.environ, {'PL_DEV_DEBUG': '1'})\n", (2062, 2097), False, 'from unittest import mock\n'), ((2099, 2168), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""norm_type"""', "[1.0, 1.25, 2, 3, 5, 10, ... |
junjun315/tensorflow | tensorflow/tools/compatibility/renames_v2.py | 40b800fc24e1eea8642b79087925939121e8e25f | # Copyright 2018 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 applica... | [] |
Canpio/models | deep_speech_2/decoder.py | 72874de98fba93592edee42b776e3d876b1d5504 | """
CTC-like decoder utilitis.
"""
from itertools import groupby
import numpy as np
def ctc_best_path_decode(probs_seq, vocabulary):
"""
Best path decoding, also called argmax decoding or greedy decoding.
Path consisting of the most probable tokens are further post-processed to
remove consecutive... | [((1104, 1127), 'itertools.groupby', 'groupby', (['max_index_list'], {}), '(max_index_list)\n', (1111, 1127), False, 'from itertools import groupby\n'), ((973, 992), 'numpy.array', 'np.array', (['probs_seq'], {}), '(probs_seq)\n', (981, 992), True, 'import numpy as np\n')] |
Humbedooh/infrastructure-puppet | modules/gitbox/files/asfgit/hooks/sync.py | a85f797d847b80e877cd5b7c66513970f6f80703 | #!/usr/local/bin/python
import json
import socket
import sys
import asfgit.cfg as cfg
import asfgit.git as git
import asfgit.log as log
import asfgit.util as util
import subprocess, os, time
def main():
ghurl = "git@github:apache/%s.git" % cfg.repo_name
os.chdir("/x1/repos/asf/%s.git" % cfg.repo_name)
tr... | [((265, 313), 'os.chdir', 'os.chdir', (["('/x1/repos/asf/%s.git' % cfg.repo_name)"], {}), "('/x1/repos/asf/%s.git' % cfg.repo_name)\n", (273, 313), False, 'import subprocess, os, time\n'), ((341, 367), 'asfgit.git.stream_refs', 'git.stream_refs', (['sys.stdin'], {}), '(sys.stdin)\n', (356, 367), True, 'import asfgit.gi... |
asmodehn/rosimport | rosimport/_rosdef_loader.py | c63e4769650b1cf19f23fbaa65a356ffae20a536 | from __future__ import absolute_import, division, print_function
import contextlib
import importlib
import site
import tempfile
import shutil
from rosimport import genrosmsg_py, genrossrv_py
"""
A module to setup custom importer for .msg and .srv files
Upon import, it will first find the .msg file, then generate t... | [((2094, 2132), 'importlib.import_module', 'importlib.import_module', (["(item + '.msg')"], {}), "(item + '.msg')\n", (2117, 2132), False, 'import importlib\n'), ((5560, 5581), 'tempfile.gettempdir', 'tempfile.gettempdir', ([], {}), '()\n', (5579, 5581), False, 'import tempfile\n'), ((5668, 5695), 'logging.getLogger', ... |
Ahuge/PyLeague | PyLeague/logger.py | ee8a14061c44c1c26a5102a05e33ad820f2b1b63 | import sys
def color(text, color):
if color == "blue":
color = "0;34m"
elif color == "green":
color = "0;32m"
elif color == "red":
color = "0;31m"
elif color == "yellow":
color = "0;33m"
else:
return text
return "\033[%s%s\033[0m\n" % (color, text)
cla... | [] |
swtwsk/dbt-airflow-manifest-parser | setup.py | fae0049fb8ff3bc7a78488a48a31023f67fbeef3 | """dbt_airflow_factory module."""
from setuptools import find_packages, setup
with open("README.md") as f:
README = f.read()
# Runtime Requirements.
INSTALL_REQUIRES = ["pytimeparse==1.1.8"]
# Dev Requirements
EXTRA_REQUIRE = {
"tests": [
"pytest>=6.2.2, <7.0.0",
"pytest-cov>=2.8.0, <3.0.0",... | [((1299, 1363), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['ez_setup', 'examples', 'tests', 'docs']"}), "(exclude=['ez_setup', 'examples', 'tests', 'docs'])\n", (1312, 1363), False, 'from setuptools import find_packages, setup\n')] |
jmb/NightLightPi | nightlightpi/errorstrings.py | 82f5d37a35e3457e31ca100524011908e5b33c4d | # -*- coding: utf-8; -*-
"""Define error strings raised by the application."""
MISSING_CONFIG_VALUE = """
'{0}' is not specified or invalid in the config file!
""".strip()
| [] |
European-XFEL/karabo-bridge-py | karabo_bridge/tests/test_serialize.py | c4b2847b837ae7156640cb8f787fcf96ac7f632e | import numpy as np
import pytest
from karabo_bridge import serialize, deserialize
from .utils import compare_nested_dict
def test_serialize(data, protocol_version):
msg = serialize(data, protocol_version=protocol_version)
assert isinstance(msg, list)
d, m = deserialize(msg)
compare_nested_dict(data... | [((179, 229), 'karabo_bridge.serialize', 'serialize', (['data'], {'protocol_version': 'protocol_version'}), '(data, protocol_version=protocol_version)\n', (188, 229), False, 'from karabo_bridge import serialize, deserialize\n'), ((275, 291), 'karabo_bridge.deserialize', 'deserialize', (['msg'], {}), '(msg)\n', (286, 29... |
bpedersen2/indico | indico/testing/fixtures/util.py | 8410ee5f8f8530a8692f3dd2d4015c3074b0aa30 | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import inspect
from datetime import datetime
import freezegun
import pytest
from sqlalchemy import DateTi... | [((797, 838), 'inspect.getmembers', 'inspect.getmembers', (['cls', 'inspect.ismethod'], {}), '(cls, inspect.ismethod)\n', (815, 838), False, 'import inspect\n'), ((1848, 1885), 'freezegun.freeze_time', 'freezegun.freeze_time', (['time_to_freeze'], {}), '(time_to_freeze)\n', (1869, 1885), False, 'import freezegun\n'), (... |
RomashkaGang/Update_Checker | config.py | 1763ec5d8110462a72f5015abdc5c5be3e3c9498 | #!/usr/bin/env python3
# encoding: utf-8
import os
# 是否启用调试 若启用 将不再忽略检查过程中发生的任何异常
# 建议在开发环境中启用 在生产环境中禁用
DEBUG_ENABLE = False
# SQLite 数据库文件名
SQLITE_FILE = "saved.db"
# 日志文件名
LOG_FILE = "log.txt"
# 是否启用日志
ENABLE_LOGGER = True
# 循环检查的间隔时间(默认: 180分钟)
LOOP_CHECK_INTERVAL = 180 * 60
# 代理服务器
PROXIES = "127.0.0.1:1080"... | [((453, 483), 'os.environ.get', 'os.environ.get', (['"""TG_TOKEN"""', '""""""'], {}), "('TG_TOKEN', '')\n", (467, 483), False, 'import os\n'), ((508, 539), 'os.environ.get', 'os.environ.get', (['"""TG_SENDTO"""', '""""""'], {}), "('TG_SENDTO', '')\n", (522, 539), False, 'import os\n')] |
zjj1002/aws-cloud-cmdb-system | cmdb-compliance/biz/handlers/asset_hipaa_data.py | 47982007688e5db1272435891cb654ab11d0d60a | from sqlalchemy import or_
from websdk.db_context import DBContext
from libs.base_handler import BaseHandler
from libs.pagination import pagination_util
from models.hipaa_data import HipaaData, model_to_dict
class HipaaDataHandler(BaseHandler):
@pagination_util
def get(self, *args, **kwargs):
key = s... | [((412, 426), 'websdk.db_context.DBContext', 'DBContext', (['"""r"""'], {}), "('r')\n", (421, 426), False, 'from websdk.db_context import DBContext\n'), ((1480, 1499), 'models.hipaa_data.model_to_dict', 'model_to_dict', (['data'], {}), '(data)\n', (1493, 1499), False, 'from models.hipaa_data import HipaaData, model_to_... |
hellocit/kadai2 | scripts/count.py | 896acc2394ea522d4b0d32db31321aea5b5f5dbd | #!/usr/bin/env python3
import rospy
from std_msgs.msg import Int32
import time
rospy.init_node('count') # ノード名「count」に設定
pub = rospy.Publisher('count_up', Int32, queue_size=1) # パブリッシャ「count_up」を作成
rate = rospy.Rate(10) # 10Hzで実行
n = 0
time.sleep(2)
w... | [((80, 104), 'rospy.init_node', 'rospy.init_node', (['"""count"""'], {}), "('count')\n", (95, 104), False, 'import rospy\n'), ((159, 207), 'rospy.Publisher', 'rospy.Publisher', (['"""count_up"""', 'Int32'], {'queue_size': '(1)'}), "('count_up', Int32, queue_size=1)\n", (174, 207), False, 'import rospy\n'), ((238, 252),... |
alexanderfefelov/nav-add-ons | snmp/nav/smidumps/ZyXEL_GS4012F_mib.py | c63d6942a9b8b1bf220efd7d33fb6be5f6bbb8af | # python version 1.0 DO NOT EDIT
#
# Generated by smidump version 0.4.8:
#
# smidump -f python ZYXEL-GS4012F-MIB
FILENAME = "mibs/ZyXEL/zyxel-GS4012F.mib"
MIB = {
"moduleName" : "ZYXEL-GS4012F-MIB",
"ZYXEL-GS4012F-MIB" : {
"nodetype" : "module",
"language" : "SMIv2",
"organizat... | [] |
yutiansut/RxPY | rx/concurrency/timeoutscheduler.py | c3bbba77f9ebd7706c949141725e220096deabd4 | import logging
from threading import Timer
from datetime import timedelta
from rx.core import Scheduler, Disposable
from rx.disposables import SingleAssignmentDisposable, CompositeDisposable
from .schedulerbase import SchedulerBase
log = logging.getLogger("Rx")
class TimeoutScheduler(SchedulerBase):
"""A sched... | [((241, 264), 'logging.getLogger', 'logging.getLogger', (['"""Rx"""'], {}), "('Rx')\n", (258, 264), False, 'import logging\n'), ((507, 535), 'rx.disposables.SingleAssignmentDisposable', 'SingleAssignmentDisposable', ([], {}), '()\n', (533, 535), False, 'from rx.disposables import SingleAssignmentDisposable, CompositeDi... |
edomin/vgazer | vgazer/version/custom_checker/inputproto.py | 3ffe64f2517cbfbe0b0292bacc9fbf7391687e76 | import requests
from bs4 import BeautifulSoup
def Check(auth, mirrors):
response = requests.get("https://www.x.org/releases/individual/proto/")
html = response.content.decode("utf-8")
parsedHtml = BeautifulSoup(html, "html.parser")
links = parsedHtml.find_all("a")
maxVersionMajor = -1
maxVers... | [((88, 148), 'requests.get', 'requests.get', (['"""https://www.x.org/releases/individual/proto/"""'], {}), "('https://www.x.org/releases/individual/proto/')\n", (100, 148), False, 'import requests\n'), ((210, 244), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (22... |
briangrahamww/pandas-profiling | src/pandas_profiling/model/summary_helpers.py | 62f8e3fd81720d444041069191c4aacd03d79ad5 | import os
import string
from collections import Counter
from datetime import datetime
from functools import partial
from pathlib import Path
from typing import Optional
import numpy as np
import pandas as pd
from scipy.stats.stats import chisquare
from tangled_up_in_unicode import block, block_abbr, categor... | [((5143, 5159), 'pandas_profiling.model.summary_helpers_image.open_image', 'open_image', (['path'], {}), '(path)\n', (5153, 5159), False, 'from pandas_profiling.model.summary_helpers_image import extract_exif, hash_image, is_image_truncated, open_image\n'), ((7511, 7541), 'pandas.Series', 'pd.Series', (['counts'], {'in... |
ZephyrII/competitive_colaboration | inverse_warp.py | a557d1e23ef2c0b8e3794f085a79bfffb860f9df | # Author: Anurag Ranjan
# Copyright (c) 2019, Anurag Ranjan
# All rights reserved.
# based on github.com/ClementPinard/SfMLearner-Pytorch
from __future__ import division
import torch
from torch.autograd import Variable
pixel_coords = None
def set_id_grid(depth):
global pixel_coords
b, h, w = depth.size()
... | [((590, 634), 'torch.stack', 'torch.stack', (['(j_range, i_range, ones)'], {'dim': '(1)'}), '((j_range, i_range, ones), dim=1)\n', (601, 634), False, 'import torch\n'), ((3022, 3058), 'torch.stack', 'torch.stack', (['[X_norm, Y_norm]'], {'dim': '(2)'}), '([X_norm, Y_norm], dim=2)\n', (3033, 3058), False, 'import torch\... |
ramonsanabria/lingvo | lingvo/core/egdd.py | f38dc3801d36ed08a4117d4a66e6f1f10f76909d | # Lint as: python2, python3
# Copyright 2020 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
#
... | [((4580, 4638), 'tensorflow.python.framework.ops.convert_to_tensor', 'ops.convert_to_tensor', (['learning_rate'], {'name': '"""learning_rate"""'}), "(learning_rate, name='learning_rate')\n", (4601, 4638), False, 'from tensorflow.python.framework import ops\n'), ((4730, 4778), 'tensorflow.python.framework.ops.convert_to... |
cloudspectatordevelopment/cudamat | examples/nn_cudamat.py | d26cf019a7855077b7d4344ae1a3202a156c5170 | # This file shows how to implement a single hidden layer neural network for
# performing binary classification on the GPU using cudamat.
from __future__ import division
import pdb
import time
import numpy as np
import cudamat as cm
from cudamat import learn as cl
import util
# initialize CUDA
cm.cublas_init()
# load... | [((296, 312), 'cudamat.cublas_init', 'cm.cublas_init', ([], {}), '()\n', (310, 312), True, 'import cudamat as cm\n'), ((506, 530), 'cudamat.CUDAMatrix', 'cm.CUDAMatrix', (['dat_train'], {}), '(dat_train)\n', (519, 530), True, 'import cudamat as cm\n'), ((541, 565), 'cudamat.CUDAMatrix', 'cm.CUDAMatrix', (['lbl_train'],... |
znicholls/FAIR | fair/forcing/ozone_tr.py | 599c44ed140b069968ba7d1ca99de40218e42545 | from __future__ import division
import numpy as np
from ..constants import molwt
def regress(emissions,
beta=np.array([2.8249e-4, 1.0695e-4, -9.3604e-4, 99.7831e-4])):
"""Calculates tropospheric ozone forcing from precursor emissions.
Inputs: (nt x 40) emissions array
Keywords:
beta... | [((123, 182), 'numpy.array', 'np.array', (['[0.00028249, 0.00010695, -0.00093604, 0.00997831]'], {}), '([0.00028249, 0.00010695, -0.00093604, 0.00997831])\n', (131, 182), True, 'import numpy as np\n'), ((964, 994), 'numpy.array', 'np.array', (['[722, 170, 10, 4.29]'], {}), '([722, 170, 10, 4.29])\n', (972, 994), True, ... |
oarepo/oarepo-references-draft | tests/test_publish.py | 7e5ad4225c4ace9781d5de952c3765a65b33fd8e | import uuid
from invenio_indexer.api import RecordIndexer
from invenio_pidstore.models import PersistentIdentifier, PIDStatus
from invenio_records_draft.api import RecordContext
from invenio_records_draft.proxies import current_drafts
from invenio_search import RecordsSearch, current_search, current_search_client
from... | [((501, 529), 'tests.helpers.disable_test_authenticated', 'disable_test_authenticated', ([], {}), '()\n', (527, 529), False, 'from tests.helpers import disable_test_authenticated\n'), ((1906, 1945), 'invenio_search.current_search_client.indices.refresh', 'current_search_client.indices.refresh', ([], {}), '()\n', (1943,... |
xiaotiansf/tiscamera | examples/ROS/tiscamera.py | 8451449788f7429621240e2bbce065d65c5ac10e | import os
import subprocess
from collections import namedtuple
import gi
gi.require_version("Gst", "1.0")
gi.require_version("Tcam", "0.1")
from gi.repository import Tcam, Gst, GLib, GObject
DeviceInfo = namedtuple("DeviceInfo", "status name identifier connection_type")
CameraProperty = namedtuple("CameraProperty", ... | [((74, 106), 'gi.require_version', 'gi.require_version', (['"""Gst"""', '"""1.0"""'], {}), "('Gst', '1.0')\n", (92, 106), False, 'import gi\n'), ((107, 140), 'gi.require_version', 'gi.require_version', (['"""Tcam"""', '"""0.1"""'], {}), "('Tcam', '0.1')\n", (125, 140), False, 'import gi\n'), ((207, 273), 'collections.n... |
bertrand-caron/cv_blog_flask | helpers/config.py | ce779db31805f0b1a7bbc9a6f09a7d3fe1af74b2 | from typing import Dict, Any
from yaml import load
def get_config() -> Dict[str, Any]:
try:
return load(open('config/config.yml').read())
except Exception as e:
raise Exception('ERROR: Missing config/config.yml file.') from e
CONFIG = get_config()
| [] |
falckt/raman | raman/unmixing.py | 8f9fae0e211dd49cebaba98e71787bb663be8fcf | # Author: Tillmann Falck <tf-raman@lucidus.de>
#
# License: BSD 3 clause
#
# SPDX-License-Identifier: BSD-3-Clause
import collections
from itertools import product
import cvxpy as cp
import numpy as np
def sunsal_tv(A, Y, lambda_1, lambda_tv, sweep='prod', tv_type='iso', additional_constraint='none'):
r"""
S... | [((2598, 2660), 'cvxpy.Variable', 'cp.Variable', (['(lib_size, num_samples)'], {'nonneg': 'positive_solution'}), '((lib_size, num_samples), nonneg=positive_solution)\n', (2609, 2660), True, 'import cvxpy as cp\n'), ((2678, 2706), 'cvxpy.Parameter', 'cp.Parameter', (['(1)'], {'nonneg': '(True)'}), '(1, nonneg=True)\n', ... |
ucsb-cs48-w19/6pm-stock-trading | test_stock.py | daf70b684c15182753d8ca9b820238cf9cd5b75c | import pytest
def test_stock():
assert(0 == 0)
| [] |
damirishpreet/TM1py | TM1py/Objects/ElementAttribute.py | 8482d0787fd5a9e5eb05a0288c41b75fc1fc93ac | # -*- coding: utf-8 -*-
import json
from TM1py.Objects.TM1Object import TM1Object
class ElementAttribute(TM1Object):
""" Abstraction of TM1 Element Attributes
"""
valid_types = ['NUMERIC', 'STRING', 'ALIAS']
def __init__(self, name, attribute_type):
self.name = name
self.attrib... | [((973, 1022), 'json.dumps', 'json.dumps', (['self.body_as_dict'], {'ensure_ascii': '(False)'}), '(self.body_as_dict, ensure_ascii=False)\n', (983, 1022), False, 'import json\n'), ((1121, 1158), 'json.loads', 'json.loads', (['element_attribute_as_json'], {}), '(element_attribute_as_json)\n', (1131, 1158), False, 'impor... |
MaherClinc/stockly-bs | account.py | 4a2c5741673b85bee9100afef0b404520cb10b5d | from sqlalchemy import exc
from sqlalchemy.sql.expression import func
from models import Watchlist, Portfolio, Activity
from app import db
import metric
def buy_stock(ticker, units):
unit_price = metric.get_price(ticker)
total_price = units * unit_price
max_id = db.session.query(func.max(Activity.activity... | [((202, 226), 'metric.get_price', 'metric.get_price', (['ticker'], {}), '(ticker)\n', (218, 226), False, 'import metric\n'), ((1165, 1189), 'metric.get_price', 'metric.get_price', (['ticker'], {}), '(ticker)\n', (1181, 1189), False, 'import metric\n'), ((3039, 3060), 'models.Watchlist.query.all', 'Watchlist.query.all',... |
Tilapiatsu/blender-custom_conf | scripts/addons/kekit/ke_fit2grid.py | 05592fedf74e4b7075a6228b8448a5cda10f7753 | bl_info = {
"name": "ke_fit2grid",
"author": "Kjell Emanuelsson",
"category": "Modeling",
"version": (1, 0, 2),
"blender": (2, 80, 0),
}
import bpy
import bmesh
from .ke_utils import get_loops, correct_normal, average_vector
from mathutils import Vector, Matrix
def fit_to_grid(co, grid):
x, y,... | [((727, 752), 'bpy.props.FloatProperty', 'bpy.props.FloatProperty', ([], {}), '()\n', (750, 752), False, 'import bpy\n'), ((3011, 3058), 'bpy.utils.register_class', 'bpy.utils.register_class', (['VIEW3D_OT_ke_fit2grid'], {}), '(VIEW3D_OT_ke_fit2grid)\n', (3035, 3058), False, 'import bpy\n'), ((3082, 3131), 'bpy.utils.u... |
en0/pyavl3 | tests/test_update.py | c9dad3189da1f18e935e61d13d7c971aceafd895 | import unittest
from pyavl3 import AVLTree
class AVLTreeUpdateTest(unittest.TestCase):
def test_add_one(self):
a = AVLTree()
a.update({1:'a'})
self.assertEqual(len(a), 1)
| [((129, 138), 'pyavl3.AVLTree', 'AVLTree', ([], {}), '()\n', (136, 138), False, 'from pyavl3 import AVLTree\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.