repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
INSRapperswil/nornir-web | backend/api/management/commands/create_testdb.py | 458e6b24bc373197044b4b7b5da74f16f93a9459 | """
Setup DB with example data for tests
"""
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import User, Group
from django.core.management.base import BaseCommand
from api import models
class Command(BaseCommand):
help = 'Setup DB with example data for tests'
... | [((525, 564), 'django.contrib.auth.models.User.objects.get', 'User.objects.get', ([], {'username': '"""thomastest"""'}), "(username='thomastest')\n", (541, 564), False, 'from django.contrib.auth.models import User, Group\n'), ((678, 714), 'django.contrib.auth.models.User.objects.get', 'User.objects.get', ([], {'usernam... |
charles-l/pyinfra | pyinfra/facts/util/distro.py | 1992d98ff31d41404427dbb3cc6095a7bebd4052 | from __future__ import absolute_import, unicode_literals
import os
import distro
def get_distro_info(root_dir):
# We point _UNIXCONFDIR to root_dir
old_value = distro._UNIXCONFDIR
distro._UNIXCONFDIR = os.path.join(root_dir, 'etc')
obj = distro.LinuxDistribution(include_lsb=False, include_uname=Fal... | [((218, 247), 'os.path.join', 'os.path.join', (['root_dir', '"""etc"""'], {}), "(root_dir, 'etc')\n", (230, 247), False, 'import os\n'), ((259, 323), 'distro.LinuxDistribution', 'distro.LinuxDistribution', ([], {'include_lsb': '(False)', 'include_uname': '(False)'}), '(include_lsb=False, include_uname=False)\n', (283, ... |
salabogdan/python-client | appium/webdriver/common/multi_action.py | 66208fdbbc8f0a8b0e90376b404135b57e797fa5 | #!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... | [((1232, 1265), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': '"""MultiAction"""'}), "('T', bound='MultiAction')\n", (1239, 1265), False, 'from typing import TYPE_CHECKING, Dict, List, Optional, TypeVar, Union\n'), ((2248, 2271), 'copy.copy', 'copy.copy', (['touch_action'], {}), '(touch_action)\n', (2257, 2271),... |
JonasFrey96/PLR2 | src/visu/visualizer.py | a0498e6ff283a27c6db11b3d57d3b3100026f069 | import numpy as np
import sys
import os
from PIL import Image
from visu.helper_functions import save_image
from scipy.spatial.transform import Rotation as R
from helper import re_quat
import copy
import torch
import numpy as np
import k3d
class Visualizer():
def __init__(self, p_visu, writer=None):
if p_v... | [((4150, 4173), 'k3d.plot', 'k3d.plot', ([], {'name': '"""points"""'}), "(name='points')\n", (4158, 4173), False, 'import k3d\n'), ((4842, 4865), 'k3d.plot', 'k3d.plot', ([], {'name': '"""points"""'}), "(name='points')\n", (4850, 4865), False, 'import k3d\n'), ((1091, 1109), 'copy.deepcopy', 'copy.deepcopy', (['img'], ... |
FreesiaLikesPomelo/-offer | leetCode_Q37_serializeTree.py | 14ac73cb46d13c7f5bbc294329a14f3c5995bc7a | '''
面试题37. 序列化二叉树
请实现两个函数,分别用来序列化和反序列化二叉树。
示例:
你可以将以下二叉树:
1
/ \
2 3
/ \
4 5
序列化为 "[1,2,3,null,null,4,5]"
'''
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# 执行用时 :240 ms... | [] |
maiamcc/ipuz | ipuz/puzzlekinds/__init__.py | fbe6f663b28ad42754622bf2d3bbe59a26be2615 | from .acrostic import IPUZ_ACROSTIC_VALIDATORS
from .answer import IPUZ_ANSWER_VALIDATORS
from .block import IPUZ_BLOCK_VALIDATORS
from .crossword import IPUZ_CROSSWORD_VALIDATORS
from .fill import IPUZ_FILL_VALIDATORS
from .sudoku import IPUZ_SUDOKU_VALIDATORS
from .wordsearch import IPUZ_WORDSEARCH_VALIDATORS
IPUZ_... | [] |
MrQubo/CTFd | CTFd/api/v1/users.py | 5c8ffff1412ea91ad6cf87135cb3d175a1223544 | from flask import session, request, abort
from flask_restplus import Namespace, Resource
from CTFd.models import (
db,
Users,
Solves,
Awards,
Tracking,
Unlocks,
Submissions,
Notifications,
)
from CTFd.utils.decorators import authed_only, admins_only, ratelimit
from CTFd.cache import clea... | [((655, 715), 'flask_restplus.Namespace', 'Namespace', (['"""users"""'], {'description': '"""Endpoint to retrieve Users"""'}), "('users', description='Endpoint to retrieve Users')\n", (664, 715), False, 'from flask_restplus import Namespace, Resource\n'), ((836, 885), 'CTFd.models.Users.query.filter_by', 'Users.query.f... |
emilhe/dash-extensions-docs | getting_started/pages.py | f44edba1c955242fc503185954ea5f3be69eb122 | import dash_labs as dl
from dash_extensions.enrich import DashBlueprint, DashProxy, html, Output, Input
def page_name(i: int):
return f"page{i}"
def make_page(i: int):
page = DashBlueprint()
page.layout = html.Div([html.H2(f"Page {i}"), html.Button('Click me!', id='btn'), html.Div(id='log')])
@page.c... | [((489, 558), 'dash_extensions.enrich.DashProxy', 'DashProxy', ([], {'prevent_initial_callbacks': '(True)', 'plugins': '[dl.plugins.pages]'}), '(prevent_initial_callbacks=True, plugins=[dl.plugins.pages])\n', (498, 558), False, 'from dash_extensions.enrich import DashBlueprint, DashProxy, html, Output, Input\n'), ((185... |
vkmc/zaqar-websocket | zaqar/transport/wsgi/v2_0/homedoc.py | a93c460a28e541b5cc8b425d5fb4d69e78ab9f4b | # Copyright (c) 2013 Rackspace, 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 in w... | [((8466, 8517), 'json.dumps', 'json.dumps', (['JSON_HOME'], {'ensure_ascii': '(False)', 'indent': '(4)'}), '(JSON_HOME, ensure_ascii=False, indent=4)\n', (8476, 8517), False, 'import json\n')] |
vertexproject/synapse | synapse/models/infotech.py | 9712e2aee63914441c59ce6cfc060fe06a2e5920 | import asyncio
import logging
import synapse.exc as s_exc
import synapse.lib.types as s_types
import synapse.lib.module as s_module
import synapse.lib.version as s_version
logger = logging.getLogger(__name__)
class Cpe23Str(s_types.Str):
'''
CPE 2.3 Formatted String
https://nvlpubs.nist.gov/nistpubs/Leg... | [((183, 210), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (200, 210), False, 'import logging\n'), ((612, 662), 'synapse.lib.types.Str.__init__', 's_types.Str.__init__', (['self', 'modl', 'name', 'info', 'opts'], {}), '(self, modl, name, info, opts)\n', (632, 662), True, 'import synapse... |
bciar/ppp-web | test/test.py | 1afe39a3c8d2197595ad0e2610c612db210cd62e | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Unit tests."""
import os
import unittest
from copy import copy
from webui.app import create_app
class TestRoutes(unittest.TestCase):
"""Test routes."""
ignore_routes = ('/static/<path:filename>',)
ignore_end_patterns = ('>',)
def setUp(self):
... | [((1314, 1422), 'test.utils.doctest_unittest_runner.doctest_unittest_runner', 'doctest_unittest_runner', ([], {'test_dir': 'TEST_DIR', 'relative_path_to_root': '"""../"""', 'package_names': "['webui', 'test']"}), "(test_dir=TEST_DIR, relative_path_to_root='../',\n package_names=['webui', 'test'])\n", (1337, 1422), F... |
Justin-Fisher/webots | tests/sources/test_clang_format.py | 8a39e8e4390612919a8d82c7815aa914f4c079a4 | #!/usr/bin/env python
# Copyright 1996-2021 Cyberbotics Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [((6922, 6937), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6935, 6937), False, 'import unittest\n'), ((1123, 1182), 'subprocess.check_output', 'subprocess.check_output', (["['clang-format', '-style=file', f]"], {}), "(['clang-format', '-style=file', f])\n", (1146, 1182), False, 'import subprocess\n'), ((3239,... |
sanketsaurav/clusterfuzz | src/python/tests/core/system/shell_test.py | 9f7efba7781614d50cdc6ab136b9bcf19607731c | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [((1877, 1915), 'mock.patch', 'mock.patch', (['"""os.remove"""'], {'autospec': '(True)'}), "('os.remove', autospec=True)\n", (1887, 1915), False, 'import mock\n'), ((1106, 1138), 'tests.test_libs.test_utils.set_up_pyfakefs', 'test_utils.set_up_pyfakefs', (['self'], {}), '(self)\n', (1132, 1138), False, 'from tests.test... |
osamaqureshi/NLP-for-Urdu | Language Model/birnn/model.py | 864550dbf27244900c2be86e0bedcfb5bb519cb6 | import numpy as np
import tensorflow as tf
class Bidirectional(tf.keras.Model):
def __init__(self, units: int,
projection_units: int):
super(Bidirectional, self).__init__()
self.units = units
self.projection_units = projection_units
self.Layers = [tf.keras.layers.B... | [((2455, 2487), 'tensorflow.cast', 'tf.cast', (['mask'], {'dtype': 'loss_.dtype'}), '(mask, dtype=loss_.dtype)\n', (2462, 2487), True, 'import tensorflow as tf\n'), ((2517, 2538), 'tensorflow.reduce_mean', 'tf.reduce_mean', (['loss_'], {}), '(loss_)\n', (2531, 2538), True, 'import tensorflow as tf\n'), ((2579, 2598), '... |
jamesliu/ray | python/ray/train/__init__.py | 11ab412db1fa3603a3006e8ed414e80dd1f11c0c | from ray.train.backend import BackendConfig
from ray.train.callbacks import TrainingCallback
from ray.train.checkpoint import CheckpointStrategy
from ray.train.session import (get_dataset_shard, local_rank, load_checkpoint,
report, save_checkpoint, world_rank, world_size)
from ray.train.t... | [] |
anastas11a/python_training | test/test_contact_in_group.py | 1daceddb193d92542f7f7313026a7e67af4d89bb | from model.contact import Contact
from model.group import Group
import random
def test_add_contact_in_group(app, db):
app.open_home_page()
contact = db.get_contact_list()
if len(contact) == 0:
app.contact.create(Contact(firstname = "test firstname changed"))
group = db.get_group_list()
if l... | [((400, 422), 'random.choice', 'random.choice', (['contact'], {}), '(contact)\n', (413, 422), False, 'import random\n'), ((440, 460), 'random.choice', 'random.choice', (['group'], {}), '(group)\n', (453, 460), False, 'import random\n'), ((940, 960), 'random.choice', 'random.choice', (['group'], {}), '(group)\n', (953, ... |
LikeLion-CAU-9th/Django-fancy-coder | byurak/accounts/admin.py | 53c770f4c1891f9076bed8c89d0b942b77e67667 | from django.contrib import admin
from accounts.models import User, Profile, UserFollow
@admin.register(User)
class UserAdmin(admin.ModelAdmin):
list_display = ['email', 'nickname']
list_display_links = ['email', 'nickname']
admin.site.register(Profile)
admin.site.register(UserFollow)
| [((90, 110), 'django.contrib.admin.register', 'admin.register', (['User'], {}), '(User)\n', (104, 110), False, 'from django.contrib import admin\n'), ((239, 267), 'django.contrib.admin.site.register', 'admin.site.register', (['Profile'], {}), '(Profile)\n', (258, 267), False, 'from django.contrib import admin\n'), ((26... |
olmozavala/eoas-pyutils | viz_utils/eoa_viz.py | f552a512e250f8aa16e1f3ababf8b4644253918b | import os
from PIL import Image
import cv2
from os import listdir
from os.path import join
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.colors import LogNorm
from io_utils.io_common import create_folder
from viz_utils.constants import PlotMode, BackgroundType
import pylab
import numpy as np
import... | [((3165, 3183), 'cartopy.crs.PlateCarree', 'ccrs.PlateCarree', ([], {}), '()\n', (3181, 3183), True, 'import cartopy.crs as ccrs\n'), ((12073, 12171), 'cartopy.feature.NaturalEarthFeature', 'cfeature.NaturalEarthFeature', ([], {'category': '"""cultural"""', 'name': '"""roads"""', 'scale': '"""10m"""', 'facecolor': '"""... |
fcendra/PSPnet18 | ade20kScripts/setup.py | bc4f4292f4ddd09dba7076ca0b587c8f60dfa043 | from os import listdir
from os.path import isfile, join
from path import Path
import numpy as np
import cv2
# Dataset path
target_path = Path('target/')
annotation_images_path = Path('dataset/ade20k/annotations/training/').abspath()
dataset = [ f for f in listdir(annotation_images_path) if isfile(join(annotation_image... | [((138, 153), 'path.Path', 'Path', (['"""target/"""'], {}), "('target/')\n", (142, 153), False, 'from path import Path\n'), ((577, 613), 'numpy.asarray', 'np.asarray', (['images[n]'], {'dtype': 'np.int8'}), '(images[n], dtype=np.int8)\n', (587, 613), True, 'import numpy as np\n'), ((734, 769), 'numpy.where', 'np.where'... |
Mannan2812/azure-cli-extensions | src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/__init__.py | e2b34efe23795f6db9c59100534a40f0813c3d95 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | [] |
Scoppio/Rogue-EVE | Core/managers/InputPeripherals.py | a46f1faa9c7835e8c5838f6270fb5d75b349936b | import logging
from models.GenericObjects import Vector2
logger = logging.getLogger('Rogue-EVE')
class MouseController(object):
"""
Mouse controller needs the map, get over it
"""
def __init__(self, map=None, object_pool=None):
self.mouse_coord = (0, 0)
self.map = map
self.obj... | [((67, 97), 'logging.getLogger', 'logging.getLogger', (['"""Rogue-EVE"""'], {}), "('Rogue-EVE')\n", (84, 97), False, 'import logging\n'), ((871, 897), 'models.GenericObjects.Vector2', 'Vector2', (['*self.mouse_coord'], {}), '(*self.mouse_coord)\n', (878, 897), False, 'from models.GenericObjects import Vector2\n')] |
vromanuk/async_techniques | the_unsync/thesync.py | 7e1c6efcd4c81c322002eb3002d5bb929c5bc623 | from unsync import unsync
import asyncio
import datetime
import math
import aiohttp
import requests
def main():
t0 = datetime.datetime.now()
tasks = [
compute_some(),
compute_some(),
compute_some(),
download_some(),
download_some(),
download_some(),
down... | [((606, 628), 'unsync.unsync', 'unsync', ([], {'cpu_bound': '(True)'}), '(cpu_bound=True)\n', (612, 628), False, 'from unsync import unsync\n'), ((747, 755), 'unsync.unsync', 'unsync', ([], {}), '()\n', (753, 755), False, 'from unsync import unsync\n'), ((1197, 1205), 'unsync.unsync', 'unsync', ([], {}), '()\n', (1203,... |
henriktao/pulumi-azure | sdk/python/pulumi_azure/desktopvirtualization/workspace.py | f1cbcf100b42b916da36d8fe28be3a159abaf022 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [((2341, 2380), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""resourceGroupName"""'}), "(name='resourceGroupName')\n", (2354, 2380), False, 'import pulumi\n'), ((3215, 3249), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""friendlyName"""'}), "(name='friendlyName')\n", (3228, 3249), False, 'import pulumi\n'),... |
betatim/jupyanno | jupyanno/sheets.py | 11fbb1825c8e6966260620758768e0e1fa5cecc9 | """Code for reading and writing results to google sheets"""
from bs4 import BeautifulSoup
import requests
import warnings
import json
import pandas as pd
from six.moves.urllib.parse import urlparse, parse_qs
from six.moves.urllib.request import urlopen
_CELLSET_ID = "AIzaSyC8Zo-9EbXgHfqNzDxVb_YS_IIZBWtvoJ4"
def get_... | [((1532, 1547), 'six.moves.urllib.request.urlopen', 'urlopen', (['in_url'], {}), '(in_url)\n', (1539, 1547), False, 'from six.moves.urllib.request import urlopen\n'), ((2681, 2742), 'requests.post', 'requests.post', (['submit_url'], {'data': 'form_data', 'headers': 'user_agent'}), '(submit_url, data=form_data, headers=... |
zhou7rui/algorithm | sorting/python/max_heap.py | 9b5500ac3d8bdfd223bf9aec55e68675f2df7c59 | # -*- coding: utf-8 -*
'''
最大堆实现
98
/ \
96 84
/ \ / \
92 82 78 47
/ \ / \ / \ / \
... | [((1986, 2006), 'random.randint', 'random.randint', (['(1)', 'M'], {}), '(1, M)\n', (2000, 2006), False, 'import random\n')] |
greipfrut/pdftohtml5canvas | ink2canvas/svg/Use.py | bd4b829a5fd02b503e6b32c268b265daa92e92e5 | from ink2canvas.svg.AbstractShape import AbstractShape
class Use(AbstractShape):
def drawClone(self):
drawables = self.rootTree.getDrawable()
OriginName = self.getCloneId()
OriginObject = self.rootTree.searchElementById(OriginName,drawables)
OriginObject.runDraw()
de... | [] |
HanSooLim/DIL-Project | docs/source/tutorial/code/read_csv.py | 069fa7e35a2e1edfff30dc2540d9b87f5db95dde | import pandas
datas = pandas.read_csv("../../Sample/example_dataset.csv", index_col=0)
print(datas)
| [((23, 87), 'pandas.read_csv', 'pandas.read_csv', (['"""../../Sample/example_dataset.csv"""'], {'index_col': '(0)'}), "('../../Sample/example_dataset.csv', index_col=0)\n", (38, 87), False, 'import pandas\n')] |
rghose/lol3 | app.py | c902e61bd5d69c541b46c834a5183e4da8eec591 | from flask import *
app = Flask(__name__)
import botty
# ----------------------------------
@app.route("/", methods=['GET', 'POST'])
def hello():
if request.method == 'POST':
data = request.form["query"]
return render_template("index.html",data=data)
return render_template("main.html")
# ... | [((495, 525), 'botty.botty_get_response', 'botty.botty_get_response', (['data'], {}), '(data)\n', (519, 525), False, 'import botty\n')] |
metarom-quality/gooseberry | config.py | 544503c52edd360a53d09f69ea6b4a0645aa617a | #!/usr/bin/env python3
import os
DATABASE="/home/tomate/Warehouse/syte/meta.db"
XLSDIR = "/mnt/c/Users/Natacha/Documents/TempDocs/progen/Formula/"
temp = [i for i in next(os.walk(XLSDIR))[2] if i.endswith("xlsx") or i.endswith("xls")]
flist = {}
for i in temp:
name = i.split(" ")[0].split("-")[0].split(".")[0]
... | [((174, 189), 'os.walk', 'os.walk', (['XLSDIR'], {}), '(XLSDIR)\n', (181, 189), False, 'import os\n')] |
markostrajkov/range-requests-proxy | setup.py | 74d4bfee93098854c7b9f723c03c2316e729f295 | #!/usr/bin/env python
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.py... | [((591, 1035), 'setuptools.setup', 'setup', ([], {'name': '"""range-requests-proxy"""', 'version': '"""0.1"""', 'description': '"""Asynchronous HTTP proxy for HTTP Range Requests"""', 'author': '"""Marko Trajkov"""', 'author_email': '"""markostrajkov@gmail.com"""', 'cmdclass': "{'test': PyTest}", 'tests_require': "['py... |
kmaehashi/pytorch-pfn-extras | tests/pytorch_pfn_extras_tests/onnx/test_load_model.py | 70b5db0dad8a8e342cc231e8a18c6f32ce250d1c | import os
import pytest
import torch
import pytorch_pfn_extras.onnx as tou
from tests.pytorch_pfn_extras_tests.onnx.test_export_testcase import Net
@pytest.mark.filterwarnings("ignore:Named tensors .* experimental:UserWarning")
def test_onnx_load_model():
model = Net()
outdir = "out/load_model_test"
tou... | [((153, 231), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:Named tensors .* experimental:UserWarning"""'], {}), "('ignore:Named tensors .* experimental:UserWarning')\n", (179, 231), False, 'import pytest\n'), ((502, 578), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""igno... |
huzidabanzhang/Python | validate/v1/base.py | 7b304290e5be7db4bce253edb069a12dcbc3c998 | #!/usr/bin/env python
# -*- coding:UTF-8 -*-
'''
@Description: 数据库验证器
@Author: Zpp
@Date: 2020-05-28 13:44:29
@LastEditors: Zpp
@LastEditTime: 2020-05-28 14:02:02
'''
params = {
# 验证字段
'fields': {
'type': {
'name': '导出类型',
'type': 'int',
'between': [1, 2, 3],
... | [] |
axbaretto/mxnet | example/speech_recognition/stt_layer_slice.py | 5f593885356ff6d14f5519fa18e79b944beb51cd | import mxnet as mx
def slice_symbol_to_seq_symobls(net, seq_len, axis=1, squeeze_axis=True):
net = mx.sym.SliceChannel(data=net, num_outputs=seq_len, axis=axis, squeeze_axis=squeeze_axis)
hidden_all = []
for seq_index in range(seq_len):
hidden_all.append(net[seq_index])
net = hidden_all
re... | [((105, 198), 'mxnet.sym.SliceChannel', 'mx.sym.SliceChannel', ([], {'data': 'net', 'num_outputs': 'seq_len', 'axis': 'axis', 'squeeze_axis': 'squeeze_axis'}), '(data=net, num_outputs=seq_len, axis=axis, squeeze_axis=\n squeeze_axis)\n', (124, 198), True, 'import mxnet as mx\n')] |
fergalmoran/dss.api | api/auth.py | d1b9fb674b6dbaee9b46b9a3daa2027ab8d28073 | import datetime
import json
from calendar import timegm
from urllib.parse import parse_qsl
import requests
from allauth.socialaccount import models as aamodels
from requests_oauthlib import OAuth1
from rest_framework import parsers, renderers
from rest_framework import status
from rest_framework.authtoken.models impor... | [((1090, 1134), 'spa.models.socialaccountlink.SocialAccountLink.objects.get', 'SocialAccountLink.objects.get', ([], {'social_id': 'uid'}), '(social_id=uid)\n', (1119, 1134), False, 'from spa.models.socialaccountlink import SocialAccountLink\n'), ((1349, 1387), 'spa.models.UserProfile.objects.get', 'UserProfile.objects.... |
aeturnum/bcgs | bcgs/disqus_objects.py | e5ae4c9f4cdd45b47615f00581dcc3792c281ea3 | import requests
import aiohttp
from constants import API_KEY
class User(object):
def __init__(self, author_info):
# "author": {
# "about": "",
# "avatar": {
# "cache": "//a.disquscdn.com/1519942534/images/noavatar92.png",
# ... | [((4374, 4479), 'requests.get', 'requests.get', (['"""https://disqus.com/api/3.0/users/details.json"""', "{'user': self.id, 'api_key': API_KEY}"], {}), "('https://disqus.com/api/3.0/users/details.json', {'user': self\n .id, 'api_key': API_KEY})\n", (4386, 4479), False, 'import requests\n'), ((1751, 1789), 'aiohttp.T... |
LtGlahn/estimat_gulstripe | nvdbgeotricks.py | 8bb93d52131bdda9846810dbd6bac7f872377859 | """
En samling hjelpefunksjoner som bruker nvdbapiv3-funksjonene til å gjøre nyttige ting, f.eks. lagre geografiske datasett
Disse hjelpefunksjonene forutsetter fungerende installasjon av geopandas, shapely og en del andre ting som må
installeres separat. Noen av disse bibliotekene kunne historisk av og til være plun... | [((6144, 6167), 'nvdbapiv3.nvdbVegnett', 'nvdbapiv3.nvdbVegnett', ([], {}), '()\n', (6165, 6167), False, 'import nvdbapiv3\n'), ((2203, 2237), 'nvdbapiv3.nvdbFagdata', 'nvdbapiv3.nvdbFagdata', (['enObjTypeId'], {}), '(enObjTypeId)\n', (2224, 2237), False, 'import nvdbapiv3\n'), ((3956, 3979), 'nvdbapiv3.nvdbVegnett', '... |
joetache4/project-euler | 019_CountingSundays.py | 82f9e25b414929d9f62d94905906ba2f57db7935 | """
You are given the following information, but you may prefer to do some research for yourself.
1 Jan 1900 was a Monday.
Thirty days has September,
April, June and November.
All the rest have thirty-one,
Saving February alone,
Which has twenty-eight, rain or shine.
And on leap years, twen... | [] |
aagaard/dbservice | setup.py | 47daadab307e6744ef151dd4e0aacff27dcda881 | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
Setup for the dbservice
"""
from setuptools import setup, find_packages
setup(
name='dbservice',
version='0.9',
description="Database service for storing meter data",
author="Søren Aagaard Mikkelsen",
author_email='smik@eng.au.dk',
url='htt... | [((371, 386), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (384, 386), False, 'from setuptools import setup, find_packages\n')] |
usegalaxy-no/usegalaxy | venv/lib/python3.6/site-packages/ansible_collections/junipernetworks/junos/plugins/module_utils/network/junos/argspec/facts/facts.py | 75dad095769fe918eb39677f2c887e681a747f3a | #
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The arg spec for the junos facts module.
"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
class FactsArgs(object):
""" The... | [] |
ripry/umakaviewer | server/dbcls/api/resources/authenticate.py | e3df32313219d1b9d65edb6d180b2b4799d87e25 | from flask_restful import Resource, reqparse
from firebase_admin import auth as firebase_auth
from dbcls.models import User
parser = reqparse.RequestParser()
parser.add_argument('token', type=str, required=True, nullable=False)
class Authenticate(Resource):
def post(self):
try:
args = parse... | [((136, 160), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (158, 160), False, 'from flask_restful import Resource, reqparse\n'), ((748, 795), 'firebase_admin.auth.create_custom_token', 'firebase_auth.create_custom_token', (['firebase_uid'], {}), '(firebase_uid)\n', (781, 795), Tru... |
Feiyi-Ding/2021A | GetJSONData_NLPParser.py | f599f0a21e05964fffce3dcf2d32ef70ddc3c75d | #Import required modules
import requests
import json
# Get json results for the required input
InputString = "kobe is a basketball player"
headers = {
'Content-type': 'application/json',
}
data = '{"text":InputString = '+ InputString + '}'
response = requests.post('http://66.76.242.198:9888/', d... | [((275, 329), 'requests.post', 'requests.post', (['"""http://66.76.242.198:9888/"""'], {'data': 'data'}), "('http://66.76.242.198:9888/', data=data)\n", (288, 329), False, 'import requests\n')] |
Xtuden-com/language | language/bert_extraction/steal_bert_classifier/utils/wiki103_sentencize.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 ... | [] |
budacom/trading-bots | example_bots/any_to_any/__init__.py | 9ac362cc21ce185e7b974bf9bcc7480ff9c6b2aa | default_bot = 'example_bots.any_to_any.bot.AnyToAny'
| [] |
owenjones/CaBot | helpers.py | dd47c077b21cbcf52c0ffd2e30b47fb736a41ebc | from server import roles
def hasRole(member, roleID):
role = member.guild.get_role(roleID)
return role in member.roles
def gainedRole(before, after, roleID):
role = before.guild.get_role(roleID)
return (role not in before.roles) and (role in after.roles)
def isExplorer(ctx):
return hasRole(ctx... | [] |
davcamer/amundsendatabuilder | databuilder/loader/file_system_neo4j_csv_loader.py | 1bd6cd5c30413640d4c377dc3c59c283e86347eb | import csv
import logging
import os
import shutil
from csv import DictWriter # noqa: F401
from pyhocon import ConfigTree, ConfigFactory # noqa: F401
from typing import Dict, Any # noqa: F401
from databuilder.job.base_job import Job
from databuilder.loader.base_loader import Loader
from databuilder.models.neo4j_csv... | [((544, 571), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (561, 571), False, 'import logging\n'), ((1026, 1113), 'pyhocon.ConfigFactory.from_dict', 'ConfigFactory.from_dict', (['{SHOULD_DELETE_CREATED_DIR: True, FORCE_CREATE_DIR: False}'], {}), '({SHOULD_DELETE_CREATED_DIR: True, FORCE... |
pepsinal/python_doe_kspub | sample_program_04_02_knn.py | 65ae5c2d214f1a34fa242fee7d63453c81d56bfe | # -*- coding: utf-8 -*-
"""
@author: Hiromasa Kaneko
"""
import pandas as pd
from sklearn.neighbors import NearestNeighbors # k-NN
k_in_knn = 5 # k-NN における k
rate_of_training_samples_inside_ad = 0.96 # AD 内となるトレーニングデータの割合。AD のしきい値を決めるときに使用
dataset = pd.read_csv('resin.csv', index_col=0, header=0)
x_pr... | [((267, 314), 'pandas.read_csv', 'pd.read_csv', (['"""resin.csv"""'], {'index_col': '(0)', 'header': '(0)'}), "('resin.csv', index_col=0, header=0)\n", (278, 314), True, 'import pandas as pd\n'), ((331, 389), 'pandas.read_csv', 'pd.read_csv', (['"""resin_prediction.csv"""'], {'index_col': '(0)', 'header': '(0)'}), "('r... |
destinysky/nsh_sfc | topology.py | 290fa49df2880527e0b7844bf3bec4d55c4945a6 | #!/usr/bin/python
"""
"""
from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSKernelSwitch,UserSwitch
#OVSLegacyKernelSwitch, UserSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel
from mininet.link import Link, TCLink
#conf_port=50000
conf_ip_1='10.0.0.254'... | [] |
gventuraagramonte/python | lampara/lamp.py | d96796c302f2f423a8e949f9c7d33a3bfabf8a0f |
#Definicion de la clase
#antes de empezar una clase se declara de la siguiente manera
class Lamp:
_LAMPS = ['''
.
. | ,
\ ' /
` ,-. '
--- ( ) ---
\ /
_|=|_
|_____|
''',
'''
,-.
( )
\ /
_|=|_
|___... | [] |
sneumann/galaxy | lib/galaxy/model/migrate/versions/0084_add_ldda_id_to_implicit_conversion_table.py | f6011bab5b8adbabae4986a45849bb9158ffc8bb | """
Migration script to add 'ldda_id' column to the implicitly_converted_dataset_association table.
"""
from __future__ import print_function
import logging
from sqlalchemy import (
Column,
ForeignKey,
Integer,
MetaData
)
from galaxy.model.migrate.versions.util import (
add_column,
drop_colum... | [((331, 358), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (348, 358), False, 'import logging\n'), ((370, 380), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (378, 380), False, 'from sqlalchemy import Column, ForeignKey, Integer, MetaData\n'), ((831, 957), 'galaxy.model.migrate.v... |
tobiichiorigami1/csp | ds.py | e1f419869a0a1aa3e39aeb5888571267be5d80bd | votes_t_shape = [3, 0, 1, 2]
for i in range(6 - 4):
votes_t_shape += [i + 4]
print(votes_t_shape)
| [] |
TimDettmers/sched | scripts/adam/cc100_baselines.py | e16735f2c2eb6a51f5cf29ead534041574034e2e | import numpy as np
import itertools
import gpuscheduler
import argparse
import os
import uuid
import hashlib
import glob
import math
from itertools import product
from torch.optim.lr_scheduler import OneCycleLR
from os.path import join
parser = argparse.ArgumentParser(description='Compute script.')
parser.add_argumen... | [((247, 301), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Compute script."""'}), "(description='Compute script.')\n", (270, 301), False, 'import argparse\n'), ((1923, 2025), 'gpuscheduler.HyakScheduler', 'gpuscheduler.HyakScheduler', ([], {'verbose': 'args.verbose', 'account': '""""""... |
hal0x2328/neo3-boa | boa3_test/test_sc/event_test/EventNep5Transfer.py | 6825a3533384cb01660773050719402a9703065b | from boa3.builtin import public
from boa3.builtin.contract import Nep5TransferEvent
transfer = Nep5TransferEvent
@public
def Main(from_addr: bytes, to_addr: bytes, amount: int):
transfer(from_addr, to_addr, amount)
| [] |
SchuylerGoodman/topicalguide | abtest/views.py | 7c26c8be8e1dddb7bf2be33ea9a7ba59034bf620 | # The Topical Guide
# Copyright 2010-2011 Brigham Young University
#
# This file is part of the Topical Guide <http://nlp.cs.byu.edu/topic_browser>.
#
# The Topical Guide is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by the
# Free Soft... | [((1830, 1843), 'django.shortcuts.redirect', 'redirect', (['"""/"""'], {}), "('/')\n", (1838, 1843), False, 'from django.shortcuts import render, redirect\n')] |
sulantha2006/neurodocker | neurodocker/reprozip/tests/test_merge.py | d03fe865ae05fea2f7ce9a8b417717dae7bd640f | """Tests for merge.py."""
from __future__ import absolute_import, division, print_function
from glob import glob
import os
import tarfile
import tempfile
from neurodocker.docker import client
from neurodocker.reprozip.trace import ReproZipMinimizer
from neurodocker.reprozip.merge import merge_pack_files
def _creat... | [((439, 543), 'neurodocker.docker.client.containers.run', 'client.containers.run', (['"""debian:stretch"""'], {'detach': '(True)', 'tty': '(True)', 'security_opt': "['seccomp:unconfined']"}), "('debian:stretch', detach=True, tty=True, security_opt\n =['seccomp:unconfined'])\n", (460, 543), False, 'from neurodocker.d... |
dolang/build-kivy-linux | build/step-3-kivy-almost-manylinux/scripts/redirect_html5.py | bb3e6dce956659d94604b524aa6702e8c390e15a | """
HTML5 contexts.
:author: Dominik Lang
:license: MIT
"""
import contextlib
import io
import sys
__all__ = ['create_document', 'tag', 'as_link']
class create_document(contextlib.redirect_stdout):
"""Redirect output to an HTML5 document specified by new_target.
A HTML document titl... | [((853, 895), 'contextlib.redirect_stdout.__enter__', 'contextlib.redirect_stdout.__enter__', (['self'], {}), '(self)\n', (889, 895), False, 'import contextlib\n'), ((2297, 2333), 'contextlib.closing', 'contextlib.closing', (['self._new_target'], {}), '(self._new_target)\n', (2315, 2333), False, 'import contextlib\n')] |
jzacsh/neuralnets-cmp464 | lab/hw03-part-i_nov14.py | de35bbba93b87446b231bf012a8de5acc7896a04 | """
Jonathan Zacsh's solution to homework #3, Nov 14., Part I
"""
# Per homework instructions, following lead from matlab example by professor:
# http://comet.lehman.cuny.edu/schneider/Fall17/CMP464/Maple/PartialDerivatives1.pdf
import sys
import tensorflow as tf
import tempfile
import os
import numpy as np
os.envir... | [((969, 1011), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {'prefix': '"""hw3-nov14-parti"""'}), "(prefix='hw3-nov14-parti')\n", (985, 1011), False, 'import tempfile\n'), ((1032, 1044), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (1042, 1044), True, 'import tensorflow as tf\n'), ((1067, 1109), 'tensorflow.su... |
GChrysostomou/tasc | modules/experiments_bc/set_tp.py | d943de343d725b99fa1a1ad201b32a21e5970801 | import torch
import torch.nn as nn
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.metrics import *
from sklearn.metrics import precision_recall_fscore_support as prfs
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
d... | [((72, 93), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (86, 93), False, 'import matplotlib\n'), ((6334, 6356), 'torch.LongTensor', 'torch.LongTensor', (['docs'], {}), '(docs)\n', (6350, 6356), False, 'import torch\n'), ((8097, 8128), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['... |
mattmurch/helios-server | helios/tasks.py | c4f5409bbf7117fc561774208c07801b9ae61ff2 | """
Celery queued tasks for Helios
2010-08-01
ben@adida.net
"""
import copy
from celery import shared_task
from celery.utils.log import get_logger
import signals
from models import CastVote, Election, Voter, VoterFile
from view_utils import render_template_raw
@shared_task
def cast_vote_verify_and_store(cast_vote_i... | [((378, 415), 'models.CastVote.objects.get', 'CastVote.objects.get', ([], {'id': 'cast_vote_id'}), '(id=cast_vote_id)\n', (398, 415), False, 'from models import CastVote, Election, Voter, VoterFile\n'), ((1297, 1333), 'models.Election.objects.get', 'Election.objects.get', ([], {'id': 'election_id'}), '(id=election_id)\... |
AlanRosenthal/virtual-dealer | tests/conftest.py | 5c5689172b38b122a69e5ca244497646bf9d8fa8 | """
pytest fixtures
"""
import unittest.mock as mock
import pytest
import virtual_dealer.api
@pytest.fixture(name="client")
def fixture_client():
"""
Client test fixture for testing flask APIs
"""
return virtual_dealer.api.app.test_client()
@pytest.fixture(name="store")
def fixture_store():
"""
... | [((96, 125), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""client"""'}), "(name='client')\n", (110, 125), False, 'import pytest\n'), ((262, 290), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""store"""'}), "(name='store')\n", (276, 290), False, 'import pytest\n'), ((460, 492), 'pytest.fixture', 'pytest.f... |
dslowikowski/commcare-hq | corehq/apps/fixtures/tests.py | ad8885cf8dab69dc85cb64f37aeaf06106124797 | from xml.etree import ElementTree
from casexml.apps.case.tests.util import check_xml_line_by_line
from casexml.apps.case.xml import V2
from corehq.apps.fixtures import fixturegenerators
from corehq.apps.fixtures.models import FixtureDataItem, FixtureDataType, FixtureOwnership, FixtureTypeField, \
FixtureItemField, ... | [((2589, 2641), 'corehq.apps.users.models.CommCareUser.create', 'CommCareUser.create', (['self.domain', '"""to_delete"""', '"""***"""'], {}), "(self.domain, 'to_delete', '***')\n", (2608, 2641), False, 'from corehq.apps.users.models import CommCareUser\n'), ((2676, 2799), 'corehq.apps.fixtures.models.FixtureOwnership',... |
agarwalrounak/readthedocs.org | readthedocs/search/signals.py | 4911600c230809bd6fb3585d1903121db2928ad6 | # -*- coding: utf-8 -*-
"""We define custom Django signals to trigger before executing searches."""
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from django_elasticsearch_dsl.apps import DEDConfig
from readthedocs.projects.models import HTMLFile, Project
from readthe... | [((466, 509), 'django.dispatch.receiver', 'receiver', (['bulk_post_create'], {'sender': 'HTMLFile'}), '(bulk_post_create, sender=HTMLFile)\n', (474, 509), False, 'from django.dispatch import receiver\n'), ((1001, 1044), 'django.dispatch.receiver', 'receiver', (['bulk_post_delete'], {'sender': 'HTMLFile'}), '(bulk_post_... |
kra-ts/falconpy | src/falconpy/_endpoint/_filevantage.py | c7c4ed93cb3b56cdfd86757f573fde57e4ccf857 | """Internal API endpoint constant library.
_______ __ _______ __ __ __
| _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----.
|. 1___| _| _ | | | | _ | 1___| _| _| | <| -__|
|. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____|
|: 1 | ... | [] |
JE-Chen/je_old_repo | TimeWrapper_JE/venv/Lib/site-packages/pip/_internal/cli/progress_bars.py | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | import itertools
import sys
from signal import SIGINT, default_int_handler, signal
from typing import Any, Dict, List
from pip._vendor.progress.bar import Bar, FillingCirclesBar, IncrementalBar
from pip._vendor.progress.spinner import Spinner
from pip._internal.utils.compat import WINDOWS
from pip._internal.... | [((2720, 2754), 'signal.signal', 'signal', (['SIGINT', 'self.handle_sigint'], {}), '(SIGINT, self.handle_sigint)\n', (2726, 2754), False, 'from signal import SIGINT, default_int_handler, signal\n'), ((3534, 3571), 'signal.signal', 'signal', (['SIGINT', 'self.original_handler'], {}), '(SIGINT, self.original_handler)\n',... |
kzbnb/numerical_bugs | scripts/study_case/ID_5/matchzoo/auto/tuner/tune.py | bc22e72bcc06df6ce7889a25e0aeed027bde910b | import typing
import numpy as np
import scripts.study_case.ID_5.matchzoo as mz
from scripts.study_case.ID_5.matchzoo.engine.base_metric import BaseMetric
from .tuner import Tuner
def tune(
params: 'mz.ParamTable',
optimizer: str = 'adam',
trainloader: mz.dataloader.DataLoader = None,
validloader: mz... | [] |
maxgold/icml22 | libs/gym/tests/wrappers/test_pixel_observation.py | 49f026dd2314091639b52f5b8364a29e8000b738 | """Tests for the pixel observation wrapper."""
from typing import Optional
import pytest
import numpy as np
import gym
from gym import spaces
from gym.wrappers.pixel_observation import PixelObservationWrapper, STATE_KEY
class FakeEnvironment(gym.Env):
def __init__(self):
self.action_space = spaces.Box(s... | [((1604, 1657), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""pixels_only"""', '(True, False)'], {}), "('pixels_only', (True, False))\n", (1627, 1657), False, 'import pytest\n'), ((3140, 3193), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""pixels_only"""', '(True, False)'], {}), "('pixels_on... |
MuAuan/Scipy-Swan | real_plot_fft_stft_impl.py | 2d79175e8fc2ab8179ea95e1b22918c29d88b7b5 | import pyaudio
import wave
from scipy.fftpack import fft, ifft
import numpy as np
import matplotlib.pyplot as plt
import cv2
from scipy import signal
from swan import pycwt
CHUNK = 1024
FORMAT = pyaudio.paInt16 # int16型
CHANNELS = 1 # 1;monoral 2;ステレオ-
RATE = 22100 # 22.1kHz 44.1kHz
RECORD_SECO... | [((383, 400), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (398, 400), False, 'import pyaudio\n'), ((572, 600), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 10)'}), '(figsize=(12, 10))\n', (582, 600), True, 'import matplotlib.pyplot as plt\n'), ((1057, 1094), 'wave.open', 'wave.open', (['... |
gengxf0505/pxt | tests/pydecompile-test/baselines/events_in_code_blocks.py | eca93a0e0605e68adcfbebce778cc5912a10efcf | #/ <reference path="./testBlocks/mb.ts" />
def function_0():
basic.showNumber(7)
basic.forever(function_0) | [] |
l756302098/ros_practice | PID/PDControl.py | 4da8b4ddb25ada2e6f1adb3c0f8b34576aedf6b7 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import random
import numpy as np
import matplotlib.pyplot as plt
class Robot(object):
def __init__(self, length=20.0):
"""
Creates robotand initializes location/orientation to 0, 0, 0.
"""
self.x = 0.0
self.y = 0.0
self.orientatio... | [((3974, 4008), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': '(8, 8)'}), '(1, 1, figsize=(8, 8))\n', (3986, 4008), True, 'import matplotlib.pyplot as plt\n'), ((4136, 4146), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (4144, 4146), True, 'import matplotlib.pyplot as plt\n'), ((... |
yoshitomo-matsubara/vision | torchvision/datasets/samplers/__init__.py | 03d11338f3faf94a0749549912593ddb8b70be17 | from .clip_sampler import DistributedSampler, UniformClipSampler, RandomClipSampler
__all__ = ("DistributedSampler", "UniformClipSampler", "RandomClipSampler")
| [] |
agustinhenze/mibs.snmplabs.com | pysnmp/HH3C-PPPOE-SERVER-MIB.py | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | #
# PySNMP MIB module HH3C-PPPOE-SERVER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-PPPOE-SERVER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:16:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | [] |
suhaili99/python-share | Pyshare2019/02 - if + Nesteed if/Nesteed-IF.py | 6c65faaff722b8bd9e381650a6b277f56d1ae4c9 | name = input("masukkan nama pembeli = ")
alamat= input("Alamat = ")
NoTelp = input("No Telp = ")
print("\n")
print("=================INFORMASI HARGA MOBIL DEALER JAYA ABADI===============")
print("Pilih Jenis Mobil :")
print("\t 1.Daihatsu ")
print("\t 2.Honda ")
print("\t 3.Toyota ")
print("")
pilihan = int(input("Pil... | [] |
wanghongsheng01/framework_enflame | oneflow/python/test/ops/test_l1loss.py | debf613e05e3f5ea8084c3e79b60d0dd9e349526 | """
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [((5020, 5052), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (5050, 5052), True, 'import oneflow as flow\n'), ((5675, 5707), 'oneflow.unittest.skip_unless_1n2d', 'flow.unittest.skip_unless_1n2d', ([], {}), '()\n', (5705, 5707), True, 'import oneflow as flow\n'), ((1079, 1100)... |
Dog-Egg/dida | tests/test_schema.py | 17fd8dce0fe198e65effb48816a2339802234974 | import unittest
import datetime
from dida import schemas, triggers
from marshmallow import ValidationError
class TestTriggerSchema(unittest.TestCase):
def test_dump_trigger(self):
result = schemas.TriggerSchema().dump(triggers.IntervalTrigger())
print('IntervalTrigger dump:', result)
res... | [((233, 259), 'dida.triggers.IntervalTrigger', 'triggers.IntervalTrigger', ([], {}), '()\n', (257, 259), False, 'from dida import schemas, triggers\n'), ((355, 377), 'dida.triggers.DateTrigger', 'triggers.DateTrigger', ([], {}), '()\n', (375, 377), False, 'from dida import schemas, triggers\n'), ((204, 227), 'dida.sche... |
Sunbird-Ed/evolve-api | apps/content/views.py | 371b39422839762e32401340456c13858cb8e1e9 | from django.shortcuts import render
from rest_framework import status
from rest_framework.generics import (
ListAPIView,
ListCreateAPIView,
ListAPIView,
RetrieveUpdateAPIView,)
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from rest_framework.decorat... | [((1819, 1887), 'azure.storage.blob.BlockBlobService', 'BlockBlobService', ([], {'account_name': 'account_name', 'account_key': 'account_key'}), '(account_name=account_name, account_key=account_key)\n', (1835, 1887), False, 'from azure.storage.blob import BlockBlobService, ContainerPermissions\n'), ((3304, 3342), 'rest... |
GuoJingyao/cornac | examples/given_data.py | e7529990ec1dfa586c4af3de98e4b3e00a786578 | # -*- coding: utf-8 -*-
"""
Example to train and evaluate a model with given data
@author: Quoc-Tuan Truong <tuantq.vnu@gmail.com>
"""
from cornac.data import Reader
from cornac.eval_methods import BaseMethod
from cornac.models import MF
from cornac.metrics import MAE, RMSE
from cornac.utils import cache
# Download... | [((379, 387), 'cornac.data.Reader', 'Reader', ([], {}), '()\n', (385, 387), False, 'from cornac.data import Reader\n'), ((604, 712), 'cornac.eval_methods.BaseMethod.from_splits', 'BaseMethod.from_splits', ([], {'train_data': 'train_data', 'test_data': 'test_data', 'exclude_unknowns': '(False)', 'verbose': '(True)'}), '... |
ZlodeiBaal/taming | taming/data/ade20k.py | b6c0f896992881f154bdfd910a8163ee754df83a | import os
import numpy as np
import cv2
import albumentations
from PIL import Image
from torch.utils.data import Dataset
from taming.data.sflckr import SegmentationBase # for examples included in repo
class Examples(SegmentationBase):
def __init__(self, size=256, random_crop=False, interpolation="bicubic"):
... | [((3811, 3844), 'PIL.Image.open', 'Image.open', (["example['file_path_']"], {}), "(example['file_path_'])\n", (3821, 3844), False, 'from PIL import Image\n'), ((4090, 4131), 'PIL.Image.open', 'Image.open', (["example['segmentation_path_']"], {}), "(example['segmentation_path_'])\n", (4100, 4131), False, 'from PIL impor... |
olehermanse/masterfiles | templates/federated_reporting/distributed_cleanup.py | bcee0a8c0a925e885ba47ba3300b96c722b91f02 | #!/usr/bin/env python3
"""
fr_distributed_cleanup.py - a script to remove hosts which have migrated to
other feeder hubs. To be run on Federated Reporting superhub
after each import of feeder data.
First, to setup, enable fr_distributed_cleanup by setting a class in augments (def.json).
This enables policy in cfe_inte... | [((1852, 1902), 'os.path.join', 'os.path.join', (['DISTRIBUTED_CLEANUP_DIR', '"""hubs.cert"""'], {}), "(DISTRIBUTED_CLEANUP_DIR, 'hubs.cert')\n", (1864, 1902), False, 'import os\n'), ((2111, 2173), 'os.path.join', 'os.path.join', (['WORKDIR', '"""state/fr_distributed_cleanup.cfsecret"""'], {}), "(WORKDIR, 'state/fr_dis... |
kennethsequeira/Hello-world | Python/Fibonacci.py | 464227bc7d9778a4a2a4044fe415a629003ea77f | #Doesn't work.
import time
fibonacci = [1, 1]
n = int(input())
while len(fibonacci) < n:
fibonacci.append(fibonacci[-1] + fibonacci[-2])
for i in range(n):
print(fibonacci[i], end=' ')
| [] |
kreyoo/csgo-inv-shuffle | setup.py | 6392dd1eef1ca87ec25c9cf4845af3f8df3594a5 | from setuptools import setup
setup(name="csgoinvshuffle")
| [((30, 58), 'setuptools.setup', 'setup', ([], {'name': '"""csgoinvshuffle"""'}), "(name='csgoinvshuffle')\n", (35, 58), False, 'from setuptools import setup\n')] |
EnjoyLifeFund/py36pkgs | py/_log/log.py | 0ac677fbbfa7b6d8c527fe2c759ba05117b07fd2 | """
basic logging functionality based on a producer/consumer scheme.
XXX implement this API: (maybe put it into slogger.py?)
log = Logger(
info=py.log.STDOUT,
debug=py.log.STDOUT,
command=None)
log.info("hello", "world")
log... | [((3411, 3440), 'py.builtin.callable', 'py.builtin.callable', (['consumer'], {}), '(consumer)\n', (3430, 3440), False, 'import py, sys\n')] |
Sergggio/python_training | test/test_all_contacts.py | 6dfdbed9a503cf9a6810b31c57bdde76b15e4ec4 | import re
from model.contact import Contact
def test_all_contacts(app, db):
contacts_from_db = db.get_contact_list()
phone_list_from_db = db.phones_from_db()
#email_liset_from_db = db.emails_from_db()
phone_list = []
for phone in phone_list_from_db:
phone_list.append(merge_phones_like_on_h... | [((918, 941), 're.sub', 're.sub', (['"""[() -]"""', '""""""', 's'], {}), "('[() -]', '', s)\n", (924, 941), False, 'import re\n'), ((977, 997), 're.sub', 're.sub', (['""" +"""', '""" """', 's'], {}), "(' +', ' ', s)\n", (983, 997), False, 'import re\n')] |
jproudlo/PyModel | samples/abp/test_graphics.py | 2ab0e2cf821807206725adaa425409b0c28929b7 | """
ABP analyzer and graphics tests
"""
cases = [
('Run Pymodel Graphics to generate dot file from FSM model, no need use pma',
'pmg ABP'),
('Generate SVG file from dot',
'dotsvg ABP'),
# Now display ABP.dot in browser
('Run PyModel Analyzer to generate FSM from original FSM, should be the... | [] |
IceArrow256/game-list | games/migrations/0002_auto_20201026_1221.py | 5f06e0ff80023acdc0290a9a8f814f7c93b45e0e | # Generated by Django 3.1.2 on 2020-10-26 12:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('games', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='game',
... | [((353, 403), 'django.db.models.FloatField', 'models.FloatField', ([], {'null': '(True)', 'verbose_name': '"""Score"""'}), "(null=True, verbose_name='Score')\n", (370, 403), False, 'from django.db import migrations, models\n'), ((523, 619), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on... |
mkubux/egenix-mx-base | build/lib.linux-x86_64-2.7_ucs4/mx/Misc/PackageTools.py | 3e6f9186334d9d73743b0219ae857564c7208247 | """ PackageTools - A set of tools to aid working with packages.
Copyright (c) 1998-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
Copyright (c) 2000-2015, eGenix.com Software GmbH; mailto:info@egenix.com
See the documentation for further information on copyrights,
or contact the author. All Rights Re... | [] |
Kshitijkrishnadas/haribol | Lib/test/test_urllib.py | ca45e633baaabaad3bb923f5633340ccf88d996c | """Regression tests for what was in Python 2's "urllib" module"""
import urllib.parse
import urllib.request
import urllib.error
import http.client
import email.message
import io
import unittest
from unittest.mock import patch
from test import support
import os
try:
import ssl
except ImportError:
ssl = None
imp... | [((13399, 13446), 'unittest.skipUnless', 'unittest.skipUnless', (['ssl', '"""ssl module required"""'], {}), "(ssl, 'ssl module required')\n", (13418, 13446), False, 'import unittest\n'), ((14942, 14989), 'unittest.skipUnless', 'unittest.skipUnless', (['ssl', '"""ssl module required"""'], {}), "(ssl, 'ssl module require... |
wmak/gapipy | gapipy/resources/tour/transport.py | b6849606d4f6af24b9f871f65e87aaf0d0c013cc | # Python 2 and 3
from __future__ import unicode_literals
from ...models import Address, SeasonalPriceBand
from ..base import Product
class Transport(Product):
_resource_name = 'transports'
_is_listable = False
_as_is_fields = [
'id', 'href', 'availability', 'name', 'product_line', 'sku', 'type... | [] |
VeNoM-hubs/nyx | modules/dare.py | 1d76b3ad50add2e71e70fac40699e0cb513b084e | from discord.ext import commands
import json
import random
with open("assets/json/questions.json") as data:
data = json.load(data)
dares = data["dares"]
class Dare(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command(aliases=["d"])
async def dare(self, ctx):... | [((121, 136), 'json.load', 'json.load', (['data'], {}), '(data)\n', (130, 136), False, 'import json\n'), ((258, 289), 'discord.ext.commands.command', 'commands.command', ([], {'aliases': "['d']"}), "(aliases=['d'])\n", (274, 289), False, 'from discord.ext import commands\n'), ((336, 356), 'random.choice', 'random.choic... |
nicmatth/APIC-EM-HelloWorldv3 | scripts/apic.py | c0645e6decf57dbd87c5a239b6fce36f3dcbef41 | APIC_IP="sandboxapic.cisco.com"
APIC_PORT="443"
GROUP='group-xx'
| [] |
squisher/stella | stella/test/external_func.py | d9f0b2ebbd853b31c6f75cd0f0286037da4bcaf9 | # Copyright 2013-2015 David Mohr
#
# 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 writi... | [((668, 689), 'mtpy.mt_seed32new', 'mtpy.mt_seed32new', (['(42)'], {}), '(42)\n', (685, 689), False, 'import mtpy\n'), ((709, 729), 'mtpy.mt_seed32new', 'mtpy.mt_seed32new', (['s'], {}), '(s)\n', (726, 729), False, 'import mtpy\n'), ((755, 776), 'mtpy.mt_seed32new', 'mtpy.mt_seed32new', (['(42)'], {}), '(42)\n', (772, ... |
ipqhjjybj/bitcoin_trend_strategy | szh_objects.py | 0c85055558591574a4171abd68142ebbeb502958 | # encoding: utf-8
import sys
from market_maker import OrderManager
from settings import *
import os
from pymongo import MongoClient, ASCENDING
from pymongo.errors import ConnectionFailure
from datetime import datetime , timedelta
import numpy as np
################################################################... | [((844, 878), 'os.path.join', 'os.path.join', (['self.LogDir', 'logName'], {}), '(self.LogDir, logName)\n', (856, 878), False, 'import os\n'), ((7067, 7081), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (7079, 7081), False, 'from datetime import datetime, timedelta\n'), ((17027, 17041), 'numpy.zeros', 'np... |
ishtjot/susereumutep | CodeAnalysis/SourceMeter_Interface/SourceMeter-8.2.0-x64-linux/Python/Tools/python/pylint/pyreverse/writer.py | 56e20c1777e0c938ac42bd8056f84af9e0b76e46 | # -*- coding: utf-8 -*-
# Copyright (c) 2008-2013 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either ver... | [((4486, 4532), 'logilab.common.graph.DotBackend', 'DotBackend', (['basename'], {'additionnal_param': 'layout'}), '(basename, additionnal_param=layout)\n', (4496, 4532), False, 'from logilab.common.graph import DotBackend\n'), ((5159, 5181), 'pylint.pyreverse.utils.is_exception', 'is_exception', (['obj.node'], {}), '(o... |
philippe-heitzmann/python-apps | graphql-ml-serving/backend/mutations.py | 1cc6e5e9b9ac81c81a3d4f0e420ff488fe6b2f0a | import logging
from ariadne import MutationType, convert_kwargs_to_snake_case
from config import clients, messages, queue
mutation = MutationType()
@mutation.field("createMessage")
@convert_kwargs_to_snake_case
async def resolve_create_message(obj, info, content, client_id):
try:
message = {"content": co... | [((134, 148), 'ariadne.MutationType', 'MutationType', ([], {}), '()\n', (146, 148), False, 'from ariadne import MutationType, convert_kwargs_to_snake_case\n'), ((359, 383), 'config.messages.append', 'messages.append', (['message'], {}), '(message)\n', (374, 383), False, 'from config import clients, messages, queue\n'),... |
MaxwellDPS/healthchecks | hc/api/transports.py | 3730c67c803e707ae51b01bacf2929bd053ee22f | import os
from django.conf import settings
from django.template.loader import render_to_string
from django.utils import timezone
import json
import requests
from urllib.parse import quote, urlencode
from hc.accounts.models import Profile
from hc.lib import emails
from hc.lib.string import replace
try:
import app... | [((2383, 2435), 'hc.lib.emails.alert', 'emails.alert', (['self.channel.email_value', 'ctx', 'headers'], {}), '(self.channel.email_value, ctx, headers)\n', (2395, 2435), False, 'from hc.lib import emails\n'), ((3164, 3186), 'hc.lib.string.replace', 'replace', (['template', 'ctx'], {}), '(template, ctx)\n', (3171, 3186),... |
Graviti-AI/graviti-python-sdk | graviti/portex/builder.py | d2faf86b4718416503b965f6057b31015417446f | #!/usr/bin/env python3
#
# Copyright 2022 Graviti. Licensed under MIT License.
#
"""Portex type builder related classes."""
from hashlib import md5
from pathlib import Path
from shutil import rmtree
from subprocess import PIPE, CalledProcessError, run
from tempfile import gettempdir
from typing import TYPE_CHECKING, ... | [((1028, 1065), 'typing.TypeVar', 'TypeVar', (['"""_I"""'], {'bound': '"""BuilderImports"""'}), "('_I', bound='BuilderImports')\n", (1035, 1065), False, 'from typing import TYPE_CHECKING, Any, Dict, List, Tuple, Type, TypeVar\n'), ((1501, 1506), 'hashlib.md5', 'md5', ([], {}), '()\n', (1504, 1506), False, 'from hashlib... |
SGeetansh/dffml | dffml/operation/mapping.py | 04647bdcadef2f7e7b59cdd8ac1e89f17ef1095b | from typing import Dict, List, Any
from ..df.types import Definition
from ..df.base import op
from ..util.data import traverse_get
MAPPING = Definition(name="mapping", primitive="map")
MAPPING_TRAVERSE = Definition(name="mapping_traverse", primitive="List[str]")
MAPPING_KEY = Definition(name="key", primitive="str")
M... | [] |
Vijay-P/anchore-engine | anchore_engine/services/policy_engine/__init__.py | 660a0bf10c56d16f894919209c51ec7a12081e9b | import time
import sys
import pkg_resources
import os
import retrying
from sqlalchemy.exc import IntegrityError
# anchore modules
import anchore_engine.clients.services.common
import anchore_engine.subsys.servicestatus
import anchore_engine.subsys.metrics
from anchore_engine.subsys import logger
from anchore_engine.c... | [((9137, 9318), 'retrying.retry', 'retrying.retry', ([], {'stop_max_attempt_number': 'FEED_SYNC_RETRIES', 'wait_incrementing_start': '(FEED_SYNC_RETRY_BACKOFF * 1000)', 'wait_incrementing_increment': '(FEED_SYNC_RETRY_BACKOFF * 1000)'}), '(stop_max_attempt_number=FEED_SYNC_RETRIES,\n wait_incrementing_start=FEED_SYN... |
EvandoBlanco/juriscraper | juriscraper/oral_args/united_states/federal_appellate/scotus.py | 3d16af258620d4ba1b4827f66ef69e8a2c5a0484 | """Scraper for Supreme Court of U.S.
CourtID: scotus
Court Short Name: scotus
History:
- 2014-07-20 - Created by Andrei Chelaru, reviewed by MLR
- 2017-10-09 - Updated by MLR.
"""
from datetime import datetime
from juriscraper.OralArgumentSite import OralArgumentSite
class Site(OralArgumentSite):
def __init__... | [((1318, 1350), 'datetime.datetime.strptime', 'datetime.strptime', (['s', '"""%m/%d/%y"""'], {}), "(s, '%m/%d/%y')\n", (1335, 1350), False, 'from datetime import datetime\n')] |
pengzhansun/CF-CAR | code/main.py | 2e497a4da0bcc80bb327ee041f1aa0107f53bc3f | # -*- coding: utf-8 -*-
import argparse
import os
import shutil
import time
import numpy as np
import random
from collections import OrderedDict
import torch
import torch.backends.cudnn as cudnn
from callbacks import AverageMeter
from data_utils.causal_data_loader_frames import VideoFolder
from utils impo... | [((371, 428), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Counterfactual CAR"""'}), "(description='Counterfactual CAR')\n", (394, 428), False, 'import argparse\n'), ((6328, 6342), 'model.model_lib.BboxVisualModel', 'RGBModel', (['args'], {}), '(args)\n', (6336, 6342), True, 'from mode... |
114000/webapp-boilerplate | api/application/__init__.py | 0550396694b4f009e5d862b0098bf7d1f61a4a40 | # encoding: utf-8
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
import logging
app = Flask(__name__)
CORS(app, resources={r"/*": {"origins": "*"}})
app.config.from_object('config.current')
db = SQLAlchemy(app)
logger = logging.getLogger(__name__)
log... | [((144, 159), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (149, 159), False, 'from flask import Flask\n'), ((161, 206), 'flask_cors.CORS', 'CORS', (['app'], {'resources': "{'/*': {'origins': '*'}}"}), "(app, resources={'/*': {'origins': '*'}})\n", (165, 206), False, 'from flask_cors import CORS\n'), ((2... |
jefftc/changlab | Betsy/Betsy/modules/get_illumina_control.py | 11da8c415afefcba0b0216238387c75aeb3a56ac | from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, antecedents, out_attributes, user_options, num_cores,
outfile):
import os
import shutil
from genomicode import filelib
... | [((97, 126), 'Module.AbstractModule.__init__', 'AbstractModule.__init__', (['self'], {}), '(self)\n', (120, 126), False, 'from Module import AbstractModule\n'), ((368, 398), 'os.listdir', 'os.listdir', (['in_data.identifier'], {}), '(in_data.identifier)\n', (378, 398), False, 'import os\n'), ((638, 664), 'genomicode.fi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.