repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
29rj/Fusion | FusionIIIT/applications/placement_cell/api/serializers.py | bc2941a67532e183adeb0bc4042df0b182b9e3aa | from rest_framework.authtoken.models import Token
from rest_framework import serializers
from applications.placement_cell.models import (Achievement, Course, Education,
Experience, Has, Patent,
Project, Publication, Skill,
... | [((801, 837), 'applications.placement_cell.models.Skill.objects.get_or_create', 'Skill.objects.get_or_create', ([], {}), '(**skill)\n', (828, 837), False, 'from applications.placement_cell.models import Achievement, Course, Education, Experience, Has, Patent, Project, Publication, Skill, PlacementStatus, NotifyStudent\... |
thinkAmi-sandbox/django-datatables-view-sample | concat_col_app/factories.py | ac3df721089489e61c09ac75d320be3704c72105 | import factory
from concat_col_app.models import Color, Apple
class ColorFactory(factory.django.DjangoModelFactory):
class Meta:
model = Color
class AppleFactory(factory.django.DjangoModelFactory):
class Meta:
model = Apple
| [] |
HansolChoe/defects4cpp | defects4cpp/errors/argparser.py | cb9e3db239c50e6ec38127cec117865f0ee7a5cf | from pathlib import Path
from typing import Dict
from errors.common.exception import DppError
class DppArgparseError(DppError):
pass
class DppArgparseTaxonomyNotFoundError(DppArgparseError):
def __init__(self, taxonomy_name: str):
super().__init__(f"taxonomy '{taxonomy_name}' does not exist")
... | [] |
wang97zh/EVS-Net-1 | utils/__init__.py | 3a8457c2d5281b8805ec523f9ced738ccf49d5f5 |
from .utility import *
from .tricks import *
from .tensorlog import *
from .self_op import *
from .resume import *
from .optims import *
from .metric import *
| [] |
calvinfeng/openvino | model-optimizer/extensions/front/mxnet/arange_ext.py | 11f591c16852637506b1b40d083b450e56d0c8ac | """
Copyright (C) 2018-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | [((935, 974), 'mo.front.mxnet.extractors.utils.get_mxnet_layer_attrs', 'get_mxnet_layer_attrs', (['node.symbol_dict'], {}), '(node.symbol_dict)\n', (956, 974), False, 'from mo.front.mxnet.extractors.utils import get_mxnet_layer_attrs\n')] |
lucasforever24/arcface_noonan | fold_cur_trans.py | 9d805a0d4d478e347a9084ad6ce24fe4c8dc5e65 | import cv2
from PIL import Image
import argparse
from pathlib import Path
from multiprocessing import Process, Pipe,Value,Array
import torch
from config import get_config
from mtcnn import MTCNN
from Learner_trans_tf import face_learner
from utils import load_facebank, draw_box_name, prepare_facebank, save_label_score,... | [((651, 711), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""for face verification"""'}), "(description='for face verification')\n", (674, 711), False, 'import argparse\n'), ((2874, 2896), 'config.get_config', 'get_config', (['(True)', 'args'], {}), '(True, args)\n', (2884, 2896), False,... |
manahter/dirio | examples/tryclass.py | c33fcd6c114ffb275d7147156c7041389fab6cfc | import time
class TryClass:
value = 1
valu = 2
val = 3
va = 4
v = 5
def __init__(self, value=4):
print("Created TryClass :", self)
self.value = value
def metod1(self, value, val2=""):
self.value += value
print(f"\t>>> metod 1, add: {value}, now value : {se... | [((1114, 1174), 'dirio.Dirio', 'Dirio', ([], {'target': 'TryClass', 'args': '(888,)', 'kwargs': '{}', 'worker': '(False)'}), '(target=TryClass, args=(888,), kwargs={}, worker=False)\n', (1119, 1174), False, 'from dirio import Dirio\n'), ((354, 367), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (364, 367), False,... |
ismaila-at-za-ibm/qiskit-terra | qiskit/providers/basebackend.py | 08303ec98ac7b33fde55266dc3a74466fbdcae95 | # -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""This module implements the abstract base class for backend modules.
To create add-on backend modules subclass the Backend... | [] |
shahbagdadi/py-algo-n-ds | arrays/jump2/Solution.py | ff689534b771ddb4869b001b20a0e21b4896bb0a | from typing import List
import sys
class Solution:
def jump(self, nums: List[int]) -> int:
if len(nums) <=1: return 0
l , r , jumps = 0, nums[0] , 1
while r < len(nums)-1 :
jumps += 1
# you can land anywhere between l & r+1 in a jump and then use Num[i] to jump from ... | [] |
shared-tw/shared-tw | share/tests.py | 90dcf92744b4e0ec9e9aa085026b5543c9c3922c | import unittest
from . import states
class DonationStateTestCase(unittest.TestCase):
def test_approve_pending_state(self):
approve_pending_statue = states.PendingApprovalState()
approved_event = states.DonationApprovedEvent()
self.assertIsInstance(
approve_pending_statue.appl... | [] |
grow/airpress | app/extensions.py | b46e951b27b8216f51f0fade3695049455866825 | from jinja2 import nodes
from jinja2.ext import Extension
class FragmentCacheExtension(Extension):
# a set of names that trigger the extension.
tags = set(['cache'])
def __init__(self, environment):
super(FragmentCacheExtension, self).__init__(environment)
# add the defaults to the envir... | [((1151, 1168), 'jinja2.nodes.Const', 'nodes.Const', (['None'], {}), '(None)\n', (1162, 1168), False, 'from jinja2 import nodes\n')] |
danielSoler93/modtox | modtox/Helpers/helpers.py | 757234140cc780f57d031b46d9293fc2bf95d18d | import os
def retrieve_molecule_number(pdb, resname):
"""
IDENTIFICATION OF MOLECULE NUMBER BASED
ON THE TER'S
"""
count = 0
with open(pdb, 'r') as x:
lines = x.readlines()
for i in lines:
if i.split()[0] == 'TER': count += 1
if i.split()[3] == resname: ... | [((562, 589), 'os.path.expanduser', 'os.path.expanduser', (['newPath'], {}), '(newPath)\n', (580, 589), False, 'import os\n'), ((641, 652), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (650, 652), False, 'import os\n'), ((661, 683), 'os.chdir', 'os.chdir', (['self.newPath'], {}), '(self.newPath)\n', (669, 683), False, '... |
efargas/PyBBIO | bbio/platform/beaglebone/api.py | b0b15fc52befd56e817dbc5876f738e70ef05541 | # api.py
# Part of PyBBIO
# github.com/alexanderhiam/PyBBIO
# MIT License
#
# Beaglebone platform API file.
from bbio.platform.platform import detect_platform
PLATFORM = detect_platform()
if "3.8" in PLATFORM:
from bone_3_8.adc import analog_init, analog_cleanup
from bone_3_8.pwm import pwm_init, pwm_cleanup
... | [((175, 192), 'bbio.platform.platform.detect_platform', 'detect_platform', ([], {}), '()\n', (190, 192), False, 'from bbio.platform.platform import detect_platform\n'), ((559, 572), 'bone_3_2.adc.analog_init', 'analog_init', ([], {}), '()\n', (570, 572), False, 'from bone_3_2.adc import analog_init, analog_cleanup\n'),... |
GnarLito/tryhackme.py | tryhackme/http.py | 20b4dd6a15c13c57e7a7be7f59913b937a992e4b | import re
import sys
from urllib.parse import quote as _uriquote
import requests
from . import __version__, errors, utils
from .converters import _county_types, _leaderboard_types, _vpn_types, _not_none
from . import checks
from .cog import request_cog
GET='get'
POST='post'
class HTTPClient:
__CSRF_token_regex... | [((323, 388), 're.compile', 're.compile', (['"""const csrfToken[ ]{0,1}=[ ]{0,1}["|\'](.{36})["|\']"""'], {}), '(\'const csrfToken[ ]{0,1}=[ ]{0,1}["|\\\'](.{36})["|\\\']\')\n', (333, 388), False, 'import re\n'), ((414, 480), 're.compile', 're.compile', (['"""const username[ ]{0,1}=[ ]{0,1}["|\'](.{1,16})["|\']"""'], {... |
wullli/flatlander | flatlander/runner/experiment_runner.py | 2c7fbd3d025f2a05c40895ec735a92d7a6bfb1ad | import os
from argparse import ArgumentParser
from pathlib import Path
import gym
import ray
import ray.tune.result as ray_results
import yaml
from gym.spaces import Tuple
from ray.cluster_utils import Cluster
from ray.rllib.utils import try_import_tf, try_import_torch
from ray.tune import run_experiments, register_en... | [((1015, 1026), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1024, 1026), False, 'import os\n'), ((1194, 1209), 'ray.rllib.utils.try_import_tf', 'try_import_tf', ([], {}), '()\n', (1207, 1209), False, 'from ray.rllib.utils import try_import_tf, try_import_torch\n'), ((1234, 1252), 'ray.rllib.utils.try_import_torch', 't... |
rahulmah/sample-cloud-native-toolchain-tutorial-20170720084529291 | syslib/utils_keywords.py | 08540c0f083a25b5b4e7a4c839080fe54383038c | #!/usr/bin/env python
r"""
This module contains keyword functions to supplement robot's built in
functions and use in test where generic robot keywords don't support.
"""
import time
from robot.libraries.BuiltIn import BuiltIn
from robot.libraries import DateTime
import re
###########################################... | [((913, 941), 'robot.libraries.DateTime.convert_time', 'DateTime.convert_time', (['retry'], {}), '(retry)\n', (934, 941), False, 'from robot.libraries import DateTime\n'), ((1056, 1093), 'robot.libraries.DateTime.convert_time', 'DateTime.convert_time', (['retry_interval'], {}), '(retry_interval)\n', (1077, 1093), False... |
ivmtorres/mmpose | tools/webcam/webcam_apis/nodes/__init__.py | 662cb50c639653ae2fc19d3421ce10bd02246b85 | # Copyright (c) OpenMMLab. All rights reserved.
from .builder import NODES
from .faceswap_nodes import FaceSwapNode
from .frame_effect_nodes import (BackgroundNode, BugEyeNode, MoustacheNode,
NoticeBoardNode, PoseVisualizerNode,
SaiyanNode, SunglassesNod... | [] |
lelle1234/Db2Utils | DBParser/DBMove.py | 55570a1afbe6d4abe61c31952bc178c2443f4e5b | #!/usr/bin/python3
import ibm_db
import getopt
import sys
import os
from toposort import toposort_flatten
db = None
host = "localhost"
port = "50000"
user = None
pwd = None
outfile = None
targetdb = None
try:
opts, args = getopt.getopt(sys.argv[1:], "h:d:P:u:p:o:t:")
except getopt.GetoptError:
sys.exit(-1)
f... | [((810, 916), 'ibm_db.connect', 'ibm_db.connect', (["('DATABASE=%s; HOSTNAME=%s; PORT=%s; PROTOCOL=TCPIP; UID=%s; PWD=%s' % cfg)", '""""""', '""""""'], {}), "(\n 'DATABASE=%s; HOSTNAME=%s; PORT=%s; PROTOCOL=TCPIP; UID=%s; PWD=%s' %\n cfg, '', '')\n", (824, 916), False, 'import ibm_db\n'), ((1493, 1526), 'ibm_db.p... |
MirunaPislar/Word2vec | utils/glove.py | e9dd01488f081a7b8d7c00a0b21efe0d401d4927 | import numpy as np
DEFAULT_FILE_PATH = "utils/datasets/glove.6B.50d.txt"
def loadWordVectors(tokens, filepath=DEFAULT_FILE_PATH, dimensions=50):
"""Read pretrained GloVe vectors"""
wordVectors = np.zeros((len(tokens), dimensions))
with open(filepath) as ifs:
for line in ifs:
line = lin... | [((692, 708), 'numpy.asarray', 'np.asarray', (['data'], {}), '(data)\n', (702, 708), True, 'import numpy as np\n')] |
stanford-crfm/composer | composer/profiler/__init__.py | 4996fbd818971afd6439961df58b531d9b47a37b | # Copyright 2021 MosaicML. All Rights Reserved.
"""Performance profiling tools.
The profiler gathers performance metrics during a training run that can be used to diagnose bottlenecks and
facilitate model development.
The metrics gathered include:
* Duration of each :class:`.Event` during training
* Time taken by t... | [] |
EvKissle/tinkerpop | gremlin-python/src/main/jython/setup.py | 84195e38fc22a1a089c345fade9c75711e6cfdfe | '''
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 ... | [((966, 1020), 'os.path.join', 'os.path.join', (['root', '"""gremlin_python"""', '"""__version__.py"""'], {}), "(root, 'gremlin_python', '__version__.py')\n", (978, 1020), False, 'import os\n'), ((894, 919), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (909, 919), False, 'import os\n'), ((1... |
yoshihikosuzuki/plotly_light | src/_bar.py | cef2465486e9147e27feae1193a1b4487e4fc543 | from typing import Optional, Sequence
import plotly.graph_objects as go
def bar(x: Sequence,
y: Sequence,
text: Optional[Sequence] = None,
width: Optional[int] = None,
col: Optional[str] = None,
opacity: float = 1,
name: Optional[str] = None,
show_legend: bool = ... | [((812, 975), 'plotly.graph_objects.Bar', 'go.Bar', ([], {'x': 'x', 'y': 'y', 'text': 'text', 'width': 'width', 'marker_color': 'col', 'opacity': 'opacity', 'name': 'name', 'showlegend': 'show_legend', 'visible': "(None if show_init else 'legendonly')"}), "(x=x, y=y, text=text, width=width, marker_color=col, opacity=op... |
doomhammerhell/pennylane | pennylane/templates/subroutines/arbitrary_unitary.py | f147f22d8d99ba5891edd45a6a1f7dd679c8a23c | # Copyright 2018-2021 Xanadu Quantum Technologies 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... | [((3234, 3257), 'pennylane.math.shape', 'qml.math.shape', (['weights'], {}), '(weights)\n', (3248, 3257), True, 'import pennylane as qml\n'), ((3585, 3607), 'pennylane.tape.QuantumTape', 'qml.tape.QuantumTape', ([], {}), '()\n', (3605, 3607), True, 'import pennylane as qml\n'), ((3726, 3776), 'pennylane.ops.PauliRot', ... |
aidiary/generative-models-pytorch | vae_celeba.py | c9ae23a4ecbe4bf8f82dbaf9e4e3e1e61530e6b0 | import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from pytorch_lightning.loggers import TensorBoardLogger
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.datasets import CelebA
class Encoder(nn.Modu... | [((4394, 4465), 'torchvision.datasets.CelebA', 'CelebA', ([], {'root': '"""data"""', 'split': '"""train"""', 'transform': 'transform', 'download': '(False)'}), "(root='data', split='train', transform=transform, download=False)\n", (4400, 4465), False, 'from torchvision.datasets import CelebA\n'), ((4484, 4554), 'torchv... |
julat/DisasterResponse | data/process_data.py | 140489e521a96dc2ff9c9a95f0ce4e99403f03af | # Import libraries
import sys
import pandas as pd
from sqlalchemy import create_engine
def load_data(messages_filepath, categories_filepath):
"""
Load the data from the disaster response csvs
Parameters:
messages_filepath (str): Path to messages csv
categories_filepath (str): Path to categories csv... | [((388, 418), 'pandas.read_csv', 'pd.read_csv', (['messages_filepath'], {}), '(messages_filepath)\n', (399, 418), True, 'import pandas as pd\n'), ((436, 468), 'pandas.read_csv', 'pd.read_csv', (['categories_filepath'], {}), '(categories_filepath)\n', (447, 468), True, 'import pandas as pd\n'), ((478, 517), 'pandas.merg... |
atsgen/tf-charms | contrail-controller/files/plugins/check_contrail_status_controller.py | 81110aef700b2f227654d52709614ddb3d62ba17 | #!/usr/bin/env python3
import subprocess
import sys
import json
SERVICES = {
'control': [
'control',
'nodemgr',
'named',
'dns',
],
'config-database': [
'nodemgr',
'zookeeper',
'rabbitmq',
'cassandra',
],
'webui': [
'web',
... | [((3148, 3158), 'sys.exit', 'sys.exit', ([], {}), '()\n', (3156, 3158), False, 'import sys\n'), ((972, 990), 'sys.exit', 'sys.exit', (['CRITICAL'], {}), '(CRITICAL)\n', (980, 990), False, 'import sys\n'), ((2025, 2043), 'sys.exit', 'sys.exit', (['CRITICAL'], {}), '(CRITICAL)\n', (2033, 2043), False, 'import sys\n'), ((... |
harnitsignalfx/skogaming | leaderboard-server/leaderboard-server.py | c860219c89149d686106dfb7a93d27df39830842 | from flask import Flask, jsonify, request
from flask_cors import CORS, cross_origin
import simplejson as json
from leaderboard.leaderboard import Leaderboard
import uwsgidecorators
import signalfx
app = Flask(__name__)
app.config['CORS_HEADERS'] = 'Content-Type'
cors = CORS(app)
highscore_lb_starship = Leaderboard('... | [((205, 220), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (210, 220), False, 'from flask import Flask, jsonify, request\n'), ((272, 281), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (276, 281), False, 'from flask_cors import CORS, cross_origin\n'), ((307, 364), 'leaderboard.leaderboard.Leaderbo... |
jorgensd/meshio | meshio/_cli/_info.py | 0600ac9e9e8d1e1a27d5f3f2f4235414f4482cac | import argparse
import numpy as np
from .._helpers import read, reader_map
from ._helpers import _get_version_text
def info(argv=None):
# Parse command line arguments.
parser = _get_info_parser()
args = parser.parse_args(argv)
# read mesh data
mesh = read(args.infile, file_format=args.input_for... | [((1006, 1113), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Print mesh info."""', 'formatter_class': 'argparse.RawTextHelpFormatter'}), "(description='Print mesh info.', formatter_class=\n argparse.RawTextHelpFormatter)\n", (1029, 1113), False, 'import argparse\n'), ((469, 510), 'n... |
Data-Linkage/ccslink | ccslink/Zip.py | ee1105888d43c6a2b307deb96ddede34d03a965f | import os, shutil
from CCSLink import Spark_Session as SS
def add_zipped_dependency(zip_from, zip_target):
"""
This method creates a zip of the code to be sent to the executors.
It essentially zips the Python packages installed by PIP and
submits them via addPyFile in the current PySpark context
E... | [((687, 724), 'os.path.exists', 'os.path.exists', (["(zipped_fpath + '.zip')"], {}), "(zipped_fpath + '.zip')\n", (701, 724), False, 'import os, shutil\n'), ((771, 872), 'shutil.make_archive', 'shutil.make_archive', ([], {'base_name': 'zipped_fpath', 'format': '"""zip"""', 'root_dir': 'zip_from', 'base_dir': 'zip_targe... |
Mopolino8/moltemplate | moltemplate/nbody_Angles.py | 363df364fcb012e8e4beb7bc616a77d696b8b707 | try:
from .nbody_graph_search import Ugraph
except (SystemError, ValueError):
# not installed as a package
from nbody_graph_search import Ugraph
# This file defines how 3-body angle interactions are generated by moltemplate
# by default. It can be overridden by supplying your own custom file.
# To fi... | [((530, 554), 'nbody_graph_search.Ugraph', 'Ugraph', (['[(0, 1), (1, 2)]'], {}), '([(0, 1), (1, 2)])\n', (536, 554), False, 'from nbody_graph_search import Ugraph\n')] |
DougRogers-DigitalFish/USD | extras/usd/examples/usdMakeFileVariantModelAsset/usdMakeFileVariantModelAsset.py | d8a405a1344480f859f025c4f97085143efacb53 | #!/pxrpythonsubst
#
# Copyright 2016 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... | [((3531, 3585), 'pxr.Sdf.Layer.CreateNew', 'Sdf.Layer.CreateNew', (['fileName'], {'args': "{'format': 'usda'}"}), "(fileName, args={'format': 'usda'})\n", (3550, 3585), False, 'from pxr import Tf, Kind, Sdf, Usd\n'), ((3599, 3624), 'pxr.Usd.Stage.Open', 'Usd.Stage.Open', (['rootLayer'], {}), '(rootLayer)\n', (3613, 362... |
fbdp1202/pyukf_kinect_body_tracking | src/main.py | c44477149cfc22abfe9121c2604dc284c93fbd42 | import sys
import os
sys.path.append('./code/')
from skeleton import Skeleton
from read_data import *
from calibration import Calibration
from ukf_filter import ukf_Filter_Controler
from canvas import Canvas
from regression import *
import time
from functools import wraps
import os
def check_time(function):
@wraps... | [((21, 47), 'sys.path.append', 'sys.path.append', (['"""./code/"""'], {}), "('./code/')\n", (36, 47), False, 'import sys\n'), ((315, 330), 'functools.wraps', 'wraps', (['function'], {}), '(function)\n', (320, 330), False, 'from functools import wraps\n'), ((610, 625), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n... |
Mario-Kart-Felix/cfgov-refresh | cfgov/scripts/initial_data.py | 7978fedeb7aaf4d96a87720e6545567085e056a9 | from __future__ import print_function
import json
import os
from django.conf import settings
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import User
from wagtail.wagtailcore.models import Page, Site
from v1.models import HomePage, BrowseFilterablePage
def run():
print(... | [((446, 483), 'django.contrib.auth.models.User.objects.filter', 'User.objects.filter', ([], {'username': '"""admin"""'}), "(username='admin')\n", (465, 483), False, 'from django.contrib.auth.models import User\n'), ((843, 881), 'v1.models.HomePage.objects.filter', 'HomePage.objects.filter', ([], {'title': '"""CFGOV"""'... |
harmim/vut-avs-project1 | Scripts/compareOutputs.py | d36e6b5cdebce748d2bdf2afc43950968ecf0a91 | # Simple python3 script to compare output with a reference output.
# Usage: python3 compareOutputs.py testOutput.h5 testRefOutput.h5
import sys
import h5py
import numpy as np
if len(sys.argv) != 3:
print("Expected two arguments. Output and reference output file.")
sys.exit(1)
filename = sys.argv[1]
ref_filen... | [((343, 367), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (352, 367), False, 'import h5py\n'), ((376, 404), 'h5py.File', 'h5py.File', (['ref_filename', '"""r"""'], {}), "(ref_filename, 'r')\n", (385, 404), False, 'import h5py\n'), ((412, 438), 'numpy.array', 'np.array', (["f['output_da... |
20CM/Sanctuary | sanctuary/tag/serializers.py | 14694d9bd6376bdc05248741a91df778400e9f66 | # -*- coding: utf-8 -*-
from rest_framework import serializers
from .models import Tag
class TagSerializer(serializers.ModelSerializer):
class Meta:
model = Tag
read_only_fields = ('topics_count',)
| [] |
cloudamqp/amqpstorm | examples/management_api/aliveness_test.py | 35eb8edc5f0c2ea3839e93940bf9d0e5f8f4242e | from amqpstorm.management import ApiConnectionError
from amqpstorm.management import ApiError
from amqpstorm.management import ManagementApi
if __name__ == '__main__':
API = ManagementApi('http://127.0.0.1:15672', 'guest', 'guest')
try:
result = API.aliveness_test('/')
if result['status'] == 'o... | [((179, 236), 'amqpstorm.management.ManagementApi', 'ManagementApi', (['"""http://127.0.0.1:15672"""', '"""guest"""', '"""guest"""'], {}), "('http://127.0.0.1:15672', 'guest', 'guest')\n", (192, 236), False, 'from amqpstorm.management import ManagementApi\n')] |
vishalbelsare/zvt | src/zvt/recorders/em/meta/em_stockhk_meta_recorder.py | d55051147274c0a4157f08ec60908c781a323c8f | # -*- coding: utf-8 -*-
from zvt.contract.api import df_to_db
from zvt.contract.recorder import Recorder
from zvt.domain.meta.stockhk_meta import Stockhk
from zvt.recorders.em import em_api
class EMStockhkRecorder(Recorder):
provider = "em"
data_schema = Stockhk
def run(self):
df_south = em_api.... | [((313, 375), 'zvt.recorders.em.em_api.get_tradable_list', 'em_api.get_tradable_list', ([], {'entity_type': '"""stockhk"""', 'hk_south': '(True)'}), "(entity_type='stockhk', hk_south=True)\n", (337, 375), False, 'from zvt.recorders.em import em_api\n'), ((481, 528), 'zvt.recorders.em.em_api.get_tradable_list', 'em_api.... |
yanwunhao/auto-mshts | src/main.py | 7a4b690bbb6ae55e2f6fad77d176c2c0822db7a0 | from util.io import read_setting_json, read_0h_data, read_24h_data, draw_single_curve
from util.convert import split_array_into_samples, calculate_avg_of_sample, convert_to_percentage
from util.calculus import calculate_summary_of_sample, fit_sigmoid_curve
import matplotlib.pyplot as plt
import numpy as np
import csv
... | [((331, 350), 'util.io.read_setting_json', 'read_setting_json', ([], {}), '()\n', (348, 350), False, 'from util.io import read_setting_json, read_0h_data, read_24h_data, draw_single_curve\n'), ((1324, 1338), 'util.io.read_0h_data', 'read_0h_data', ([], {}), '()\n', (1336, 1338), False, 'from util.io import read_setting... |
twonds/twisted | twisted/names/root.py | d6e270a465d371c3bed01bf369af497b77eb9f1e | # -*- test-case-name: twisted.names.test.test_rootresolve -*-
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Resolver implementation for querying successive authoritative servers to
lookup a record, starting from the root nameservers.
@author: Jp Calderone
todo::
robustify ... | [((5022, 5064), 'twisted.internet.defer.deferredGenerator', 'defer.deferredGenerator', (['discoverAuthority'], {}), '(discoverAuthority)\n', (5045, 5064), False, 'from twisted.internet import defer\n'), ((6374, 6395), 'twisted.internet.defer.DeferredList', 'defer.DeferredList', (['L'], {}), '(L)\n', (6392, 6395), False... |
edwardyehuang/iDS | tools/apply_colormap_dir.py | 36bde3a9e887eb7e1a8d88956cf041909ee84da4 | # ================================================================
# MIT License
# Copyright (c) 2021 edwardyehuang (https://github.com/edwardyehuang)
# ================================================================
import os, sys
rootpath = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pard... | [((326, 354), 'sys.path.insert', 'sys.path.insert', (['(1)', 'rootpath'], {}), '(1, rootpath)\n', (341, 354), False, 'import os, sys\n'), ((634, 690), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""input_dir"""', 'None', '"""input dir path"""'], {}), "('input_dir', None, 'input dir path')\n", (653, 690), Fals... |
rit1200/kairon | kairon/shared/sso/base.py | 674a491f6deeae4800825ca93e0726e4fb6e0866 | class BaseSSO:
async def get_redirect_url(self):
"""Returns redirect url for facebook."""
raise NotImplementedError("Provider not implemented")
async def verify(self, request):
"""
Fetches user details using code received in the request.
:param request: starlette req... | [] |
bal6765/ed-scout | EDScoutCore/JournalInterface.py | 0c2ee6141a5cd86a660c2319d7c4be61614b13fb | from inspect import signature
import json
import time
import os
import glob
import logging
from pathlib import Path
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver
from watchdog.events import PatternMatchingEventHandler
from EDScoutCore.FileSystemUpdatePrompter... | [((517, 554), 'logging.getLogger', 'logging.getLogger', (['"""JournalInterface"""'], {}), "('JournalInterface')\n", (534, 554), False, 'import logging\n'), ((396, 407), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (405, 407), False, 'from pathlib import Path\n'), ((1145, 1190), 'EDScoutCore.FileSystemUpdatePromp... |
xR86/ml-stuff | labs-python/lab9/add_files.py | 2a1b79408897171b78032ff2531ab6f8b18be6c4 | import sqlite3
conn = sqlite3.connect('example.db')
c = conn.cursor()
import os
import hashlib
import time
def get_file_md5(filePath):
h = hashlib.md5()
h.update(open(filePath,"rb").read())
return h.hexdigest()
def get_file_sha256(filePath):
h = hashlib.sha256()
h.update(open(filePath,"rb").read())
return h.... | [((22, 51), 'sqlite3.connect', 'sqlite3.connect', (['"""example.db"""'], {}), "('example.db')\n", (37, 51), False, 'import sqlite3\n'), ((144, 157), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (155, 157), False, 'import hashlib\n'), ((255, 271), 'hashlib.sha256', 'hashlib.sha256', ([], {}), '()\n', (269, 271), Fals... |
blankenberg/galaxy-data-resource | lib/galaxy/model/migrate/versions/0073_add_ldda_to_implicit_conversion_table.py | ca32a1aafd64948f489a4e5cf88096f32391b1d9 | """
Migration script to add 'ldda_parent_id' column to the implicitly_converted_dataset_association table.
"""
from sqlalchemy import *
from sqlalchemy.orm import *
from migrate import *
from migrate.changeset import *
import logging
log = logging.getLogger( __name__ )
metadata = MetaData()
def upgrade(migrate_engi... | [] |
tzuliu/Contrastive-Multiple-Correspondence-Analysis-cMCA | Replication Python and R Codes/Figure_6/cMCA_ESS2018_LABCON_org.py | a59a5c36dd5d4ac04205627827e792322742462d | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import prince
from sklearn import utils
from sklearn.cluster import DBSCAN
import itertools
from cmca import CMCA
from ccmca import CCMCA
from matplotlib import rc
plt.style.use('ggplot')
df = pd.read_csv("./uk2018.csv")
df["prtclcgb"].replace({5: ... | [((235, 258), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (248, 258), True, 'import matplotlib.pyplot as plt\n'), ((265, 292), 'pandas.read_csv', 'pd.read_csv', (['"""./uk2018.csv"""'], {}), "('./uk2018.csv')\n", (276, 292), True, 'import pandas as pd\n'), ((2635, 2695), 'pan... |
ruppysuppy/Daily-Coding-Problem-Solutions | Solutions/077.py | 37d061215a9af2ce39c51f8816c83039914c0d0b | """
Problem:
Given a list of possibly overlapping intervals, return a new list of intervals where
all overlapping intervals have been merged.
The input list is not necessarily ordered in any way.
For example, given [(1, 3), (5, 8), (4, 10), (20, 25)], you should return
[(1, 3), (4, 10), (20, 25)].
"""
from typing i... | [] |
wray/wems | slackbot_wems/chris/slacklib.py | 69caedfb8906f04175196d610a1ca516db01f72a | import time
import emoji
# Put your commands here
COMMAND1 = "testing testing"
COMMAND2 = "roger roger"
BLUEON = str("blue on")
BLUEOFF = str("blue off")
REDON = str("red on")
REDOFF = str("red off")
GREENON = str("green on")
GREENOFF = str("green off")
YELLOWON = str("yellow on")
YELLOWOFF = str("yellow off")
CL... | [((584, 606), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (596, 606), True, 'import RPi.GPIO as GPIO\n'), ((611, 634), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(False)\n', (627, 634), True, 'import RPi.GPIO as GPIO\n'), ((656, 680), 'RPi.GPIO.setup', 'GPIO.setup', (['(... |
iScrE4m/RSES | rses/__init__.py | 88299f105ded8838243eab8b25ab1626c97d1179 | # coding=utf-8
"""RSES :)"""
| [] |
adewaleo/azure-sdk-for-python | sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_gremlin_resources_operations.py | 169457edbea5e3c5557246cfcf8bd635d528bae4 | # 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 may ... | [((1181, 1193), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (1188, 1193), False, 'from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union\n'), ((5708, 5741), 'azure.core.paging.ItemPaged', 'ItemPaged', (['get_next', 'extract_data'], {}), '(get_next, extract_data)\n', (5717, 57... |
yura505/core | homeassistant/components/tasmota/discovery.py | 0fc5f4b0421c6c5204d3ccb562153ac3836441a9 | """Support for MQTT discovery."""
import asyncio
import logging
from hatasmota.discovery import (
TasmotaDiscovery,
get_device_config as tasmota_get_device_config,
get_entities_for_platform as tasmota_get_entities_for_platform,
get_entity as tasmota_get_entity,
has_entities_with_platform as tasmota... | [((541, 568), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (558, 568), False, 'import logging\n'), ((4432, 4446), 'asyncio.Lock', 'asyncio.Lock', ([], {}), '()\n', (4444, 4446), False, 'import asyncio\n'), ((4517, 4564), 'hatasmota.discovery.TasmotaDiscovery', 'TasmotaDiscovery', (['dis... |
TimoKerr/tfx | tfx/components/infra_validator/executor.py | 10d13d57eeac21514fed73118cb43464dada67f1 | # Copyright 2019 Google LLC. 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 a... | [((4482, 4528), 'absl.logging.info', 'logging.info', (['"""Model passed infra validation."""'], {}), "('Model passed infra validation.')\n", (4494, 4528), False, 'from absl import logging\n'), ((4729, 4775), 'absl.logging.info', 'logging.info', (['"""Model failed infra validation."""'], {}), "('Model failed infra valid... |
ykyang/org.allnix.python | learning_python/org/allnix/util.py | f9d74db2db026b20e925ac40dbca7d21b3ac0b0f | def write(message: str):
print("org.allnix", message)
def read() -> str:
"""Returns a string"""
return "org.allnix"
| [] |
happys2333/DL-2021-fall | metr-la/model/Double_C_STTN.py | e110d737d1a70c8238f2de3278e6aebce07c7a66 | # from folder workMETRLA
# MODEL CODE
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 10:28:06 2020
@author: wb
"""
import torch
import torch.nn as nn
import math
# from GCN_models import GCN
# from One_hot_encoder import One_hot_encoder
import torch.nn.functional as F
import numpy as np
from sc... | [((17649, 17664), 'torch.Tensor', 'torch.Tensor', (['A'], {}), '(A)\n', (17661, 17664), False, 'import torch\n'), ((17951, 18006), 'torchsummary.summary', 'summary', (['model', '(2, N_NODE, TIMESTEP_IN)'], {'device': 'device'}), '(model, (2, N_NODE, TIMESTEP_IN), device=device)\n', (17958, 18006), False, 'from torchsum... |
daniel-chuang/tetris | tetrisanim3.py | 518bd7b1fd80babc34a1da323b2f50d88c31ed4a | # animation for medium article
from termcolor import colored
import time
import imageio
import pyautogui
pyautogui.FAILSAFE = True
matrix = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0... | [((1921, 1959), 'pyautogui.moveTo', 'pyautogui.moveTo', (['(338)', '(580)'], {'duration': '(0)'}), '(338, 580, duration=0)\n', (1937, 1959), False, 'import pyautogui\n'), ((1970, 2011), 'pyautogui.hotkey', 'pyautogui.hotkey', (['"""command"""', '"""shift"""', '"""4"""'], {}), "('command', 'shift', '4')\n", (1986, 2011)... |
destodasoftware/kately_api | inventories/models.py | 89e4e80a93ebf8e5d2f2981d108ce5efde75d0dd | from django.db import models
from products.models import Product
from utils.models import Utility
class Inventory(Utility):
inventory_number = models.CharField(unique=True, max_length=100, blank=True, null=True)
supplier = models.CharField(max_length=100, blank=True, null=True)
user = models.ForeignKey('... | [((150, 218), 'django.db.models.CharField', 'models.CharField', ([], {'unique': '(True)', 'max_length': '(100)', 'blank': '(True)', 'null': '(True)'}), '(unique=True, max_length=100, blank=True, null=True)\n', (166, 218), False, 'from django.db import models\n'), ((234, 289), 'django.db.models.CharField', 'models.CharF... |
stephken/Hierarchical_assessment | hierarchical_app/views.py | 537219903357d97d1354a8f262badba9729fb5e0 | from django.shortcuts import render
from hierarchical_app.models import Folder
# Create your views here.
def index_view(request):
return render(request, 'index.html', {'welcome': "Welcome to Kens Hierarchical Data and You assessment", 'folders': Folder.objects.all()})
| [((252, 272), 'hierarchical_app.models.Folder.objects.all', 'Folder.objects.all', ([], {}), '()\n', (270, 272), False, 'from hierarchical_app.models import Folder\n')] |
ramizdundar/Chexpert | bin/train_vit.py | 6a5f005f1df421538182ad8497725b78e6de29be | import sys
import os
import argparse
import logging
import json
import time
import subprocess
from shutil import copyfile
import numpy as np
from sklearn import metrics
from easydict import EasyDict as edict
import torch
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torch.nn import DataP... | [((466, 486), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (483, 486), False, 'import torch\n'), ((487, 516), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['(0)'], {}), '(0)\n', (513, 516), False, 'import torch\n'), ((711, 761), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ... |
AndreasGeiger/hackerrank-python | Sets/the capaint s room.py | a436c207e62b32f70a6b4279bb641a3c4d90e112 | groupSize = input()
groups = list(map(int,input().split(' ')))
tmpArray1 = set()
tmpArray2 = set()
for i in groups:
if i in tmpArray1:
tmpArray2.discard(i)
else:
tmpArray1.add(i)
tmpArray2.add(i)
for i in tmpArray2:
print(i)
| [] |
gtmadureira/Python | tests/testsoma.py | 38de6c56fec1d22662f30c1ff4d4f4f411678484 | import unittest
from hf_src.main import soma
class TestSoma(unittest.TestCase):
def test_retorno_soma_15_30(self):
self.assertEqual(soma(15, 30), 45)
| [((146, 158), 'hf_src.main.soma', 'soma', (['(15)', '(30)'], {}), '(15, 30)\n', (150, 158), False, 'from hf_src.main import soma\n')] |
rohe/oictest | src/oictest/setup.py | f6f0800220befd5983b8cb34a5c984f98855d089 | import copy
import json
from oic.utils.authn.client import CLIENT_AUTHN_METHOD
from oic.utils.keyio import KeyJar
from oic.utils.keyio import KeyBundle
__author__ = 'roland'
import logging
logger = logging.getLogger(__name__)
class OIDCError(Exception):
pass
def flow2sequence(operations, item):
flow = o... | [((202, 229), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (219, 229), False, 'import logging\n'), ((2044, 2076), 'copy.copy', 'copy.copy', (["kwargs['preferences']"], {}), "(kwargs['preferences'])\n", (2053, 2076), False, 'import copy\n'), ((2812, 2820), 'oic.utils.keyio.KeyJar', 'KeyJ... |
PKUfudawei/cmssw | HLTrigger/Configuration/python/HLT_75e33/modules/hltPFPuppiNoLep_cfi.py | 8fbb5ce74398269c8a32956d7c7943766770c093 | import FWCore.ParameterSet.Config as cms
hltPFPuppiNoLep = cms.EDProducer("PuppiProducer",
DeltaZCut = cms.double(0.1),
DeltaZCutForChargedFromPUVtxs = cms.double(0.2),
EtaMaxCharged = cms.double(99999.0),
EtaMaxPhotons = cms.double(2.5),
EtaMinUseDeltaZ = cms.double(-1.0),
MinPuppiWeight = cms... | [((108, 123), 'FWCore.ParameterSet.Config.double', 'cms.double', (['(0.1)'], {}), '(0.1)\n', (118, 123), True, 'import FWCore.ParameterSet.Config as cms\n'), ((161, 176), 'FWCore.ParameterSet.Config.double', 'cms.double', (['(0.2)'], {}), '(0.2)\n', (171, 176), True, 'import FWCore.ParameterSet.Config as cms\n'), ((198... |
RogueScholar/debreate | wizbin/build.py | 0abc168c51336b31ff87c61f84bc7bb6000e88f4 | # -*- coding: utf-8 -*-
## \package wizbin.build
# MIT licensing
# See: docs/LICENSE.txt
import commands, os, shutil, subprocess, traceback, wx
from dbr.functions import FileUnstripped
from dbr.language import GT
from dbr.log import DebugEnabled
from dbr.log import Logger
from dbr.md5 import WriteMD5
from ... | [] |
maelstromdat/YOSHI | __main__.py | 67e5176f24ff12e598025d4250b408da564f53d1 | from YoshiViz import Gui
if __name__ == '__main__':
#file director
gui = Gui.Gui()
"""
report_generator.\
generate_pdf_report(fileDirectory, repositoryName, tempCommunityType)
"""
print('the type of', repositoryName, 'is', tempCommunityType, '\n"check .\YoshiViz\output"')
| [((83, 92), 'YoshiViz.Gui.Gui', 'Gui.Gui', ([], {}), '()\n', (90, 92), False, 'from YoshiViz import Gui\n')] |
LarsenClose/dr.hpotter | hpotter/src/lazy_init.py | ef6199ab563a92f3e4916277dbde9217126f36a9 | ''' Wrap an __init__ function so that I don't have to assign all the
parameters to a self. variable. '''
# https://stackoverflow.com/questions/5048329/python-decorator-for-automatic-binding-init-arguments
import inspect
from functools import wraps
def lazy_init(init):
''' Create an annotation to assign all the p... | [((441, 452), 'functools.wraps', 'wraps', (['init'], {}), '(init)\n', (446, 452), False, 'from functools import wraps\n'), ((375, 403), 'inspect.getfullargspec', 'inspect.getfullargspec', (['init'], {}), '(init)\n', (397, 403), False, 'import inspect\n')] |
technojam/MLian | main.py | 7632c5c7d4c44b1d87de9ab23c1ed7293962ca49 | # def register_feed():
import os
import cv2
path = '/UserImage'
cam = cv2.VideoCapture(0)
name=input("Name: ")
cv2.namedWindow("test")
img_counter = 0
while True:
ret, frame = cam.read()
if not ret:
print("failed to grab frame")
break
else:
cv2.imshow("test", frame)
k = c... | [((70, 89), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (86, 89), False, 'import cv2\n'), ((112, 135), 'cv2.namedWindow', 'cv2.namedWindow', (['"""test"""'], {}), "('test')\n", (127, 135), False, 'import cv2\n'), ((758, 781), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (779, ... |
Hiwyl/keras_cnn_finetune | models/train.py | f424302a72c8d05056a9af6f9b293003acb8398d | # -*- encoding: utf-8 -*-
'''
@Author : lance
@Email : wangyl306@163.com
'''
import time
from model_cx.inceptionresnet import inceptionresnet
from model_cx.vgg19two import vgg19_all_lr
from model_cx.inceptionv3 import inceptionv3
from model_cx.densenet import densenet
from model_cx.nasnet import nas... | [((697, 708), 'time.time', 'time.time', ([], {}), '()\n', (706, 708), False, 'import time\n'), ((2591, 2602), 'time.time', 'time.time', ([], {}), '()\n', (2600, 2602), False, 'import time\n'), ((1273, 1337), 'model_cx.merge.merge', 'merge', (['classes', 'epochs', 'steps_per_epoch', 'validation_steps', 'shape'], {}), '(... |
alpiges/probnum | src/probnum/randprocs/markov/integrator/_preconditioner.py | 2e4153cb0df559984e09ec74487ef6c9d3f6d464 | """Coordinate changes in state space models."""
import abc
try:
# cached_property is only available in Python >=3.8
from functools import cached_property
except ImportError:
from cached_property import cached_property
import numpy as np
import scipy.special # for vectorised factorial
from probnum impor... | [((1145, 1210), 'probnum.randvars.Normal', 'randvars.Normal', (['new_mean', 'new_cov'], {'cov_cholesky': 'new_cov_cholesky'}), '(new_mean, new_cov, cov_cholesky=new_cov_cholesky)\n', (1160, 1210), False, 'from probnum import config, linops, randvars\n'), ((2482, 2506), 'numpy.arange', 'np.arange', (['order', '(-1)', '(... |
mina-gaid/scp | allauth/socialaccount/providers/linkedin/provider.py | 38e1cd303d4728a987df117f666ce194e241ed1a | from allauth.socialaccount import providers
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth.provider import OAuthProvider
from allauth.socialaccount import app_settings
class LinkedInAccount(ProviderAccount):
def get_profile_url(self):
return se... | [((2299, 2344), 'allauth.socialaccount.providers.registry.register', 'providers.registry.register', (['LinkedInProvider'], {}), '(LinkedInProvider)\n', (2326, 2344), False, 'from allauth.socialaccount import providers\n')] |
CCTQL/2048-api | game2048/myNew.py | a75316a90e9a7c8c9171e39e1d1fc24cbac3ba1a | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets
from torch.autograd import Variable
from sklearn.model_selection import train_test_split
import time
import pandas as pd
import numpy as np
import csv
batch_size = 128
NUM_EPOC... | [((2241, 2281), 'pandas.read_csv', 'pd.read_csv', (['"""./drive/My Drive/DATA.csv"""'], {}), "('./drive/My Drive/DATA.csv')\n", (2252, 2281), True, 'import pandas as pd\n'), ((2387, 2416), 'torch.FloatTensor', 'torch.FloatTensor', (['board_data'], {}), '(board_data)\n', (2404, 2416), False, 'import torch\n'), ((2422, 2... |
yliu120/dbsystem | HW2/dbsys-hw2/Database.py | d1b008f411929058a34a1dd2c44c9ee2cf899865 | import json, io, os, os.path
from Catalog.Schema import DBSchema, DBSchemaEncoder, DBSchemaDecoder
from Query.Plan import PlanBuilder
from Storage.StorageEngine import StorageEngine
class Database:
"""
A top-level database engine class.
For now, this primarily maintains a simple catalog,
... | [((4600, 4617), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (4615, 4617), False, 'import doctest\n'), ((3331, 3351), 'Query.Plan.PlanBuilder', 'PlanBuilder', ([], {'db': 'self'}), '(db=self)\n', (3342, 3351), False, 'from Query.Plan import PlanBuilder\n'), ((4415, 4454), 'json.loads', 'json.loads', (['buffe... |
dboyliao/TaipeiPy-pybind11-buffer-array | tests/test_arr_add_value.py | 22e764d9fbf605950c0de10e3a341de36bc9bf89 | import numpy as np
import mylib
def test_arr_add_value():
for _ in range(10):
shape = np.random.randint(1, 10, size=np.random.randint(3, 10)).tolist()
in_arr = np.random.rand(*shape).astype(np.double)
ok = np.allclose(mylib.array_add_value(in_arr, np.pi), in_arr + np.pi)
if not ok... | [((249, 285), 'mylib.array_add_value', 'mylib.array_add_value', (['in_arr', 'np.pi'], {}), '(in_arr, np.pi)\n', (270, 285), False, 'import mylib\n'), ((183, 205), 'numpy.random.rand', 'np.random.rand', (['*shape'], {}), '(*shape)\n', (197, 205), True, 'import numpy as np\n'), ((131, 155), 'numpy.random.randint', 'np.ra... |
DavideRuzza/moderngl-window | moderngl_window/resources/data.py | e9debc6ed4a1899aa83c0da2320e03b0c2922b80 | """
Registry general data files
"""
from typing import Any
from moderngl_window.resources.base import BaseRegistry
from moderngl_window.meta import DataDescription
class DataFiles(BaseRegistry):
"""Registry for requested data files"""
settings_attr = "DATA_LOADERS"
def load(self, meta: DataDescription) ... | [] |
frewsxcv/routes | tests/test_units/test_mapper_str.py | 7690fc1016e56739855435fb54c96acccfa29009 | import unittest
from routes import Mapper
class TestMapperStr(unittest.TestCase):
def test_str(self):
m = Mapper()
m.connect('/{controller}/{action}')
m.connect('entries', '/entries', controller='entry', action='index')
m.connect('entry', '/entries/{id}', controller='entry',... | [((124, 132), 'routes.Mapper', 'Mapper', ([], {}), '()\n', (130, 132), False, 'from routes import Mapper\n')] |
HAOYUatHZ/pyquarkchain | quarkchain/tools/config_slave.py | b2c7c02e4415aa26917c2cbb5e7571c9fef16c5b | """
python config_slave.py 127.0.0.1 38000 38006 127.0.0.2 18999 18002
will generate 4 slave server configs accordingly. will be used in deployment automation to configure a cluster.
usage: python config_slave.py <host1> <port1> <port2> <host2> <port3> ...
"""
import argparse
import collections
import json
import ... | [((472, 497), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (495, 497), False, 'import argparse\n'), ((692, 717), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (707, 717), False, 'import os\n'), ((730, 754), 'os.path.dirname', 'os.path.dirname', (['abspath'], {}), '... |
MauMendes/python3-programming-specialization | python-function-files-dictionaries/week4-assignment1.py | 8bd259f0ac559c6004baa0e759b6ec4bc25e1320 | #1) Write a function, sublist, that takes in a list of numbers as the parameter. In the function, use a while loop to return a sublist of the input list.
# The sublist should contain the same values of the original list up until it reaches the number 5 (it should not contain the number 5).
def sublist(input_lst):
... | [] |
Canway-shiisa/bk-iam-saas | saas/backend/apps/group/views.py | 73c3770d9647c9cc8d515427cd1d053d8af9d071 | # -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-权限中心(BlueKing-IAM) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with th... | [((3317, 3348), 'logging.getLogger', 'logging.getLogger', (['"""permission"""'], {}), "('permission')\n", (3334, 3348), False, 'import logging\n'), ((4682, 4701), 'backend.apps.group.models.Group.objects.all', 'Group.objects.all', ([], {}), '()\n', (4699, 4701), False, 'from backend.apps.group.models import Group\n'), ... |
fillest/7drl2013 | towers.py | 96d291dce08a85d3871713c99f3a036de482d6ca | import util
import libtcodpy as tcod
import enemies
import operator
class Missile (util.Entity):
sym = '*'
color = tcod.white
class BasicMissile (Missile):
color = tcod.yellow
class IceMissile (Missile):
color = tcod.light_blue
class AoeMissile (Missile):
color = tcod.red
class Building (util.Entity):
sym ... | [((3087, 3121), 'libtcodpy.line_init', 'tcod.line_init', (['m.x', 'm.y', 'e.x', 'e.y'], {}), '(m.x, m.y, e.x, e.y)\n', (3101, 3121), True, 'import libtcodpy as tcod\n'), ((3131, 3147), 'libtcodpy.line_step', 'tcod.line_step', ([], {}), '()\n', (3145, 3147), True, 'import libtcodpy as tcod\n'), ((1690, 1725), 'util.dist... |
lukasjoc/random | python/mandelbrot.py | 5be080b424f02491fb219634902fc0cc192aff6c | #!/usr/bin/python3
from PIL import Image
from numpy import complex, array
from tqdm import tqdm
import colorsys
W=512
#W=142
def mandelbrot(x, y):
def get_colors(i):
color = 255 * array(colorsys.hsv_to_rgb(i / 255.0, 1.0, 0.5))
return tuple(color.astype(int))
c, cc = 0, complex(x, y)
fo... | [((300, 313), 'numpy.complex', 'complex', (['x', 'y'], {}), '(x, y)\n', (307, 313), False, 'from numpy import complex, array\n'), ((202, 242), 'colorsys.hsv_to_rgb', 'colorsys.hsv_to_rgb', (['(i / 255.0)', '(1.0)', '(0.5)'], {}), '(i / 255.0, 1.0, 0.5)\n', (221, 242), False, 'import colorsys\n')] |
tonyreina/mlt | tests/unit/commands/test_deploy.py | ee490ebdeb5aa6924dbfc0a067a0653754c470f4 | #
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [((1297, 1308), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (1306, 1308), False, 'from mock import call, MagicMock\n'), ((1542, 1553), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (1551, 1553), False, 'from mock import call, MagicMock\n'), ((2210, 2376), 'mlt.commands.deploy.DeployCommand', 'DeployCommand', ([... |
mcvine/mcvine | packages/mccomponents/tests/mccomponentsbpmodule/sample/Broadened_E_Q_Kernel_TestCase.py | 42232534b0c6af729628009bed165cd7d833789d | #!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Jiao Lin
# California Institute of Technology
# (C) 2006-2010 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | [((447, 493), 'journal.debug', 'journal.debug', (['"""Broadened_E_Q_Kernel_TestCase"""'], {}), "('Broadened_E_Q_Kernel_TestCase')\n", (460, 493), False, 'import journal\n'), ((506, 554), 'journal.warning', 'journal.warning', (['"""Broadened_E_Q_Kernel_TestCase"""'], {}), "('Broadened_E_Q_Kernel_TestCase')\n", (521, 554... |
robinzixuan/Video-Question-Answering-HRI | baseline/ns-vqa/reason/options/test_options.py | ae68ffee1e6fc1eb13229e457e3b8e3bc3a11579 | from .base_options import BaseOptions
class TestOptions(BaseOptions):
"""Test Option Class"""
def __init__(self):
super(TestOptions, self).__init__()
self.parser.add_argument('--load_checkpoint_path', required=True, type=str, help='checkpoint path')
self.parser.add_argument('--save_re... | [] |
keremakdemir/ISONE_UCED | Model_setup/NEISO_data_file/downsampling_generators_v1.py | 11ce34c5ac5d34dcab771640f41c0d2ce4ab21f9 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 24 18:45:34 2020
@author: kakdemi
"""
import pandas as pd
#importing generators
all_generators = pd.read_excel('generators2.xlsx', sheet_name='NEISO generators (dispatch)')
#getting all oil generators
all_oil = all_generators[all_generators['typ']=='oil'].copy()
#gett... | [((147, 222), 'pandas.read_excel', 'pd.read_excel', (['"""generators2.xlsx"""'], {'sheet_name': '"""NEISO generators (dispatch)"""'}), "('generators2.xlsx', sheet_name='NEISO generators (dispatch)')\n", (160, 222), True, 'import pandas as pd\n'), ((5938, 6124), 'pandas.concat', 'pd.concat', (['[all_other, CT_agg_oil_df... |
otmanabdoun/IHM-Python | GUI1.py | 624e961c2f6966b98bf2c1bc4dd276b812954ba1 | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 16 19:47:41 2021
@author: User
"""
import tkinter as tk
racine = tk . Tk ()
label = tk . Label ( racine , text ="J ' adore Python !")
bouton = tk . Button ( racine , text =" Quitter ", command = racine . destroy )
label . pack ()
bouton . pack () | [((122, 129), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (127, 129), True, 'import tkinter as tk\n'), ((142, 185), 'tkinter.Label', 'tk.Label', (['racine'], {'text': '"""J \' adore Python !"""'}), '(racine, text="J \' adore Python !")\n', (150, 185), True, 'import tkinter as tk\n'), ((202, 261), 'tkinter.Button', 'tk.But... |
ertyurk/bugme | app/routes/v1/endpoints/clickup.py | 5a3ef3e089e0089055074c1c896c3fdc76600e93 | from fastapi import APIRouter, status, Body, HTTPException
from fastapi.encoders import jsonable_encoder
from starlette.responses import JSONResponse
from app.models.common import *
from app.models.clickup import *
from app.database.crud.clickup import *
router = APIRouter()
@router.get("/", response_description="C... | [((266, 277), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (275, 277), False, 'from fastapi import APIRouter, status, Body, HTTPException\n'), ((789, 798), 'fastapi.Body', 'Body', (['...'], {}), '(...)\n', (793, 798), False, 'from fastapi import APIRouter, status, Body, HTTPException\n'), ((815, 840), 'fastapi.e... |
npeschke/cellfinder-core | cellfinder_core/main.py | 7a86a7d2c879c94da529ec6140f7e5c3f02bf288 | """
N.B imports are within functions to prevent tensorflow being imported before
it's warnings are silenced
"""
import os
import logging
from imlib.general.logging import suppress_specific_logs
tf_suppress_log_messages = [
"multiprocessing can interact badly with TensorFlow"
]
def main(
signal_array,
ba... | [((1058, 1069), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (1067, 1069), False, 'from pathlib import Path\n'), ((1114, 1155), 'logging.info', 'logging.info', (['"""Detecting cell candidates"""'], {}), "('Detecting cell candidates')\n", (1126, 1155), False, 'import logging\n'), ((1170, 1401), 'cellfinder_core.d... |
rezist-ro/rezistenta.tv | server.py | 0c0dfa4842061baf2b575688588c5d77cfdba427 | # coding=utf-8
import dateutil.parser
import flask
import json
import os
import time
import urllib
import yaml
EPISODES = yaml.load(open("episodes.yaml").read())
app = flask.Flask(__name__,
static_path="/assets",
static_folder="assets")
app.jinja_env.filters["strftime"] = \
... | [((172, 240), 'flask.Flask', 'flask.Flask', (['__name__'], {'static_path': '"""/assets"""', 'static_folder': '"""assets"""'}), "(__name__, static_path='/assets', static_folder='assets')\n", (183, 240), False, 'import flask\n'), ((458, 495), 'os.path.join', 'os.path.join', (['app.root_path', '"""assets"""'], {}), "(app.... |
mazayus/ProjectEuler | problem020.py | 64aebd5d80031fab2f0ef3c44c3a1118212ab613 | #!/usr/bin/env python3
from functools import *
import operator
def factorial(number):
assert number >= 1
return reduce(operator.mul, range(1, number+1))
def digits(number):
yield from (int(digit) for digit in str(number))
print(sum(digits(factorial(100))))
| [] |
ghafran/KerasPersonLab | transformer.py | fcd80b62247aee8bd1d41ff91e31c822950f561e | import numpy as np
from math import cos, sin, pi
import cv2
import random
from config import config, TransformationParams
from data_prep import map_coco_to_personlab
class AugmentSelection:
def __init__(self, flip=False, degree = 0., crop = (0,0), scale = 1.):
self.flip = flip
self.degree = degre... | [((2012, 2085), 'numpy.array', 'np.array', (['[[1.0, 0.0, -center_x], [0.0, 1.0, -center_y], [0.0, 0.0, 1.0]]'], {}), '([[1.0, 0.0, -center_x], [0.0, 1.0, -center_y], [0.0, 0.0, 1.0]])\n', (2020, 2085), True, 'import numpy as np\n'), ((2170, 2216), 'numpy.array', 'np.array', (['[[A, B, 0], [-B, A, 0], [0, 0, 1.0]]'], {... |
mizuno-group/enan | enan/__init__.py | 3c9dbe60bebf98e384e858db56980928b5897775 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 25 15:46:32 2019
@author: tadahaya
"""
from .binom import BT
from .connect import Connect
from .fet import FET
from .gsea import GSEA
from .ssgsea import ssGSEA
__copyright__ = 'Copyright (C) 2020 MIZUNO Tadahaya'
__version__ = '1.0.3'
__license__... | [] |
Hacker-1202/Selfium | app/helpers/__init__.py | 7e798c23c9f24aacab6f6a485d6355f1045bc65c |
"""
Selfium Helper Files
~~~~~~~~~~~~~~~~~~~
All Helper Files used in Selfium project;
:copyright: (c) 2021 - Caillou and ZeusHay;
:license: MIT, see LICENSE for more details.
"""
from .getUser import *
from .getGuild import *
from .params import *
from .notify import *
from .sendEmbed import *
from .isStaff import * | [] |
zhangyimi/Research | NLP/UNIMO/src/finetune/visual_entailment.py | 866f91d9774a38d205d6e9a3b1ee6293748261b3 | # Copyright (c) 2021 PaddlePaddle 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 app... | [((1161, 1197), 'paddle.fluid.layers.softmax', 'fluid.layers.softmax', ([], {'input': 'q_logits'}), '(input=q_logits)\n', (1181, 1197), True, 'import paddle.fluid as fluid\n'), ((1206, 1242), 'paddle.fluid.layers.softmax', 'fluid.layers.softmax', ([], {'input': 'p_logits'}), '(input=p_logits)\n', (1226, 1242), True, 'i... |
oth-datapipeline/ingestion-scripts | src/records.py | 48eecf63b0bf06200aa59be63de6839599ec51df | from faust import Record
class RssFeed(Record, serializer='json'):
feed_source: str
title: str
link: str
published: str = None
author: str = None
summary: str = None
published_parsed: list = None
authors: list = None
tags: list = None
comments: str = None
content: list = No... | [] |
vaishali-bariwal/Practice-Coding-Questions | leetcode/102-Medium-Binary-Tree-Level-Order-Traversal/answer.py | 747bfcb1cb2be5340daa745f2b9938f0ee87c9ac | #!/usr/bin/python3
#------------------------------------------------------------------------------
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def levelOrder(self, root):
... | [] |
shirayu/fitbit-dumper | setup.py | 21cee614e294d84204ad06d81dae9adf9853a135 | #!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name="",
version="0.01",
packages=find_packages(),
install_requires=[
"fitbit"
],
dependency_links=[
],
extras_require={
"tests": [
"flake8",
"autopep8",
]
}
)
| [((122, 137), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (135, 137), False, 'from setuptools import setup, find_packages\n')] |
mtnmunuklu/SigmaToExcel | src/main.py | 7d11fda19c0075122928ff5f1dbaab7775d30fe9 | import sys
sys.path.append("../")
from src.app.sigma import SigmaConverter
if __name__ == "__main__":
sigmaconverter = SigmaConverter()
sigmaconverter.read_from_file()
sigmaconverter.write_to_excel()
| [((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((125, 141), 'src.app.sigma.SigmaConverter', 'SigmaConverter', ([], {}), '()\n', (139, 141), False, 'from src.app.sigma import SigmaConverter\n')] |
CloudReactor/task_manager | server/processes/migrations/0132_auto_20201108_0540.py | 464ca74371064fabb9a21b1f5bacba30360932ab | # Generated by Django 2.2.14 on 2020-11-08 05:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('processes', '0131_auto_20201107_2316'),
]
operations = [
migrations.RunSQL(
"UPDATE processes_workflow SET run_environ... | [((242, 403), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""UPDATE processes_workflow SET run_environment_id = scheduling_run_environment_id WHERE run_environment_id IS NULL;"""'], {'reverse_sql': '""""""'}), "(\n 'UPDATE processes_workflow SET run_environment_id = scheduling_run_environment_id WHERE run... |
pengkangzaia/usad | sparsely_lstmvae_main.py | 937a29c24632cfa31e0c626cd5b058b3af74ef94 | from model.sparsely_lstm_vae import *
import torch.utils.data as data_utils
from sklearn import preprocessing
from utils.eval_methods import *
device = get_default_device()
# Read data
# normal = pd.read_csv("data/SWaT_Dataset_Normal_v1.csv") # , nrows=1000)
normal = pd.read_csv("data/SWaT/SWaT_Dataset_Normal_v1.csv... | [((614, 642), 'sklearn.preprocessing.MinMaxScaler', 'preprocessing.MinMaxScaler', ([], {}), '()\n', (640, 642), False, 'from sklearn import preprocessing\n')] |
MexsonFernandes/AsynchronousTasks-Django-Celery-RabbitMQ-Redis | src/demo/tasks.py | b64b31cec4ccf8e0dca2cfe9faba40da647b94f7 | from __future__ import absolute_import, unicode_literals
from dcs.celeryconf import app
import time
from django.core.mail import EmailMessage
@app.task(bind=True, ignore_result=False, max_retries=3)
def demo_task1(self):
result = {
'val1': 1,
'val2': 2,
'val3': 3,
}
print("hellp")
... | [((145, 200), 'dcs.celeryconf.app.task', 'app.task', ([], {'bind': '(True)', 'ignore_result': '(False)', 'max_retries': '(3)'}), '(bind=True, ignore_result=False, max_retries=3)\n', (153, 200), False, 'from dcs.celeryconf import app\n')] |
Ayansam1152/translate | pytorch_translate/models/__init__.py | 33d397fc25fb1072abd2975c77c602a2d031c6c4 | #!/usr/bin/env python3
import importlib
import os
# automatically import any Python files in the models/ directory
for file in sorted(os.listdir(os.path.dirname(__file__))):
if file.endswith(".py") and not file.startswith("_"):
model_name = file[: file.find(".py")]
importlib.import_module("pytorc... | [((148, 173), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (163, 173), False, 'import os\n'), ((289, 354), 'importlib.import_module', 'importlib.import_module', (["('pytorch_translate.models.' + model_name)"], {}), "('pytorch_translate.models.' + model_name)\n", (312, 354), False, 'import i... |
mapeimapei/awesome-flask-webapp | app/config/secure.py | d0474f447a41e9432a14f9110989166c6595f0fa | # -*- coding: utf-8 -*-
__author__ = '带土'
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:mapei123@127.0.0.1:3306/awesome'
SECRET_KEY = '\x88D\xf09\x91\x07\x98\x89\x87\x96\xa0A\xc68\xf9\xecJ:U\x17\xc5V\xbe\x8b\xef\xd7\xd8\xd3\xe6\x98*4'
# Email 配置
MAIL_SERVER = 'smtp.exmail.qq.com'
MAIL_PORT = 465
MAIL_USE_SSL = True... | [((714, 732), 'datetime.timedelta', 'timedelta', ([], {'days': '(30)'}), '(days=30)\n', (723, 732), False, 'from datetime import timedelta\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.