repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
Smokrow/tensorflow | tensorflow/contrib/data/python/kernel_tests/optimization/map_and_filter_fusion_test.py | debd66dae1c9a49d36ea006c97facf06b4ac25cb | # 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... | [((7754, 7765), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (7763, 7765), False, 'from tensorflow.python.platform import test\n'), ((4979, 5022), 'tensorflow.python.framework.constant_op.constant', 'constant_op.constant', (['(3)'], {'dtype': 'dtypes.int64'}), '(3, dtype=dtypes.int64)\n', (499... |
jpirnay/meerk40t | meerk40t/lihuiyu/lihuiyuemulator.py | 10d4e41a8c5e2bb95a504904273699e115822b9b | from meerk40t.core.cutcode import CutCode, RawCut
from meerk40t.core.parameters import Parameters
from meerk40t.core.units import UNITS_PER_MIL
from meerk40t.kernel import Module
from meerk40t.numpath import Numpath
from meerk40t.svgelements import Color
class LihuiyuEmulator(Module):
def __init__(self, context, ... | [((335, 371), 'meerk40t.kernel.Module.__init__', 'Module.__init__', (['self', 'context', 'path'], {}), '(self, context, path)\n', (350, 371), False, 'from meerk40t.kernel import Module\n'), ((1757, 1801), 'meerk40t.core.parameters.Parameters', 'Parameters', (["{'speed': 20.0, 'power': 1000.0}"], {}), "({'speed': 20.0, ... |
lleiyyang/tencentcloud-sdk-python | tencentcloud/dbbrain/v20210527/models.py | e6e6a4ce89286673b2322ae92d3c2fbf8665aa0b | # -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | [] |
giuseppe/quay | oauth/provider.py | a1b7e4b51974edfe86f66788621011eef2667e6a | # Ported to Python 3
# Originally from https://github.com/DeprecatedCode/oauth2lib/blob/d161b010f8a596826050a09e5e94d59443cc12d9/oauth2lib/provider.py
import json
import logging
from requests import Response
from io import StringIO
try:
from werkzeug.exceptions import Unauthorized
except ImportError:
Unauthor... | [((674, 701), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (691, 701), False, 'import logging\n'), ((1189, 1199), 'requests.Response', 'Response', ([], {}), '()\n', (1197, 1199), False, 'from requests import Response\n'), ((1328, 1342), 'io.StringIO', 'StringIO', (['body'], {}), '(body)... |
TomHacker/ImageCluster | main.py | c4262e08a61c50b6d850ba29bc4d56d21c789aa9 | from model import ImageCluster
m=ImageCluster(
base_model='vgg16',#your feature map extractor model
resorted_img_folder='resorted_data',#the folder for clustered images
cluster_algo='kmeans',#cluster algorithm
base_img_folder='data',
maxK=150,#the max k num is 30, which means ImageCluster calculates... | [((33, 163), 'model.ImageCluster', 'ImageCluster', ([], {'base_model': '"""vgg16"""', 'resorted_img_folder': '"""resorted_data"""', 'cluster_algo': '"""kmeans"""', 'base_img_folder': '"""data"""', 'maxK': '(150)'}), "(base_model='vgg16', resorted_img_folder='resorted_data',\n cluster_algo='kmeans', base_img_folder='... |
arvindmuralie77/gradsflow | tests/dummies.py | d6ec5bc517dcf714cd4ecb91a7f702dce6bded3f | # Copyright (c) 2021 GradsFlow. 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 ... | [((727, 748), 'torch.nn.Linear', 'torch.nn.Linear', (['(1)', '(4)'], {}), '(1, 4)\n', (742, 748), False, 'import torch\n'), ((906, 924), 'torch.as_tensor', 'torch.as_tensor', (['(1)'], {}), '(1)\n', (921, 924), False, 'import torch\n'), ((1010, 1028), 'torch.as_tensor', 'torch.as_tensor', (['(1)'], {}), '(1)\n', (1025,... |
gneumann333/jumpscaleX_core | JumpscaleCore/tools/executor/ExecutorSerial.py | 777d249fa3668c6e802c2f765f4b82fb39c3e5fa | from Jumpscale import j
JSBASE = j.baseclasses.object
from .ExecutorBase import *
import serial
class ExecutorSerial(ExecutorBase):
"""
This executor is primary made to communicate with devices (routers, switch, ...) over
console cable but you can use underlaying method to communicate with any serial de... | [((959, 1108), 'serial.Serial', 'serial.Serial', ([], {'port': 'self.device', 'baudrate': 'self.baudrate', 'parity': 'self.parity', 'stopbits': 'self.stopbits', 'bytesize': 'self.bytesize', 'timeout': 'self.timeout'}), '(port=self.device, baudrate=self.baudrate, parity=self.parity,\n stopbits=self.stopbits, bytesize... |
MelisaDev/melisa | melisa/utils/snowflake.py | 53fee10d8c1bf4dd716bc90096c16f096e11bfbf | # Copyright MelisaDev 2022 - Present
# Full MIT License can be found in `LICENSE.txt` at the project root.
from __future__ import annotations
class Snowflake(int):
"""
Discord utilizes Twitter's snowflake format for uniquely identifiable descriptors (IDs).
These IDs are guaranteed to be unique across all... | [] |
cul-it/arxiv-rss | feed/serializers/extensions.py | 40c0e859528119cc8ba3700312cb8df095d95cdd | """Classes derived from the Feedgen extension classes."""
from typing import Dict, List, Optional
from lxml import etree
from lxml.etree import Element
from flask import current_app
from feedgen.ext.base import BaseEntryExtension, BaseExtension
from feed.domain import Author, Media
class ArxivExtension(BaseExtensio... | [((2938, 3000), 'lxml.etree.SubElement', 'etree.SubElement', (['entry', '"""{http://search.yahoo.com/mrss}group"""'], {}), "(entry, '{http://search.yahoo.com/mrss}group')\n", (2954, 3000), False, 'from lxml import etree\n'), ((3051, 3113), 'lxml.etree.SubElement', 'etree.SubElement', (['group', '"""{http://search.yahoo... |
lranjbar/assisted-test-infra | discovery-infra/test_infra/helper_classes/config/controller_config.py | 89cd4e16744afa646af88975f8038ca1774bcfa4 | from abc import ABC
from pathlib import Path
from typing import Any
from dataclasses import dataclass
from test_infra import consts
from test_infra.utils.global_variables import GlobalVariables
from .base_config import _BaseConfig
global_variables = GlobalVariables()
@dataclass
class BaseNodeConfig(_BaseConfig, AB... | [((253, 270), 'test_infra.utils.global_variables.GlobalVariables', 'GlobalVariables', ([], {}), '()\n', (268, 270), False, 'from test_infra.utils.global_variables import GlobalVariables\n')] |
obulpathi/bitcoinpy | bitcoinpy/mempool.py | 8f41e0221f2ff2d35697b6d4e5397deb7de09c3d | # MemPool.py
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import logging
from lib.serialize import uint256_to_shortstr
class MemPool(object):
def __init__(self):
self.pool = {}
# setup logging
logging.basicConfi... | [((302, 342), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (321, 342), False, 'import logging\n'), ((359, 386), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (376, 386), False, 'import logging\n'), ((458, 483), 'lib.serialize.... |
sarvi/bashspy | bashspy/parser.py | 088f2cdfd00d29b4c7a98ec311f6e6c382ba4749 | '''
Created on Jun 13, 2019
@author: sarvi
'''
from sly import Parser
from .lexer import BashLexer
class ASTCommands(list):
__slots__ = ('grouping')
def __init__(self, command, grouping=None):
self.append(command)
self.grouping = grouping
def __repr__(self):
x=[str(i) for i in s... | [] |
biomed-bioinformatics-bootcamp/bmes-t580-2019-coursework-charrison620 | Module03/pregnancy_wheel.py | 4f53e9290b456f582464c86d114c794c1448b995 | import datetime
def print_header():
print('----------------------------')
print(' Due Date APP ')
print('----------------------------')
print()
def get_lmp_from_patient():
print("When was the patient's last normal menstrual cycle? ")
date_str = input('Format: [dd/mm/yyyy}')
... | [((558, 589), 'datetime.date', 'datetime.date', (['year', 'month', 'day'], {}), '(year, month, day)\n', (571, 589), False, 'import datetime\n'), ((732, 803), 'datetime.date', 'datetime.date', (['target_date.year', 'original_date.month', 'original_date.day'], {}), '(target_date.year, original_date.month, original_date.d... |
connor-c/Trip-Gas-Cost-Calculator | costcalculator/forms.py | 6101093ffd48b6cb6c4f847b8c1f40351617750b | from django import forms
from django.core.validators import MinValueValidator, MinLengthValidator
class OriginForm(forms.Form):
origin_address = forms.CharField(validators=[MinLengthValidator(1)], widget=forms.TextInput(attrs={'class': 'form-control', 'id': 'inlineFormInputGroup', 'placeholder': '123 Tech St, Sili... | [((209, 351), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'class': 'form-control', 'id': 'inlineFormInputGroup', 'placeholder':\n '123 Tech St, Silicon Valley, CA 00000'}"}), "(attrs={'class': 'form-control', 'id':\n 'inlineFormInputGroup', 'placeholder':\n '123 Tech St, Silicon Valley, CA 00... |
Ayouuuu/bili2.0 | tasks/storm_raffle_handler.py | 1108e39208e56f129fb5eb6605a5b3f1aadc0d8f | import bili_statistics
from reqs.storm_raffle_handler import StormRaffleHandlerReq
from tasks.utils import UtilsTask
from .base_class import Forced, DontWait, Multi
class StormRaffleJoinTask(Forced, DontWait, Multi):
TASK_NAME = 'join_storm_raffle'
# 为了速度,有时不用等room_id验证就参加,置room_id为0,is_normal_room自然会返回固定值tr... | [((1548, 1603), 'bili_statistics.add2joined_raffles', 'bili_statistics.add2joined_raffles', (['"""节奏风暴(合计)"""', 'user.id'], {}), "('节奏风暴(合计)', user.id)\n", (1582, 1603), False, 'import bili_statistics\n'), ((1839, 1896), 'bili_statistics.add2results', 'bili_statistics.add2results', (['gift_name', 'user.id', 'gift_num']... |
ALSM-PhD/quip_classification | u24_lymphocyte/third_party/treeano/sandbox/nodes/gradnet.py | 7347bfaa5cf11ae2d7a528fbcc43322a12c795d3 | import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
fX = theano.config.floatX
@treeano.register_node("grad_net_interpolation")
class GradNetInterpolationNode(treeano.NodeImpl):
"""
interpolates outputs between 2 nodes
"""
hyperparameter_names = ("late_gate",)
chil... | [((113, 160), 'treeano.register_node', 'treeano.register_node', (['"""grad_net_interpolation"""'], {}), "('grad_net_interpolation')\n", (134, 160), False, 'import treeano\n'), ((1664, 1721), 'treeano.register_node', 'treeano.register_node', (['"""grad_net_optimizer_interpolation"""'], {}), "('grad_net_optimizer_interpo... |
brohammer/Minus80 | minus80/RawFile.py | 3cd5b61a7349b9fa6d35ed192d8a4f38523f92bb | import gzip #pragma: no cover
import bz2 #pragma: no cover
import lzma #pragma: no cover
class RawFile(object):#pragma: no cover
def __init__(self,filename):
self.filename = filename
if filename.endswith('.gz'):
self.handle = gzip.open(filename,'rt')
elif filename.endsw... | [((268, 293), 'gzip.open', 'gzip.open', (['filename', '"""rt"""'], {}), "(filename, 'rt')\n", (277, 293), False, 'import gzip\n'), ((359, 383), 'bz2.open', 'bz2.open', (['filename', '"""rt"""'], {}), "(filename, 'rt')\n", (367, 383), False, 'import bz2\n'), ((448, 473), 'lzma.open', 'lzma.open', (['filenaem', '"""rt"""... |
jtr109/Alpha2kindle | utils/config.py | a411d05cafa9036a732eeb75fa13f68963f254e3 | # -*- coding: utf-8 -*-
import os
class BaseConf(object):
HEADERS = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/55.0.2883.95 "
"Safari/537.36",
"Accept": "tex... | [((721, 748), 'os.environ.get', 'os.environ.get', (['"""REDIS_PWD"""'], {}), "('REDIS_PWD')\n", (735, 748), False, 'import os\n')] |
fabmiz/osf.io | framework/database/__init__.py | 8d86af3f0a6e5388bd5b18383e68e27b65a66247 | # -*- coding: utf-8 -*-
import functools
import httplib as http
import markupsafe
from django.core.paginator import Paginator
from django.db.models import Q, QuerySet
from framework.exceptions import HTTPError
def get_or_http_error(Model, pk_or_query, allow_deleted=False, display_name=None):
"""Load an instance ... | [((1284, 1315), 'markupsafe.escape', 'markupsafe.escape', (['display_name'], {}), '(display_name)\n', (1301, 1315), False, 'import markupsafe\n'), ((3365, 3386), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (3380, 3386), False, 'import functools\n'), ((2469, 2489), 'framework.exceptions.HTTPError',... |
jiji-online/neptune-cli | neptune/internal/client_library/job_development_api/image.py | 50cf680a80d141497f9331ab7cdaee49fcb90b0c | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016, deepsense.io
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [((646, 680), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (678, 680), False, 'from future import standard_library\n'), ((1954, 1966), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (1964, 1966), False, 'import io\n'), ((2113, 2125), 'neptune.generated.swagger_client.I... |
guibohnert91/picome | src/picome/hukeyboard.py | 9b91c28f7e83a2b730cafbda1a97205672f3e676 | from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
import usb_hid
import time
class HumanKeyboard(object):
def __init__(self):
self.keyboard = Keyboard(usb_hid.devices)
self.keyboardLayout = KeyboardLayou... | [((251, 276), 'adafruit_hid.keyboard.Keyboard', 'Keyboard', (['usb_hid.devices'], {}), '(usb_hid.devices)\n', (259, 276), False, 'from adafruit_hid.keyboard import Keyboard\n'), ((307, 338), 'adafruit_hid.keyboard_layout_us.KeyboardLayoutUS', 'KeyboardLayoutUS', (['self.keyboard'], {}), '(self.keyboard)\n', (323, 338),... |
hychrisli/PyAlgorithms | src/solutions/part2/q104_max_bi_tree_depth.py | 71e537180f3b371d0d2cc47b11cb68ec13a8ac68 | from src.base.solution import Solution
from src.tests.part2.q104_test_max_bi_tree_depth import MaxBiTreeDepthTestCases
class MaxBiTreeDepth(Solution):
def gen_test_cases(self):
return MaxBiTreeDepthTestCases()
def run_test(self, input):
return self.maxDepth(input)
def maxDepth(self, root... | [((198, 223), 'src.tests.part2.q104_test_max_bi_tree_depth.MaxBiTreeDepthTestCases', 'MaxBiTreeDepthTestCases', ([], {}), '()\n', (221, 223), False, 'from src.tests.part2.q104_test_max_bi_tree_depth import MaxBiTreeDepthTestCases\n')] |
shakyasaijal/businessAnalytics | inventory/admin.py | 9312bae79709387c6eadd50f87f6be85bd52c396 | from django.contrib import admin
from . import models
class SupplierAdmin(admin.ModelAdmin):
list_display = ('supplier_name', 'contact', )
search_fields = ['supplier_name', 'contact', ]
admin.site.register(models.Suppliers, SupplierAdmin)
class InventoryUserAdmin(admin.ModelAdmin):
list_display = ('empl... | [((197, 249), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Suppliers', 'SupplierAdmin'], {}), '(models.Suppliers, SupplierAdmin)\n', (216, 249), False, 'from django.contrib import admin\n'), ((430, 491), 'django.contrib.admin.site.register', 'admin.site.register', (['models.InventoryUser', 'In... |
jnthn/intellij-community | python/testData/resolve/TryExceptElse.py | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | try:
name = ""
except:
pass
else:
print na<ref>me | [] |
ms7m/py-byte | pybyte/session.py | c5872ff5b8536160d8cbd7f88406ed593113e77d |
import requests
class ByteSession(object):
def __init__(self, token, providedSession=False):
self._userToken = token
if providedSession == False:
self._session = requests.session()
else:
self._session = providedSession
self._session.headers = {
... | [((196, 214), 'requests.session', 'requests.session', ([], {}), '()\n', (212, 214), False, 'import requests\n')] |
secantsquared/pyqtgraph | pyqtgraph/examples/template.py | 3ef7f5b91639543e43bcd66a84290fb9bc18fc5c | # -*- coding: utf-8 -*-
"""
Description of example
"""
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui, mkQApp
import numpy as np
app = mkQApp()
# win.setWindowTitle('pyqtgraph example: ____')
if __name__ == '__main__':
pg.exec()
| [((152, 160), 'pyqtgraph.Qt.mkQApp', 'mkQApp', ([], {}), '()\n', (158, 160), False, 'from pyqtgraph.Qt import QtCore, QtGui, mkQApp\n'), ((242, 251), 'pyqtgraph.exec', 'pg.exec', ([], {}), '()\n', (249, 251), True, 'import pyqtgraph as pg\n')] |
cas-packone/ambari-chs | ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py | 68033fbd4b810b6642853f2ad9128cbbd4e0cb7b | '''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | [] |
awesome-archive/python-debugging-skills | debugging/code/multiprocess_main.py | 69af455302a805d6f198a06ea934f79d5913cb3e | # -*- encoding: utf-8 -*-
import multiprocessing as mp
import time
from pudb.remote import set_trace
def worker(worker_id):
""" Simple worker process"""
i = 0
while i < 10:
if worker_id == 1: # debug process with id 1
set_trace(term_size=(80, 24))
time.sleep(1) # represents ... | [((292, 305), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (302, 305), False, 'import time\n'), ((514, 553), 'multiprocessing.Process', 'mp.Process', ([], {'target': 'worker', 'args': '(p_id,)'}), '(target=worker, args=(p_id,))\n', (524, 553), True, 'import multiprocessing as mp\n'), ((254, 283), 'pudb.remote.se... |
bytesnake/Enzyme | lldb/packages/Python/lldbsuite/test/expression_command/anonymous-struct/TestCallUserAnonTypedef.py | 247606c279920d476645d2e319e574bf8be10fc9 | """
Test calling user defined functions using expression evaluation.
This test checks that typesystem lookup works correctly for typedefs of
untagged structures.
Ticket: https://llvm.org/bugs/show_bug.cgi?id=26790
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lld... | [((1031, 1146), 'lldbsuite.test.lldbutil.run_break_set_by_file_and_line', 'lldbutil.run_break_set_by_file_and_line', (['self', '"""main.cpp"""', 'self.line'], {'num_expected_locations': '(-1)', 'loc_exact': '(True)'}), "(self, 'main.cpp', self.line,\n num_expected_locations=-1, loc_exact=True)\n", (1070, 1146), Fals... |
ThomasDLi/simple-photo-editor | main.py | f8b3f1025155e2542b93b94c12d607b9b5e45731 | from PIL import Image, ImageEnhance
user_account_name = "Thomas.Li26"
def main():
mode = input("Specify image editing mode. Type DEEPFRY, STRETCH, BRIGHTNESS, SHARPEN, or INVERT: ")
if mode == "DEEPFRY":
DEEPFRY()
if mode == "STRETCH":
STRETCH()
if mode == "INVERT":
... | [((647, 672), 'PIL.ImageEnhance.Contrast', 'ImageEnhance.Contrast', (['im'], {}), '(im)\n', (668, 672), False, 'from PIL import Image, ImageEnhance\n'), ((1474, 1499), 'PIL.ImageEnhance.Contrast', 'ImageEnhance.Contrast', (['im'], {}), '(im)\n', (1495, 1499), False, 'from PIL import Image, ImageEnhance\n'), ((1830, 185... |
G00dBye/YYMS | scripts/field/Curbrock_Summon1.py | 1de816fc842b6598d5b4b7896b6ab0ee8f7cdcfb | # Curbrock Summon 2
CURBROCK2 = 9400930 # MOD ID
CURBROCKS_ESCAPE_ROUTE_VER2 = 600050040 # MAP ID
CURBROCKS_ESCAPE_ROUTE_VER3 = 600050050 # MAP ID 2
sm.spawnMob(CURBROCK2, 190, -208, False)
sm.createClock(1800)
sm.addEvent(sm.invokeAfterDelay(1800000, "warp", CURBROCKS_ESCAPE_ROUTE_VER3, 0))
sm.waitForMobDeath(CURBRO... | [] |
Gerryflap/master_thesis | trainloops/listeners/cluster_killswitch.py | 5dc16e21b23837fee8a4532679bb5cb961af0b7c | """
Cancelling jobs on the University cluster forces programs to instantly quit,
which sometimes crashes cluster nodes.
As a remedy, this killswitch listener will stop the experiment in a nicer way to prevent this from happening.
The experiment will be stopped if a file named "stop" is encountered i... | [((616, 653), 'os.path.join', 'os.path.join', (['experiment_path', '"""stop"""'], {}), "(experiment_path, 'stop')\n", (628, 653), False, 'import os\n'), ((740, 765), 'os.path.exists', 'os.path.exists', (['self.path'], {}), '(self.path)\n', (754, 765), False, 'import os\n')] |
andela/ah-backend-spaces- | authors/apps/notifications/views.py | 58e031a96a6b9555f1a4133cf8cb688c236d3f3b | from rest_framework import status
from rest_framework.generics import (
RetrieveUpdateAPIView, CreateAPIView,
RetrieveUpdateDestroyAPIView
)
from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from ..authenticatio... | [((1420, 1477), 'rest_framework.response.Response', 'Response', (['serializer.data'], {'status': 'status.HTTP_201_CREATED'}), '(serializer.data, status=status.HTTP_201_CREATED)\n', (1428, 1477), False, 'from rest_framework.response import Response\n'), ((2177, 2254), 'rest_framework.response.Response', 'Response', (["{... |
bopopescu/build | scripts/common/frozendict.py | 4e95fd33456e552bfaf7d94f7d04b19273d1c534 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Implements a frozen dictionary-like object"""
import collections
import copy
import common.memo as memo
class frozendict(collections.Mapping):
"""A f... | [((587, 600), 'common.memo.memo_i', 'memo.memo_i', ([], {}), '()\n', (598, 600), True, 'import common.memo as memo\n'), ((975, 988), 'common.memo.memo_i', 'memo.memo_i', ([], {}), '()\n', (986, 988), True, 'import common.memo as memo\n'), ((945, 970), 'copy.deepcopy', 'copy.deepcopy', (['self._data'], {}), '(self._data... |
yogeshkheri/geonode-avatar | avatar/__init__.py | 293474f814117ae680278223c8cdf8d59c67862d | __version__ = '5.0.2'
| [] |
mmanganel/neurecon | __init__.py | 5e86324675985f1fedfc4d5d3ac2e750f480538f | from neurecon.reconstruction import reconstruct
| [] |
gnvidal/Codewars | Fundamentals/Reversed Strings.py | 117a83bd949a1503f31f1f915641e96e7bf7a04c | def solution(string):
return string[::-1]
| [] |
zmxdream/FlexFlow | python/flexflow/keras/datasets/cifar.py | 7ea50d71a02e853af7ae573d88c911511b3e82e0 | # -*- coding: utf-8 -*-
"""Utilities common to CIFAR10 and CIFAR100 datasets.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
from six.moves import cPickle
def load_batch(fpath, label_key='labels'):
"""Internal utility for parsing CIFAR ... | [((602, 617), 'six.moves.cPickle.load', 'cPickle.load', (['f'], {}), '(f)\n', (614, 617), False, 'from six.moves import cPickle\n'), ((648, 681), 'six.moves.cPickle.load', 'cPickle.load', (['f'], {'encoding': '"""bytes"""'}), "(f, encoding='bytes')\n", (660, 681), False, 'from six.moves import cPickle\n')] |
Seralpa/Advent-of-code | day7/p2.py | 9633624e4ff48c50d8be3deac54c83059e9c3b04 | def getNumBags(color):
if color=='':
return 0
numBags=1
for bag in rules[color]:
numBags+=bag[1]*getNumBags(bag[0])
return numBags
with open('day7/input.txt') as f:
rules=dict([l.split(' contain') for l in f.read().replace(' bags', '').replace(' bag', '').replace('.', '').replace(' ... | [] |
6tennis/dl | adv/luther.py | 69eb7e71da9fabe9e7ec40c461b525b4f967f345 | from core.advbase import *
from slot.d import *
def module():
return Luther
class Luther(Adv):
a1 = ('cc',0.10,'hit15')
conf = {}
conf ['slots.d'] = Leviathan()
conf['acl'] = """
`dragon
`s1
`s2, seq=5 and cancel
`s3, seq=5 and cancel or fsc
`fs, seq=5
... | [((440, 471), 'core.simulate.test_with_argv', 'test_with_argv', (['None', '*sys.argv'], {}), '(None, *sys.argv)\n', (454, 471), False, 'from core.simulate import test_with_argv\n')] |
macio232/client | wandb/sdk/data_types/image.py | 295380c99b1a0946470672d40348b17a674ad17f | import hashlib
from io import BytesIO
import logging
import os
from typing import Any, cast, Dict, List, Optional, Sequence, Type, TYPE_CHECKING, Union
from pkg_resources import parse_version
import wandb
from wandb import util
from ._private import MEDIA_TMP
from .base_types.media import BatchableMedia, Media
from .... | [((1238, 1265), 'wandb.util._get_max_cli_version', 'util._get_max_cli_version', ([], {}), '()\n', (1263, 1265), False, 'from wandb import util\n'), ((1330, 1354), 'pkg_resources.parse_version', 'parse_version', (['"""0.12.10"""'], {}), "('0.12.10')\n", (1343, 1354), False, 'from pkg_resources import parse_version\n'), ... |
skostic14/isda-racing-backend | src/ACC_Backend_Utils.py | 41b5f9760dc17a29aa8ab5e4cc1894a27496a72c | import datetime
# Gets time from milliseconds
# Returns string formatted as HH:MM:SS:mmm, MM:SS:mmm or S:mmm, depending on the time.
def get_time_from_milliseconds(milli):
milliseconds = milli % 1000
seconds= (milli//1000)%60
minutes= (milli//(1000*60))%60
hours= (milli//(1000*60*60))%24
if hours... | [((627, 648), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (646, 648), False, 'import datetime\n')] |
ovolve/sympy | examples/advanced/pidigits.py | 0a15782f20505673466b940454b33b8014a25c13 | #!/usr/bin/env python
"""Pi digits example
Example shows arbitrary precision using mpmath with the
computation of the digits of pi.
"""
from mpmath import libmp, pi
from mpmath import functions as mpf_funs
import math
from time import clock
import sys
def display_fraction(digits, skip=0, colwidth=10, columns=5):
... | [((1224, 1246), 'mpmath.libmp.numeral', 'libmp.numeral', (['(3)', 'base'], {}), '(3, base)\n', (1237, 1246), False, 'from mpmath import libmp, pi\n'), ((1426, 1433), 'time.clock', 'clock', ([], {}), '()\n', (1431, 1433), False, 'from time import clock\n'), ((1548, 1555), 'time.clock', 'clock', ([], {}), '()\n', (1553, ... |
yopiti/authserver | authserver/mailauth/migrations/0011_mnserviceuser.py | 0a1f7f5a83d03963d1ecfb5199be8e05d3068dfd | # -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-13 00:16
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import mailauth.models
import uuid
class Migration(migrations.Migration):
dependencies = [
... | [((505, 598), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (521, 598), False, 'from django.db import migrations, models\... |
rishabh20111990/tempest | tempest/hacking/checks.py | df15531cd4231000b0da016f5cd8641523ce984e | # Copyright 2013 IBM Corp.
#
# 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 wri... | [((878, 907), 're.compile', 're.compile', (['"""^\\\\s*def test.*"""'], {}), "('^\\\\s*def test.*')\n", (888, 907), False, 'import re\n'), ((942, 986), 're.compile', 're.compile', (['"""^\\\\s+def (setUp|tearDown)Class"""'], {}), "('^\\\\s+def (setUp|tearDown)Class')\n", (952, 986), False, 'import re\n'), ((1008, 1047)... |
harshp8l/deep-learning-lang-detection | data/train/python/6a98547230e4cc83fa248137ca0fde09ebb67dcfController.py | 2a54293181c1c2b1a2b840ddee4d4d80177efb33 | import SimpleXMLRPCServer
import sys
import logging
from K8055Controller import K8055Controller
logging.basicConfig()
controller_log = logging.getLogger("Controller")
class Controller:
def __init__(self):
self.k8055 = K8055Controller()
controller_log.debug("initialized")
def reset(s... | [((98, 119), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (117, 119), False, 'import logging\n'), ((138, 169), 'logging.getLogger', 'logging.getLogger', (['"""Controller"""'], {}), "('Controller')\n", (155, 169), False, 'import logging\n'), ((890, 958), 'SimpleXMLRPCServer.SimpleXMLRPCServer', 'Simpl... |
sun1638650145/CRNN | model/__init__.py | 485157e5803b9be861a63ebb04f04fccb16ef5f1 | from .crnn import CRNN
from .crnn import CRNN_Attention | [] |
Lydia-Tan/MindLife | models2.py | 644f1a3834f337d51c99650c3924df99c5200d06 | import nltk
import re
import sys
from sys import argv
from nltk.sentiment.vader import SentimentIntensityAnalyzer
def ajay(ans):
ajay = SentimentIntensityAnalyzer()
completeScore = 0
questionWeights = [0.05, 0.20, 0.05, 0.05, 0.05, 0.20, 0.05, 0.05, 0.20, 0.10]
print ans
ansList = ans.split("$")
... | [] |
pcmxgti/tokendito | tokendito/tool.py | c1672917b1b95e463c5bdf8e9c3c039189da8e42 | # vim: set filetype=python ts=4 sw=4
# -*- coding: utf-8 -*-
"""This module retrieves AWS credentials after authenticating with Okta."""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
from future import standard_library
from tokendito import aws_helpers
from tokendit... | [((404, 438), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (436, 438), False, 'from future import standard_library\n'), ((584, 603), 'tokendito.helpers.setup', 'helpers.setup', (['args'], {}), '(args)\n', (597, 603), False, 'from tokendito import helpers\n'), ((609, 6... |
Boryslavq/UHMI_Chalenge | resources/__init__.py | 4b7df902c0a0901c727a6fb26347dabca1067494 | from . import rest
from . import helpers
| [] |
cakiki/ir_datasets | ir_datasets/formats/trec.py | 7f9f8e9ff62e49d40383220ecc2daa250695d267 | import io
import codecs
import tarfile
import re
import gzip
import xml.etree.ElementTree as ET
from fnmatch import fnmatch
from pathlib import Path
from typing import NamedTuple
import ir_datasets
from ir_datasets.indices import PickleLz4FullStore
from .base import GenericDoc, GenericQuery, GenericScoredDoc, BaseDocs,... | [((4806, 4833), 'ir_datasets.lazy_libs.bs4', 'ir_datasets.lazy_libs.bs4', ([], {}), '()\n', (4831, 4833), False, 'import ir_datasets\n'), ((4860, 4902), 'codecs.getreader', 'codecs.getreader', (["(self._encoding or 'utf8')"], {}), "(self._encoding or 'utf8')\n", (4876, 4902), False, 'import codecs\n'), ((5952, 5994), '... |
caufieldjh/textpand-for-kgs | textpand/download.py | 42853c53c5a4cc06fbd745c147d02fe7916690fa | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .utils import download_from_yaml
def download(output_dir: str, snippet_only: bool, ignore_cache: bool = False) -> None:
"""Downloads data files from list of URLs (default: download.yaml) into data directory (default: data/).
Args:
output_dir: A str... | [] |
usegalaxy-no/usegalaxy | venv/lib/python3.6/site-packages/ansible_collections/netapp/ontap/plugins/modules/na_ontap_autosupport_invoke.py | 75dad095769fe918eb39677f2c887e681a747f3a | #!/usr/bin/python
# (c) 2020, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
'''
na_ontap_autosupport_invoke
'''
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
's... | [((2095, 2124), 'ansible_collections.netapp.ontap.plugins.module_utils.netapp.has_netapp_lib', 'netapp_utils.has_netapp_lib', ([], {}), '()\n', (2122, 2124), True, 'import ansible_collections.netapp.ontap.plugins.module_utils.netapp as netapp_utils\n'), ((2277, 2319), 'ansible_collections.netapp.ontap.plugins.module_ut... |
armandomeeuwenoord/freight | tests/api/serializer/test_user.py | 31ae2fa9252ab0b25385abd04742475e6671e3b1 | from freight.api.serializer import serialize
from freight.testutils import TestCase
class UserSerializerTest(TestCase):
def test_simple(self):
user = self.create_user()
result = serialize(user)
assert result["id"] == str(user.id)
assert result["name"] == user.name
| [((201, 216), 'freight.api.serializer.serialize', 'serialize', (['user'], {}), '(user)\n', (210, 216), False, 'from freight.api.serializer import serialize\n')] |
UP-RS-ESP/GEW-DAP04-WS201819 | binning/pozo_5m_class_dem.py | 18341620d9168e1eec476af1d8f568cf0017bf56 | import sys
import numpy as np
from matplotlib import pyplot as pl
from rw import WriteGTiff
fn = '../pozo-steep-vegetated-pcl.npy'
pts = np.load(fn)
x, y, z, c = pts[:, 0], pts[:, 1], pts[:, 2], pts[:, 5]
ix = (0.2 * (x - x.min())).astype('int')
iy = (0.2 * (y - y.min())).astype('int')
shape = (100, 100)
xb = np.aran... | [((138, 149), 'numpy.load', 'np.load', (['fn'], {}), '(fn)\n', (145, 149), True, 'import numpy as np\n'), ((313, 336), 'numpy.arange', 'np.arange', (['(shape[1] + 1)'], {}), '(shape[1] + 1)\n', (322, 336), True, 'import numpy as np\n'), ((340, 363), 'numpy.arange', 'np.arange', (['(shape[0] + 1)'], {}), '(shape[0] + 1)... |
phuslu/pyMSAA | comtypes/_meta.py | 611bc4c31e0d6ba36f0f0bebdc6e6be14b994eb0 | # comtypes._meta helper module
from ctypes import POINTER, c_void_p, cast
import comtypes
################################################################
# metaclass for CoClass (in comtypes/__init__.py)
def _wrap_coclass(self):
# We are an IUnknown pointer, represented as a c_void_p instance,
# but... | [((411, 423), 'ctypes.POINTER', 'POINTER', (['itf'], {}), '(itf)\n', (418, 423), False, 'from ctypes import POINTER, c_void_p, cast\n')] |
AngelRuizMoreno/Jupyter_Dock_devel | bin/ADFRsuite/CCSBpckgs/mglutil/gui/BasicWidgets/Tk/Dial.py | 6d23bc174d5294d1e9909a0a1f9da0713042339e | ################################################################################
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your op... | [] |
kevinlq/Qt-Creator-Opensource-Study | qt-creator-opensource-src-4.6.1/scripts/checkInstalledFiles.py | b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f | #!/usr/bin/env python
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
#... | [] |
huajian1069/non-convex_optimisation | deep_sdf/workspace.py | cf4cd5070524c3f7e6b814fe9b85a15a06e7b8db | #!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import json
import os
import torch
model_params_subdir = "ModelParameters"
optimizer_params_subdir = "OptimizerParameters"
latent_codes_subdir = "LatentCodes"
logs_filename = "Logs.pth"
reconstructions_subdir = "Reconstructions"
reconstruc... | [((898, 957), 'os.path.join', 'os.path.join', (['experiment_directory', 'specifications_filename'], {}), '(experiment_directory, specifications_filename)\n', (910, 957), False, 'import os\n'), ((1297, 1373), 'os.path.join', 'os.path.join', (['experiment_directory', 'model_params_subdir', "(checkpoint + '.pth')"], {}), ... |
Rahmatullina/FinalYearProject | EmoPy/EmoPy/examples/convolutional_dropout_model.py | 326f521b9f600dbbc7ace2223bd5aafc79b2267c | from EmoPy.src.fermodel import FERModel
from EmoPy.src.directory_data_loader import DirectoryDataLoader
from EmoPy.src.csv_data_loader import CSVDataLoader
from EmoPy.src.data_generator import DataGenerator
from EmoPy.src.neuralnets import ConvolutionalNNDropout
from sklearn.model_selection import train_test_split
impo... | [((595, 667), 'pkg_resources.resource_filename', 'resource_filename', (['"""EmoPy.examples"""', '"""image_data/sample_image_directory"""'], {}), "('EmoPy.examples', 'image_data/sample_image_directory')\n", (612, 667), False, 'from pkg_resources import resource_filename, resource_exists\n'), ((681, 760), 'EmoPy.src.dire... |
captain-c00keys/pyramid-stocks | ENV/lib/python3.6/site-packages/pyramid_jinja2/tests/extensions.py | 0acf3363a6a7ee61cd41b855f43c9d6f9582ae6a | from jinja2 import nodes
from jinja2.ext import Extension
class TestExtension(Extension):
tags = {'test_ext'}
def parse(self, parser): return nodes.Const("This is test extension")
| [((151, 188), 'jinja2.nodes.Const', 'nodes.Const', (['"""This is test extension"""'], {}), "('This is test extension')\n", (162, 188), False, 'from jinja2 import nodes\n')] |
valdivj/Deepstream-IGN-Maker-YOLO | deepstream_ignition_usb_yolo.py | f38ece731e9797a525da932c3da2de77e48f45af | #!/usr/bin/env python3
################################################################################
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),... | [((1319, 1341), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (1334, 1341), False, 'import sys\n'), ((1343, 1398), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../../client_libraries/python/"""'], {}), "(0, '../../../client_libraries/python/')\n", (1358, 1398), False, 'import sys\n'),... |
Py-AMS/pyams-i18n | src/pyams_i18n/tests/__init__.py | dbb3953302311977653145385af02e4d1ae41431 | #
# Copyright (c) 2015-2019 Thierry Florac <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRAN... | [((679, 699), 'os.path.split', 'os.path.split', (['value'], {}), '(value)\n', (692, 699), False, 'import os\n'), ((747, 775), 'sys.path.append', 'sys.path.append', (['package_dir'], {}), '(package_dir)\n', (762, 775), False, 'import sys\n')] |
protagohhz/hivemind | tests/test_custom_experts.py | 487fb68feea4d27ede0afdef211f6edc889b1a9e | import os
import pytest
import torch
from hivemind import RemoteExpert
from hivemind.moe.server import background_server
CUSTOM_EXPERTS_PATH = os.path.join(os.path.dirname(__file__), "test_utils", "custom_networks.py")
@pytest.mark.forked
def test_custom_expert(hid_dim=16):
with background_server(
expe... | [((159, 184), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (174, 184), False, 'import os\n'), ((289, 458), 'hivemind.moe.server.background_server', 'background_server', ([], {'expert_cls': '"""perceptron"""', 'num_experts': '(2)', 'device': '"""cpu"""', 'hidden_dim': 'hid_dim', 'num_handler... |
boyscout2008/tqsdk-python | tqsdk/demo/example/momentum.py | 79496a938a44f79ea9164569637509d0cc7db70a | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Ringo"
'''
价格动量 策略 (难度:初级)
参考: https://www.shinnytech.com/blog/momentum-strategy/
注: 该示例策略仅用于功能示范, 实盘时请根据自己的策略/经验进行修改
'''
from tqsdk import TqAccount, TqApi, TargetPosTask
# 设置指定合约,获取N条K线计算价格动量
SYMBOL = "SHFE.au1912"
N = 15
api = TqApi()
klines = api.get_... | [((295, 302), 'tqsdk.TqApi', 'TqApi', ([], {}), '()\n', (300, 302), False, 'from tqsdk import TqAccount, TqApi, TargetPosTask\n'), ((397, 423), 'tqsdk.TargetPosTask', 'TargetPosTask', (['api', 'SYMBOL'], {}), '(api, SYMBOL)\n', (410, 423), False, 'from tqsdk import TqAccount, TqApi, TargetPosTask\n')] |
AdamSpannbauer/color_transfer | color_transfer/__init__.py | 155e0134615f35bf19bf32f4cacf056603604914 | # import the necessary packages
import numpy as np
import cv2
import imutils
def color_transfer(source, target, clip=True, preserve_paper=True):
"""
Transfers the color distribution from the source to the target
image using the mean and standard deviations of the L*a*b*
color space.
This implemen... | [((2158, 2175), 'cv2.split', 'cv2.split', (['target'], {}), '(target)\n', (2167, 2175), False, 'import cv2\n'), ((3077, 3097), 'cv2.merge', 'cv2.merge', (['[l, a, b]'], {}), '([l, a, b])\n', (3086, 3097), False, 'import cv2\n'), ((4221, 4260), 'cv2.cvtColor', 'cv2.cvtColor', (['source', 'cv2.COLOR_BGR2HSV'], {}), '(sou... |
zseen/hackerrank-challenges | Python/Tree/TestCreateTreeLibraryImport.py | c154f039f58073ee3d94d012462c7055e68784b2 | from Library.CreateATree import CreateATree
tree = CreateATree.BinarySearchTree()
nodesList = list((4, 5, 1, 3, 2))
for i in range(0, len(nodesList)):
tree.insert(nodesList[i])
#tree.printInorder()
tree.printPreorder()
#tree.printPostorder()
| [((52, 82), 'Library.CreateATree.CreateATree.BinarySearchTree', 'CreateATree.BinarySearchTree', ([], {}), '()\n', (80, 82), False, 'from Library.CreateATree import CreateATree\n')] |
Marcelotsvaz/vaz-projects | application/siteApp/urls.py | 8ccc0bf8d25f9276714e1e5ecb0a4e80f07442b4 | #
# VAZ Projects
#
#
# Author: Marcelo Tellier Sartori Vaz <marcelotsvaz@gmail.com>
from django.urls import path
from . import views
app_name = 'siteApp'
urlpatterns = [
path( '', views.Home.as_view(), name = 'home' ),
path( 'about-me', views.About_me.as_view(), name = 'about_me' ),
path( 'searc... | [] |
epicosy/svd | svd/core/exc.py | baa91f57ee5bd51b0140d9d0b1b97ce39f18acc4 |
class SVDError(Exception):
"""Generic errors."""
pass
| [] |
tkeske/SMS-Fetcher | Classes/ServiceBase.py | 7b3ec0ea4517ad11164b8e2d7ee2c60d2a9f0ed2 | '''
@author Tomáš Keske
@since 10.8.2019
'''
import sys
from jnius import autoclass
from Conf.Conf import *
class ServiceBase():
def __init__(self):
PythonServiceClass = autoclass('org.kivy.android.PythonService')
self.Context = autoclass('android.content.Context')
self.Service = Python... | [((187, 230), 'jnius.autoclass', 'autoclass', (['"""org.kivy.android.PythonService"""'], {}), "('org.kivy.android.PythonService')\n", (196, 230), False, 'from jnius import autoclass\n'), ((254, 290), 'jnius.autoclass', 'autoclass', (['"""android.content.Context"""'], {}), "('android.content.Context')\n", (263, 290), Fa... |
sofia008/api-redis-queue | api/queue/__init__.py | 8d65665c8a9f44990565baa8c7ba43d7f01425d3 | # api/queue/__init__.py
import os
from flask import Flask
from flask_bootstrap import Bootstrap
# instantiate the extensions
bootstrap = Bootstrap()
def create_app(script_info=None):
# instantiate the app
app = Flask(
__name__,
template_folder="../client/templates",
static_folder=... | [((141, 152), 'flask_bootstrap.Bootstrap', 'Bootstrap', ([], {}), '()\n', (150, 152), False, 'from flask_bootstrap import Bootstrap\n'), ((226, 319), 'flask.Flask', 'Flask', (['__name__'], {'template_folder': '"""../client/templates"""', 'static_folder': '"""../client/static"""'}), "(__name__, template_folder='../clien... |
Foxboron/python-adblock | tests/test_engine.py | 50b2ddba9f7b237b38c848c7d4a1637917444924 | import adblock
import pytest
SMALL_FILTER_LIST = """
||wikipedia.org^
||old.reddit.com^
||lobste.rs^
"""
def empty_engine():
return adblock.Engine(adblock.FilterSet())
def test_engine_creation_and_blocking():
filter_set = adblock.FilterSet(debug=True)
filter_set.add_filter_list(SMALL_FILTER_LIST)
e... | [((235, 264), 'adblock.FilterSet', 'adblock.FilterSet', ([], {'debug': '(True)'}), '(debug=True)\n', (252, 264), False, 'import adblock\n'), ((328, 365), 'adblock.Engine', 'adblock.Engine', ([], {'filter_set': 'filter_set'}), '(filter_set=filter_set)\n', (342, 365), False, 'import adblock\n'), ((154, 173), 'adblock.Fil... |
DucPhamTV/Bank | v1/status_updates/urls.py | 4905ec7d63ef4daafe2119bf6b32928d4db2d4f2 | from rest_framework.routers import SimpleRouter
from .views.upgrade_notice import UpgradeNoticeViewSet
router = SimpleRouter(trailing_slash=False)
router.register('upgrade_notice', UpgradeNoticeViewSet, basename='upgrade_notice')
| [((114, 148), 'rest_framework.routers.SimpleRouter', 'SimpleRouter', ([], {'trailing_slash': '(False)'}), '(trailing_slash=False)\n', (126, 148), False, 'from rest_framework.routers import SimpleRouter\n')] |
ruler30cm/python-ds | data_structures/stack/largest_rectangle_area_in_histogram.py | f84605c5b746ea1d46de3d00b86f5fba399445c7 | '''
Largest rectangle area in a histogram::
Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars.
For simplicity, assume that all bars have same width and the width is 1 unit.
'''
def max_area_histogram(histogram):
stack = list()... | [] |
Cwlowe/web2py | gluon/contrib/pbkdf2_ctypes.py | 6ae4c3c274be1026cbc45b0fcd8d1180c74b9070 | # -*- coding: utf-8 -*-
"""
pbkdf2_ctypes
~~~~~~
Fast pbkdf2.
This module implements pbkdf2 for Python using crypto lib from
openssl or commoncrypto.
Note: This module is intended as a plugin replacement of pbkdf2.py
by Armin Ronacher.
Git repository:
$ git clone https://github.c... | [((1325, 1346), 'ctypes.c_char_p', 'ctypes.c_char_p', (['data'], {}), '(data)\n', (1340, 1346), False, 'import ctypes\n'), ((1403, 1424), 'ctypes.c_char_p', 'ctypes.c_char_p', (['salt'], {}), '(salt)\n', (1418, 1424), False, 'import ctypes\n'), ((1481, 1506), 'ctypes.c_uint', 'ctypes.c_uint', (['iterations'], {}), '(it... |
cispa/bitahoy | auth_backend/src/key_op.py | ffc2004930a033cfb94d13671bc6068b473ce226 | import sys
import os
import psycopg2
import base64
from cryptography.hazmat.primitives import serialization, hashes
from cryptography.hazmat.primitives.asymmetric import padding, rsa
from cryptography.hazmat.backends import default_backend
import time
if len(sys.argv) < 2:
print("Please enter either create or rem... | [((343, 354), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (351, 354), False, 'import sys\n'), ((361, 439), 'psycopg2.connect', 'psycopg2.connect', (['"""dbname=\'auth_db\' user=\'auth_db\' host=\'authdb\' [redacted-2]"""'], {}), '("dbname=\'auth_db\' user=\'auth_db\' host=\'authdb\' [redacted-2]")\n', (377, 439), F... |
loongson-zn/build | src/tools/types/obj.py | d4bedebfa046b763c316e31c98b48ed2779741b9 | # Copyright David Abrahams 2004. Distributed under the Boost
# Software License, Version 1.0. (See accompanying
# file LICENSE.txt or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
from b2.build import type
def register ():
type.register_type ('OBJ', ['obj'], None, ['NT', 'CYGWIN'])
type.register_type ('OBJ'... | [((231, 289), 'b2.build.type.register_type', 'type.register_type', (['"""OBJ"""', "['obj']", 'None', "['NT', 'CYGWIN']"], {}), "('OBJ', ['obj'], None, ['NT', 'CYGWIN'])\n", (249, 289), False, 'from b2.build import type\n'), ((295, 327), 'b2.build.type.register_type', 'type.register_type', (['"""OBJ"""', "['o']"], {}), ... |
eriknw/sympy | sympy/polys/tests/test_sqfreetools.py | b7544e2bb74c011f6098a7e886fd77f41776c2c4 | """Tests for square-free decomposition algorithms and related tools. """
from sympy.polys.rings import ring
from sympy.polys.domains import FF, ZZ, QQ
from sympy.polys.polyclasses import DMP
from sympy.polys.specialpolys import f_polys
from sympy.utilities.pytest import raises
f_0, f_1, f_2, f_3, f_4, f_5, f_6 = f_p... | [((317, 326), 'sympy.polys.specialpolys.f_polys', 'f_polys', ([], {}), '()\n', (324, 326), False, 'from sympy.polys.specialpolys import f_polys\n'), ((359, 372), 'sympy.polys.rings.ring', 'ring', (['"""x"""', 'ZZ'], {}), "('x', ZZ)\n", (363, 372), False, 'from sympy.polys.rings import ring\n'), ((1540, 1553), 'sympy.po... |
ofersadan85/ezno_convert | ezno_convert/enums.py | 4c5cf7d41c72698e5486068673f170d968a9de27 | import enum
from typing import Union
@enum.unique
class PPT(enum.Enum):
# Source: https://docs.microsoft.com/en-us/office/vba/api/powerpoint.ppsaveasfiletype
AnimatedGIF = 40
BMP = 19
Default = 11
EMF = 23
External = 64000
GIF = 16
JPG = 17
META = 15
MP4 = 39
OpenPresentati... | [] |
vvuri/flask_pipeline | app/django_first/news/migrations/0002_movies_year.py | d3f283b8a6a6239e56d85e67dbe3edce55bcb980 | # Generated by Django 4.0.1 on 2022-01-19 23:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('news', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='movies',
name='year',
field=mo... | [((318, 359), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(4)', 'null': '(True)'}), '(max_length=4, null=True)\n', (334, 359), False, 'from django.db import migrations, models\n')] |
Jhsmit/awesome-panel-extensions | scripts/issue_param_value.py | 41eba7cf84caa911be4ed0df2a96e16fc1e70263 | import panel as pn
import param
from awesome_panel_extensions.frameworks.fast import FastTemplate, FastTextInput
WIDGETS = {
"some_text": {"type": FastTextInput, "readonly": True, "sizing_mode": "fixed", "width": 400}
}
class ParameterizedApp(param.Parameterized):
some_text = param.String(default="This is s... | [((575, 618), 'awesome_panel_extensions.frameworks.fast.FastTemplate', 'FastTemplate', ([], {'main': '[parameterized_app.view]'}), '(main=[parameterized_app.view])\n', (587, 618), False, 'from awesome_panel_extensions.frameworks.fast import FastTemplate, FastTextInput\n'), ((289, 330), 'param.String', 'param.String', (... |
AisinoPythonTeam/PythonAiniso | gjqyxyxxcxxt/gjqyxyxxcxxt/queue_companies.py | 983a29962752679d8cc26a2c3cdb0ba8fcfa3f02 | # -*- coding: utf-8 -*-
import pymysql
import sys, os, json, time, pymongo
app_dir = os.path.abspath("../")
sys.path.append(app_dir)
from gjqyxyxxcxxt import settings
from gjqyxyxxcxxt.database.my_redis import QueueRedis
conn = None
def connect_db():
global conn
conn = pymysql.connect(host="172.16.16.15",port... | [] |
tkuculo/QuoteKG | model/entity_quotes.py | a7b7d323679624a9cd3805e866028fad0a5a5408 | #main_section > lines > line > text
#main_section > lines > line > sub_line > text
#main_section > sub_sections
#main_section > templates > type
#main_section > templates > empty_values
#main_section > templates > values
#main_section > templates > sub_templates
#main_section > title > line > text
from transformers.mod... | [] |
supsi-dacd-isaac/parity-sidechain-interface | tests/pm/update_sla.py | b64a5fb724955332afb4998344081d1b93ac216a | # Importing section
import json
import requests
import argparse
import hashlib
import time
from http import HTTPStatus
# Main
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser()
args = arg_parser.parse_args()
set_cmd = 'updateSla'
params = {
'idx': 'sla04',
... | [((173, 198), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (196, 198), False, 'import argparse\n'), ((594, 646), 'requests.post', 'requests.post', (['cmd_url'], {'headers': 'headers', 'json': 'params'}), '(cmd_url, headers=headers, json=params)\n', (607, 646), False, 'import requests\n'), ((6... |
jitendragangwar123/cp | array/python3/5_move_all_negative_elements.py | 8d9da1abd841784da8304e7ebb64a6b94cb804bb | def sort(arr):
# Start index 0.
start = 0
# End index
end = len(arr)-1
while start <= end:
# Swap all positive value with last index end & decrease end by 1.
if arr[start] >= 0:
arr[start], arr[end] = arr[end], arr[start]
end -= 1
else:
# ... | [] |
hldai/wikiprocesspy | misc.py | 788ccb6f0e0e54a7322863d5a13332635afc240d | import json
def __text_from_anchor_sents_file(anchor_sents_file, output_file):
f = open(anchor_sents_file, encoding='utf-8')
fout = open(output_file, 'w', encoding='utf-8', newline='\n')
for i, line in enumerate(f):
sent = json.loads(line)
fout.write('{}\n'.format(sent['tokens']))
... | [((245, 261), 'json.loads', 'json.loads', (['line'], {}), '(line)\n', (255, 261), False, 'import json\n')] |
myrtam/CANNR | test/smptest.py | b966a873ec60264b0fd42b81edadb5495237d7ea | """
Test harness for smp.py
"""
import sys
import os
sys.path.append('/Users/ptendick/open-source-workspace/cannr Image/source/cannr/lib')
os.environ['PATH'] = '/Library/Frameworks/Python.framework/Versions/3.7/bin:' + os.environ['PATH']
import cannr
import smp
# Test openProcess by opening a Flask process
def test_o... | [((53, 143), 'sys.path.append', 'sys.path.append', (['"""/Users/ptendick/open-source-workspace/cannr Image/source/cannr/lib"""'], {}), "(\n '/Users/ptendick/open-source-workspace/cannr Image/source/cannr/lib')\n", (68, 143), False, 'import sys\n'), ((351, 504), 'smp.openProcess', 'smp.openProcess', (["{'processInfo'... |
ibrahimSouleiman/GuessWhat | neural_toolbox/inception.py | 60d140de1aae5ccda27e7d3eef2b9fb9548f0854 | import tensorflow as tf
import tensorflow.contrib.slim as slim
import tensorflow.contrib.slim.python.slim.nets.resnet_v1 as resnet_v1
import tensorflow.contrib.slim.python.slim.nets.inception_v1 as inception_v1
import tensorflow.contrib.slim.python.slim.nets.resnet_utils as slim_utils
from tensorflow.contrib import l... | [((1696, 1733), 'tensorflow.contrib.slim.python.slim.nets.inception_v1.inception_v1_arg_scope', 'inception_v1.inception_v1_arg_scope', ([], {}), '()\n', (1731, 1733), True, 'import tensorflow.contrib.slim.python.slim.nets.inception_v1 as inception_v1\n'), ((632, 738), 'tensorflow.contrib.framework.python.ops.arg_scope'... |
Robert-JunWang/pytorch-image-models | timm/utils/checkpoint_saver.py | 7c67d6aca992f039eece0af5f7c29a43d48c00e4 | """ Checkpoint Saver
Track top-n training checkpoints and maintain recovery checkpoints on specified intervals.
Hacked together by / Copyright 2020 Ross Wightman
"""
import glob
import operator
import os
import logging
import torch
from .model import unwrap_model, get_state_dict
_logger = logging.getLogger(__nam... | [((297, 324), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (314, 324), False, 'import logging\n'), ((1811, 1868), 'os.path.join', 'os.path.join', (['self.checkpoint_dir', "('tmp' + self.extension)"], {}), "(self.checkpoint_dir, 'tmp' + self.extension)\n", (1823, 1868), False, 'import os... |
VolgaKurvar/AtCoder | AGC004/AGC004a.py | 21acb489f1594bbb1cdc64fbf8421d876b5b476d | # AGC004a
def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
a, b, c = map(int, input().split())
if a % 2 == 0 or b % 2 == 0 or c % 2 == 0:
print(0)
exit(0)
print(min(a*b, b*c, c*a))
if __name__ == '__main__':
main()
| [((72, 102), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 6)'], {}), '(10 ** 6)\n', (93, 102), False, 'import sys\n')] |
arvindn05/glance | glance/tests/functional/test_api.py | 055d15a6ba5d132f649156eac0fc91f4cd2813e4 | # Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | [((3116, 3131), 'httplib2.Http', 'httplib2.Http', ([], {}), '()\n', (3129, 3131), False, 'import httplib2\n'), ((3773, 3788), 'httplib2.Http', 'httplib2.Http', ([], {}), '()\n', (3786, 3788), False, 'import httplib2\n'), ((4430, 4445), 'httplib2.Http', 'httplib2.Http', ([], {}), '()\n', (4443, 4445), False, 'import htt... |
corey-sobel/qcore | qcore/asserts.py | 719a44617789e3cc384ce860031d9479ee0877e4 | # Copyright 2016 Quora, 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 writing, so... | [((11990, 12017), 'traceback.format_tb', 'traceback.format_tb', (['exc_tb'], {}), '(exc_tb)\n', (12009, 12017), False, 'import traceback\n')] |
rikeshi/galaxy | lib/galaxy/web/__init__.py | c536a877e4a9b3d12aa0d00fd4d5e705109a0d0a | """
The Galaxy web application framework
"""
from .framework import url_for
from .framework.base import httpexceptions
from .framework.decorators import (
do_not_cache,
error,
expose,
expose_api,
expose_api_anonymous,
expose_api_anonymous_and_sessionless,
expose_api_raw,
expose_api_raw_... | [] |
yoav-orca/pants | src/python/pants/core/goals/check_test.py | 995448e9add343975844c7a43d5d64618fc4e4d9 | # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from abc import ABCMeta, abstractmethod
from pathlib import Path
from textwrap import dedent
from typing import ClassVar, Iterable, List, Optional, Tuple, Type
from pants.core.goals.check... | [((3133, 3179), 'pants.engine.unions.UnionMembership', 'UnionMembership', (['{CheckRequest: request_types}'], {}), '({CheckRequest: request_types})\n', (3148, 3179), False, 'from pants.engine.unions import UnionMembership\n'), ((4280, 4311), 'pants.engine.addresses.Address', 'Address', (['""""""'], {'target_name': '"""... |
alexkreidler/scholarphi | data-processing/entities/definitions/model/utils.py | 86d26d0bfa5ded00760fba1a9c6891a94a3dd6d2 | import os
import random
from typing import Any, Dict, List, Union
import numpy as np
import torch
from colorama import Fore, Style
from sklearn.metrics import f1_score
from sklearn.metrics import precision_recall_fscore_support as score
from sklearn.metrics import precision_score, recall_score
def highlight(input_: ... | [((1110, 1127), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1121, 1127), False, 'import random\n'), ((1132, 1152), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1146, 1152), True, 'import numpy as np\n'), ((1157, 1180), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(see... |
nvhoang55/python-fire | fire/trace.py | b78287f6d68208732ca4d91e57f4678e6c4747c7 | # Copyright (C) 2018 Google 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 writing, ... | [((6291, 6307), 'pipes.quote', 'pipes.quote', (['arg'], {}), '(arg)\n', (6302, 6307), False, 'import pipes\n'), ((8950, 8988), 'fire.inspectutils.GetFullArgSpec', 'inspectutils.GetFullArgSpec', (['component'], {}), '(component)\n', (8977, 8988), False, 'from fire import inspectutils\n'), ((6257, 6275), 'pipes.quote', '... |
thiagodasilva/swift | test/unit/__init__.py | 0553d9333ed0045c4d209065b315533a33e5d7d7 | # Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | [((11932, 11947), 'eventlet.green.socket.socket', 'socket.socket', ([], {}), '()\n', (11945, 11947), False, 'from eventlet.green import socket\n'), ((12991, 13000), 'tempfile.mkdtemp', 'mkdtemp', ([], {}), '()\n', (12998, 13000), False, 'from tempfile import mkdtemp\n'), ((13530, 13548), 'functools.wraps', 'functools.w... |
samsontmr/fairseq | fairseq/models/bart/model.py | 1d50b6dcd961faaa74ee32e9d7a02ff76f16ab87 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
BART: Denoising Sequence-to-Sequence Pre-training for
Natural Language Generation, Translation, and Comprehension
"""
import torch.nn as n... | [((611, 633), 'fairseq.models.register_model', 'register_model', (['"""bart"""'], {}), "('bart')\n", (625, 633), False, 'from fairseq.models import register_model, register_model_architecture\n'), ((7771, 7820), 'fairseq.models.register_model_architecture', 'register_model_architecture', (['"""bart"""', '"""bart_large"... |
gpierre42/optraj | vagrant/optraj.istic.univ-rennes1.fr/src/system/Assignment.py | 53beb81c669093b866a786f2c1df9c663bbd7224 | # coding=utf8
'''
Created on 29 Oct 2013
@author: Nicolas Poirey
'''
from Worker import Worker
from Phase import Phase
class Assignment(object):
'''
Classe Assignment définissant une affectation
attributs publics :
- num : l'id de l'affectation (int)
- worker : l'ouvrier de l'affectation (Wor... | [((433, 441), 'Worker.Worker', 'Worker', ([], {}), '()\n', (439, 441), False, 'from Worker import Worker\n'), ((449, 456), 'Phase.Phase', 'Phase', ([], {}), '()\n', (454, 456), False, 'from Phase import Phase\n')] |
cmm1107/arch-security-tracker | tracker/view/error.py | 7d5f7d69f2b02c056c3888a9b70132c29432a468 | from binascii import hexlify
from functools import wraps
from logging import error
from os import urandom
from random import randint
from flask import make_response
from flask import render_template
from werkzeug.exceptions import BadRequest
from werkzeug.exceptions import Forbidden
from werkzeug.exceptions import Gon... | [((2018, 2034), 'config.get_debug_flag', 'get_debug_flag', ([], {}), '()\n', (2032, 2034), False, 'from config import get_debug_flag\n'), ((747, 758), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (752, 758), False, 'from functools import wraps\n'), ((2071, 2081), 'os.urandom', 'urandom', (['(4)'], {}), '(4)\... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.