hexsha stringlengths 40 40 | size int64 5 2.06M | ext stringclasses 11 values | lang stringclasses 1 value | max_stars_repo_path stringlengths 3 251 | max_stars_repo_name stringlengths 4 130 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 251 | max_issues_repo_name stringlengths 4 130 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 116k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 251 | max_forks_repo_name stringlengths 4 130 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 1 1.05M | avg_line_length float64 1 1.02M | max_line_length int64 3 1.04M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a3cc11867421204e587bf63f6a7dd58a6716ea01 | 2,030 | py | Python | infapy/v3/agentService.py | infapy/infapy | 0cb11310130be70ce1b647aa5ede929c1eb9b2ce | [
"Apache-2.0"
] | null | null | null | infapy/v3/agentService.py | infapy/infapy | 0cb11310130be70ce1b647aa5ede929c1eb9b2ce | [
"Apache-2.0"
] | null | null | null | infapy/v3/agentService.py | infapy/infapy | 0cb11310130be70ce1b647aa5ede929c1eb9b2ce | [
"Apache-2.0"
] | 1 | 2021-09-23T10:31:56.000Z | 2021-09-23T10:31:56.000Z | # Copyright (c) 2021-Present (Prashanth Pradeep)
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import requests as re
import infapy
from infapy.exceptions import InvalidDetailsProvided | 38.301887 | 120 | 0.634975 |
a3cd937793e2d0c588285b6a5f1e77f851ebcc85 | 5,703 | py | Python | home_application/views.py | pengwow/test-demo | 9d5c460b534d93d84f39ae24db82aa101027d199 | [
"Apache-2.0"
] | null | null | null | home_application/views.py | pengwow/test-demo | 9d5c460b534d93d84f39ae24db82aa101027d199 | [
"Apache-2.0"
] | 4 | 2020-02-12T01:47:04.000Z | 2021-06-10T21:34:36.000Z | home_application/views.py | pengwow/test-demo | 9d5c460b534d93d84f39ae24db82aa101027d199 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making (BlueKing) available.
Copyright (C) 2017 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 the License.
You may obtain a copy of the License at http://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
"""
from common.mymako import render_mako_context, render_json
from blueking.component.shortcuts import get_client_by_request
from django.views.decorators.csrf import csrf_exempt
from models import TEST, HostDisk, ScriptExecInfo
import json
import base64
def home(request):
"""
"""
# yewu = [
# {'id': 1, "name": u"1"},
# {'id': 2, "name": u"2"},
# {'id': 3, "name": u"3"},
# ]
# APPrequest
client = get_client_by_request(request)
kwargs = {}
result = client.cc.search_business(kwargs)
print(result)
yewu = result['data']['info']
return render_mako_context(request, '/home_application/home.html',
{
"yewu": yewu,
"AAA": u""
})
def submit_template(request):
"""
"""
print(request.body)
return render_json({"1111111": "dddddddddd"})
def dev_guide(request):
"""
"""
return render_mako_context(request, '/home_application/dev_guide.html')
def contactus(request):
"""
"""
return render_mako_context(request, '/home_application/contact.html')
# ####################
def download_file(request):
"""
:param request:
:return: response
"""
from django.http import FileResponse
#
file_name = request.GET.get('filename')
fd = open('./' + file_name, 'rb')
response = FileResponse(fd)
response['Content-Type'] = 'application/octet-stream'
response['Content-Disposition'] = 'attachment;filename="%s"' % file_name
return response
| 30.015789 | 115 | 0.627389 |
a3cdf292bfc1d114fbf7d5d60cd7d8fcf12221e7 | 455 | py | Python | Chapter 6/09 - The built-in multiprocessing module/basic_multiprocessing.py | moseskim/Expert-Python-Programming-Fourth-Edition | 5160f974deb2365597b7be9cc032f24bfa13471a | [
"MIT"
] | null | null | null | Chapter 6/09 - The built-in multiprocessing module/basic_multiprocessing.py | moseskim/Expert-Python-Programming-Fourth-Edition | 5160f974deb2365597b7be9cc032f24bfa13471a | [
"MIT"
] | null | null | null | Chapter 6/09 - The built-in multiprocessing module/basic_multiprocessing.py | moseskim/Expert-Python-Programming-Fourth-Edition | 5160f974deb2365597b7be9cc032f24bfa13471a | [
"MIT"
] | null | null | null | """
""
`multiprocessing`
.
"""
from multiprocessing import Process
import os
if __name__ == "__main__":
main()
| 18.2 | 77 | 0.650549 |
a3ce427e7608fff21718948d99c9396b801b2425 | 670 | py | Python | sweeper/cloud/localhost/manager.py | dominoFire/sweeper | 26c5497b81c8d0c50671f8ab75c1cf5c4c8191c9 | [
"MIT"
] | null | null | null | sweeper/cloud/localhost/manager.py | dominoFire/sweeper | 26c5497b81c8d0c50671f8ab75c1cf5c4c8191c9 | [
"MIT"
] | null | null | null | sweeper/cloud/localhost/manager.py | dominoFire/sweeper | 26c5497b81c8d0c50671f8ab75c1cf5c4c8191c9 | [
"MIT"
] | null | null | null | __author__ = '@dominofire'
import os
from sweeper.cloud import resource_config_combinations
from sweeper.cloud.localhost import resource_config_factory as config_factory
from sweeper.resource import Resource
| 23.928571 | 77 | 0.773134 |
a3ced405166d997be98745f69fe1f51cd0fcd9c9 | 3,193 | py | Python | tfx/orchestration/experimental/core/service_jobs_test.py | BACtaki/tfx | 29db845200beccbb0ffa1e1e1a091e314a3a470f | [
"Apache-2.0"
] | 1,813 | 2019-02-04T17:17:30.000Z | 2022-03-29T13:39:30.000Z | tfx/orchestration/experimental/core/service_jobs_test.py | BACtaki/tfx | 29db845200beccbb0ffa1e1e1a091e314a3a470f | [
"Apache-2.0"
] | 2,710 | 2019-02-14T00:41:00.000Z | 2022-03-31T07:23:00.000Z | tfx/orchestration/experimental/core/service_jobs_test.py | BACtaki/tfx | 29db845200beccbb0ffa1e1e1a091e314a3a470f | [
"Apache-2.0"
] | 731 | 2019-02-04T17:59:18.000Z | 2022-03-31T06:45:51.000Z | # Copyright 2021 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 agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for tfx.orchestration.experimental.core.service_jobs."""
from absl.testing.absltest import mock
import tensorflow as tf
from tfx.orchestration.experimental.core import service_jobs
from tfx.orchestration.experimental.core import test_utils
if __name__ == '__main__':
tf.test.main()
| 46.275362 | 83 | 0.777639 |
a3d03f04854e2e542f97a3c9c4b2caeaa5e05045 | 17,041 | py | Python | dragonn/models.py | kundajelab/dragonn | 431e7c6b94a82972ac0fc3ef76d76e9ce8ba67fc | [
"MIT"
] | 251 | 2016-06-20T20:18:27.000Z | 2022-03-03T23:31:38.000Z | dragonn/models.py | kundajelab/dragonn | 431e7c6b94a82972ac0fc3ef76d76e9ce8ba67fc | [
"MIT"
] | 39 | 2016-07-01T20:40:59.000Z | 2022-02-09T23:30:24.000Z | dragonn/models.py | kundajelab/dragonn | 431e7c6b94a82972ac0fc3ef76d76e9ce8ba67fc | [
"MIT"
] | 89 | 2016-06-09T17:59:21.000Z | 2021-12-20T03:00:09.000Z | from __future__ import absolute_import, division, print_function
import matplotlib
import numpy as np
import os
import subprocess
import sys
import tempfile
matplotlib.use('pdf')
import matplotlib.pyplot as plt
from abc import abstractmethod, ABCMeta
from dragonn.metrics import ClassificationResult
from sklearn.svm import SVC as scikit_SVC
from sklearn.tree import DecisionTreeClassifier as scikit_DecisionTree
from sklearn.ensemble import RandomForestClassifier
from keras.models import load_model
from dragonn.runtime_metrics import *
from dragonn.custom_losses import *
import warnings
warnings.filterwarnings('ignore')
class SequenceDNN(Model):
"""
Sequence DNN models.
Parameters
----------
seq_length : int, optional
length of input sequence.
keras_model : instance of keras.models.Sequential, optional
seq_length or keras_model must be specified.
num_tasks : int, optional
number of tasks. Default: 1.
num_filters : list[int] | tuple[int]
number of convolutional filters in each layer. Default: (15,).
conv_width : list[int] | tuple[int]
width of each layer's convolutional filters. Default: (15,).
pool_width : int
width of max pooling after the last layer. Default: 35.
L1 : float
strength of L1 penalty.
dropout : float
dropout probability in every convolutional layer. Default: 0.
verbose: int
Verbosity level during training. Valida values: 0, 1, 2.
Returns
-------
Compiled DNN model.
"""
def get_sequence_filters(self):
"""
Returns 3D array of 2D sequence filters.
"""
return self.model.layers[0].get_weights()[0].squeeze(axis=1)
def predict(self, X):
if self.model_file is None:
raise RuntimeError("GkmSvm hasn't been trained!")
# write test fasta file
test_fname = "%s.test.fa" % self.prefix
self.encode_sequence_into_fasta_file(X, test_fname)
# test gkmsvm
temp_ofp = tempfile.NamedTemporaryFile()
threads_option = '-T %s' % (str(self.threads))
command = ' '.join(['gkmpredict',
test_fname,
self.model_file,
temp_ofp.name,
threads_option])
process = subprocess.Popen(command, shell=True)
process.wait() # wait for it to finish
os.system("rm %s" % test_fname) # remove fasta file
# get classification results
temp_ofp.seek(0)
y = np.array([line.split()[-1] for line in temp_ofp], dtype=float)
temp_ofp.close()
return np.expand_dims(y, 1)
class SVC(Model):
class DecisionTree(Model):
class RandomForest(DecisionTree):
| 41.261501 | 101 | 0.607007 |
a3d04895a38a041247e2747afe97c42331c17ee1 | 3,866 | py | Python | src/mpass/mpass/migrations/0001_initial.py | haltu/velmu-mpass-demo | 19eb0e14fa6710e4aee5d47c898cf570bf7621e5 | [
"MIT"
] | null | null | null | src/mpass/mpass/migrations/0001_initial.py | haltu/velmu-mpass-demo | 19eb0e14fa6710e4aee5d47c898cf570bf7621e5 | [
"MIT"
] | 11 | 2018-08-16T12:09:57.000Z | 2018-08-22T14:26:15.000Z | src/mpass/mpass/migrations/0001_initial.py | haltu/velmu-mpass-demosp | 31b609d1413ab1bd9f833f42eac30366a6d3e6d0 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-20 08:34
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import parler.models
| 42.483516 | 180 | 0.58148 |
a3d07703df62a187a4037e7b46931b65c218c987 | 3,921 | py | Python | dgt/inference/forward_inference.py | fractalego/dgt | 6781b9445d93c4a1680ab3d5636803c81062cc67 | [
"MIT"
] | 3 | 2021-07-26T02:07:15.000Z | 2021-12-21T22:36:15.000Z | dgt/inference/forward_inference.py | fractalego/dgt | 6781b9445d93c4a1680ab3d5636803c81062cc67 | [
"MIT"
] | null | null | null | dgt/inference/forward_inference.py | fractalego/dgt | 6781b9445d93c4a1680ab3d5636803c81062cc67 | [
"MIT"
] | null | null | null | import logging
import random
from dgt.graph.graph_matcher import GraphWeightedMatch
from dgt.utils import graph_iterations
_logger = logging.getLogger(__name__)
| 30.632813 | 95 | 0.579444 |
a3d0a689ffb0010c1b8ab3fafb0b2e1dd2c2562d | 1,528 | py | Python | serverPythonClient/client.py | ikekilinc/dnnSuperBinoculars | b0fc584b1d449961bdbab37cf9d72c0b466f197f | [
"MIT"
] | null | null | null | serverPythonClient/client.py | ikekilinc/dnnSuperBinoculars | b0fc584b1d449961bdbab37cf9d72c0b466f197f | [
"MIT"
] | null | null | null | serverPythonClient/client.py | ikekilinc/dnnSuperBinoculars | b0fc584b1d449961bdbab37cf9d72c0b466f197f | [
"MIT"
] | null | null | null | import argparse
import cv2
import common
# from .utils.cropAtCenter import cropImageCenter
# from cropAtCenter import cropImageCenter
from gabriel_client.websocket_client import WebsocketClient
from gabriel_client.opencv_adapter import OpencvAdapter
DEFAULT_SERVER_HOST = '128.2.212.50'
DEFAULT_ZOOM_FACTOR = 10
if __name__ == '__main__':
main()
| 25.898305 | 78 | 0.719241 |
a3d10c9654ae4266e8db0dc3b63e312a5537bc75 | 719 | py | Python | src/DeepCard.API/batch.py | SharsDela/BankCardRecognize | ce80589bc5a5afaba2b97b1ccab35354fb99b548 | [
"Apache-2.0"
] | 7 | 2019-09-01T13:36:52.000Z | 2021-05-20T19:38:40.000Z | src/DeepCard.API/batch.py | SharsDela/BankCardRecognize | ce80589bc5a5afaba2b97b1ccab35354fb99b548 | [
"Apache-2.0"
] | 1 | 2019-09-01T13:37:50.000Z | 2020-09-18T10:35:20.000Z | src/DeepCard.API/batch.py | SharsDela/BankCardRecognize | ce80589bc5a5afaba2b97b1ccab35354fb99b548 | [
"Apache-2.0"
] | 2 | 2020-02-03T01:57:36.000Z | 2020-03-05T11:19:14.000Z | from api import get_result
import os
import shutil
from glob import glob
from PIL import Image
if __name__ == '__main__':
image_files = glob('./test_images/*.*')
result_dir = './test_results'
if os.path.exists(result_dir):
shutil.rmtree(result_dir)
os.mkdir(result_dir)
txt_file = os.path.join(result_dir, 'result.txt')
txt_f = open(txt_file, 'w')
for image_file in sorted(image_files):
if ".gitkeep" in image_files:
continue
print("Finded file", image_file, end=" ")
result = get_result(Image.open(image_file))
print(":", result)
txt_f.write(image_file.split('/')[-1].split('.')[0] + ':' + result + '\n')
txt_f.close() | 28.76 | 82 | 0.623088 |
a3d15d48b5db9739108b6ecc4d1923cf6d0d654b | 4,106 | py | Python | CIM14/ENTSOE/Equipment/Core/Curve.py | MaximeBaudette/PyCIM | d68ee5ccfc1d32d44c5cd09fb173142fb5ff4f14 | [
"MIT"
] | 58 | 2015-04-22T10:41:03.000Z | 2022-03-29T16:04:34.000Z | CIM14/ENTSOE/Equipment/Core/Curve.py | MaximeBaudette/PyCIM | d68ee5ccfc1d32d44c5cd09fb173142fb5ff4f14 | [
"MIT"
] | 12 | 2015-08-26T03:57:23.000Z | 2020-12-11T20:14:42.000Z | CIM14/ENTSOE/Equipment/Core/Curve.py | MaximeBaudette/PyCIM | d68ee5ccfc1d32d44c5cd09fb173142fb5ff4f14 | [
"MIT"
] | 35 | 2015-01-10T12:21:03.000Z | 2020-09-09T08:18:16.000Z | # Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
from CIM14.ENTSOE.Equipment.Core.IdentifiedObject import IdentifiedObject
| 52.641026 | 277 | 0.614467 |
a3d2324b7f134c8871f8f82a96cc6abc0a30b3ea | 2,432 | py | Python | fluent/syntax/errors.py | unclenachoduh/python-fluent | 1d15bdc94a37ecb488a80aefcdd37b8cb5535f73 | [
"Apache-2.0"
] | null | null | null | fluent/syntax/errors.py | unclenachoduh/python-fluent | 1d15bdc94a37ecb488a80aefcdd37b8cb5535f73 | [
"Apache-2.0"
] | null | null | null | fluent/syntax/errors.py | unclenachoduh/python-fluent | 1d15bdc94a37ecb488a80aefcdd37b8cb5535f73 | [
"Apache-2.0"
] | null | null | null | from __future__ import unicode_literals
| 36.298507 | 76 | 0.60773 |
a3d28839e9a9ab62ac7936ca858e4cb438e092b3 | 16,562 | py | Python | tests/test_mag.py | jdddog/mag-archiver | 079e735e610d6b81b3ac8dc479d4f93bb0aacb11 | [
"Apache-2.0"
] | null | null | null | tests/test_mag.py | jdddog/mag-archiver | 079e735e610d6b81b3ac8dc479d4f93bb0aacb11 | [
"Apache-2.0"
] | null | null | null | tests/test_mag.py | jdddog/mag-archiver | 079e735e610d6b81b3ac8dc479d4f93bb0aacb11 | [
"Apache-2.0"
] | null | null | null | # Copyright 2020 Curtin University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Author: James Diprose
import os
import unittest
from unittest.mock import patch
import pendulum
from azure.common import AzureMissingResourceHttpError
from azure.cosmosdb.table.tableservice import TableService
from azure.storage.blob import ContainerProperties
from mag_archiver.azure import create_table
from mag_archiver.mag import make_mag_query, MagState, MagDateType, MagRelease, MagTask, MagArchiverClient, \
hide_if_not_none
| 45.128065 | 112 | 0.676368 |
a3d2e1e0e46f7f6e0817c75f138edaf65c103137 | 14,084 | py | Python | twitterinfrastructure/CH-Data-Public.py | jacob-heglund/socialsensing-jh | fd6d2d749f40fee46bee749ff868212bf117a747 | [
"BSD-2-Clause",
"MIT"
] | null | null | null | twitterinfrastructure/CH-Data-Public.py | jacob-heglund/socialsensing-jh | fd6d2d749f40fee46bee749ff868212bf117a747 | [
"BSD-2-Clause",
"MIT"
] | null | null | null | twitterinfrastructure/CH-Data-Public.py | jacob-heglund/socialsensing-jh | fd6d2d749f40fee46bee749ff868212bf117a747 | [
"BSD-2-Clause",
"MIT"
] | null | null | null | '''
Created on Mar 22, 2018
Edited on Jan 11, 2019
@author: npvance2
@author: curtisd2
Variables that will need to be edited/personalized:
monitorID in Variables() (line 27)
projectStartDate in Variables() (line 28)
projectEndDate in Variables() (line 29)
authToken in getAuthToken() (line 49)
consumer_key in twitterAPI() (line 62)
consumer_secret in twitterAPI() (line 63)
access_token in twitterAPI() (line 64)
access_secret in twitterAPI() (line 65)
'''
from datetime import date, timedelta
import urllib.request
import json
import csv
import tweepy
from tweepy import OAuthHandler
###########
#
# You'll need to generate your own Crimson API key/token from here:
# https://apidocs.crimsonhexagon.com/reference
#
###########
###########
#
# You'll need to add your own Twitter API keys here.
# Instructions on generating API keys: https://developer.twitter.com/en/docs/basics/authentication/guides/access-tokens.html
# API reference guide: https://developer.twitter.com/en/docs/api-reference-index.html
#
###########
if __name__ == '__main__':
main()
| 47.103679 | 360 | 0.510934 |
a3d3652391aca6bc7ecc488069329c58736eb71f | 1,286 | py | Python | roles/slurm/files/startnode.py | danhnguyen48/slurm-elastic-computing | 0793cf23677169a6d9dceea0793118bc00c0913e | [
"MIT"
] | null | null | null | roles/slurm/files/startnode.py | danhnguyen48/slurm-elastic-computing | 0793cf23677169a6d9dceea0793118bc00c0913e | [
"MIT"
] | null | null | null | roles/slurm/files/startnode.py | danhnguyen48/slurm-elastic-computing | 0793cf23677169a6d9dceea0793118bc00c0913e | [
"MIT"
] | null | null | null | #! /opt/cloud_sdk/bin/python
import asyncio
import logging
import subprocess
import sys
import citc_cloud
sys.excepthook = handle_exception
if __name__ == "__main__":
log = logging.getLogger("startnode")
log.setLevel(logging.INFO)
handler = logging.FileHandler('/var/log/slurm/elastic.log')
formatter = logging.Formatter('%(asctime)s %(name)-10s %(levelname)-8s %(message)s')
handler.setFormatter(formatter)
log.addHandler(handler)
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(main())
finally:
loop.close()
| 26.244898 | 122 | 0.694401 |
a3d474d2b653dcd5a9578ce3979ff7a04e191213 | 2,300 | py | Python | tests/pyre/components/component_class_registration_model.py | BryanRiel/pyre | 179359634a7091979cced427b6133dd0ec4726ea | [
"BSD-3-Clause"
] | null | null | null | tests/pyre/components/component_class_registration_model.py | BryanRiel/pyre | 179359634a7091979cced427b6133dd0ec4726ea | [
"BSD-3-Clause"
] | null | null | null | tests/pyre/components/component_class_registration_model.py | BryanRiel/pyre | 179359634a7091979cced427b6133dd0ec4726ea | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# michael a.g. avzis
# orthologue
# (c) 1998-2018 all rights reserved
#
"""
Verify that component registration interacts correctly with the pyre configurator model
"""
# access
# print(" -- importing pyre")
import pyre
# print(" -- done")
# main
if __name__ == "__main__":
test()
# end of file
| 22.772277 | 87 | 0.59913 |
a3d5083187f3606549524985d8222291ba30b943 | 4,199 | py | Python | tests/unit/transport/plugins/asyncssh/test_asyncssh_transport.py | carlmontanari/nssh | fa2277ea0b8fdb81de3064e1d48bad9264f0cd64 | [
"MIT"
] | 1 | 2020-02-09T17:43:43.000Z | 2020-02-09T17:43:43.000Z | tests/unit/transport/plugins/asyncssh/test_asyncssh_transport.py | carlmontanari/nssh | fa2277ea0b8fdb81de3064e1d48bad9264f0cd64 | [
"MIT"
] | null | null | null | tests/unit/transport/plugins/asyncssh/test_asyncssh_transport.py | carlmontanari/nssh | fa2277ea0b8fdb81de3064e1d48bad9264f0cd64 | [
"MIT"
] | null | null | null | import asyncio
from io import BytesIO
import pytest
from asyncssh.connection import SSHClientConnection
from asyncssh.stream import SSHReader
from scrapli.exceptions import ScrapliConnectionNotOpened, ScrapliTimeout
def test_write(asyncssh_transport):
asyncssh_transport.stdin = BytesIO()
asyncssh_transport.write(b"blah")
asyncssh_transport.stdin.seek(0)
assert asyncssh_transport.stdin.read() == b"blah"
def test_write_exception(asyncssh_transport):
with pytest.raises(ScrapliConnectionNotOpened):
asyncssh_transport.write("blah")
| 28.958621 | 96 | 0.740414 |
a3d571f1fc3a63903055bc9efe42eada3f2c5310 | 3,699 | py | Python | apps/ignite/views.py | Mozilla-GitHub-Standards/93f18f14efcf5fdfc0e04f9bf247f66baf46663f37b1d2087ab8d850abc90803 | 4e374b4d52dfb9039ebe543e7f27682189022307 | [
"BSD-3-Clause"
] | 2 | 2015-04-06T15:20:29.000Z | 2016-12-30T12:25:11.000Z | apps/ignite/views.py | Mozilla-GitHub-Standards/93f18f14efcf5fdfc0e04f9bf247f66baf46663f37b1d2087ab8d850abc90803 | 4e374b4d52dfb9039ebe543e7f27682189022307 | [
"BSD-3-Clause"
] | 2 | 2019-02-17T17:38:02.000Z | 2019-03-28T03:49:16.000Z | apps/ignite/views.py | Mozilla-GitHub-Standards/93f18f14efcf5fdfc0e04f9bf247f66baf46663f37b1d2087ab8d850abc90803 | 4e374b4d52dfb9039ebe543e7f27682189022307 | [
"BSD-3-Clause"
] | 1 | 2019-03-28T03:49:18.000Z | 2019-03-28T03:49:18.000Z | from django.shortcuts import get_object_or_404
import jingo
import waffle
from django.contrib.auth.models import User
from challenges.models import Submission, Category
from projects.models import Project
from blogs.models import BlogEntry
from events.models import Event
def splash(request, project, slug, template_name='ignite/splash.html'):
"""Show an individual project challenge."""
project = get_object_or_404(Project, slug=project)
challenge = get_object_or_404(project.challenge_set, slug=slug)
num_blogs = 3
# have we announced the winners yet - switch template
if waffle.switch_is_active('announce_winners'):
template_name = 'ignite/homepage-winners.html'
num_blogs = 5
blogs = BlogEntry.objects.filter(
page='splash'
).order_by("-updated",)[:num_blogs]
# if the dev challenge is open we want to only show dev entries
if request.development.is_open:
entries = (Submission.objects.visible()
.filter(phase__challenge=challenge)
.filter(phase__name="Development")
.order_by("?"))
num_entries = len(entries)
entries_from = 'apps'
if num_entries < 5:
entries = (Submission.objects.visible()
.filter(phase__challenge=challenge)
.filter(phase__name="Ideation")
.order_by("?"))
entries_from = 'ideas'
else:
entries = (Submission.objects.visible()
.filter(phase__challenge=challenge)
.filter(phase__name="Ideation")
.order_by("?"))
entries_from = 'ideas'
event_list = Event.objects.get_featured()[:5]
return jingo.render(request, template_name, {
'challenge': challenge,
'project': project,
'phases': list(enumerate(challenge.phases.all(), start=1)),
'entries': entries[:5],
'categories': Category.objects.all(),
'blogs': blogs,
'event_list': event_list,
'entries_from': entries_from,
})
def judges(request, project, slug, template_name='challenges/all_judges.html'):
""" List all judges we have in the system """
profiles = []
for judge in User.objects.filter(groups__name='Judges'):
profile = judge.get_profile()
# we only want to show featured profiles
if profile.featured == True:
profiles.append(profile)
return jingo.render(request, 'ignite/judges.html', {
'profiles': profiles
})
def action_unavailable_response(request, message=None,
template_name="action_unavailable.html"):
"""Generic page for unavailable actions"""
context = {'message': message}
return jingo.render(request, template_name, context, status=403)
| 36.99 | 104 | 0.638821 |
a3d593a4708a16249302174780a07f2fdc88109b | 664 | py | Python | dataPresenter.py | thebouv/IUS-Hacktoberfest | 084634ec2feff3e81862d85b3938e1ae2c5aadff | [
"MIT"
] | 3 | 2019-09-30T18:25:12.000Z | 2019-10-01T21:47:41.000Z | dataPresenter.py | thebouv/IUS-Hacktoberfest | 084634ec2feff3e81862d85b3938e1ae2c5aadff | [
"MIT"
] | 3 | 2019-09-27T22:44:34.000Z | 2019-10-09T17:00:37.000Z | dataPresenter.py | thebouv/IUS-Hacktoberfest | 084634ec2feff3e81862d85b3938e1ae2c5aadff | [
"MIT"
] | 6 | 2019-09-28T04:17:16.000Z | 2019-10-08T18:47:26.000Z | from plotly.subplots import make_subplots
import plotly.graph_objects as go
import plotly.io as pio
from dataProcessor import parseLabels, parseLangs
import plotly.io as pio
import os
years = parseLabels()
langs = parseLangs()
#make the plotly results
fig = make_subplots(
rows=1, cols=2,
specs=[[{"type": "xy"}, {"type": "domain"}]],
)
fig.add_trace(go.Bar(y = list(langs.values()), x = list(langs.keys()), showlegend=False),
row=1, col=1)
fig.add_trace(go.Pie(values = list(years.values()), labels = list(years.keys())),
row=1, col=2)
fig.update_layout(height=600)
pio.write_html(fig, 'index.html', auto_open=True)
| 22.133333 | 89 | 0.680723 |
a3d6b9ef2efd18b552dbe05895fafd84b7430c25 | 17,209 | py | Python | bdlb/diabetic_retinopathy_diagnosis/benchmark.py | Sairam954/bdl-benchmarks | 6fbc855ca51403ad8f64b6be30ed92f6118c6cae | [
"Apache-2.0"
] | 666 | 2019-06-14T17:14:05.000Z | 2022-03-24T10:48:47.000Z | bdlb/diabetic_retinopathy_diagnosis/benchmark.py | Sairam954/bdl-benchmarks | 6fbc855ca51403ad8f64b6be30ed92f6118c6cae | [
"Apache-2.0"
] | 12 | 2019-06-26T16:54:14.000Z | 2020-08-18T13:16:01.000Z | bdlb/diabetic_retinopathy_diagnosis/benchmark.py | Sairam954/bdl-benchmarks | 6fbc855ca51403ad8f64b6be30ed92f6118c6cae | [
"Apache-2.0"
] | 97 | 2019-06-14T20:30:39.000Z | 2022-02-05T08:33:49.000Z | # Copyright 2019 BDL Benchmarks Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Diabetic retinopathy diagnosis BDL Benchmark."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import os
from typing import Callable
from typing import Dict
from typing import Optional
from typing import Sequence
from typing import Text
from typing import Tuple
from typing import Union
import numpy as np
import pandas as pd
import tensorflow as tf
from absl import logging
from ..core import transforms
from ..core.benchmark import Benchmark
from ..core.benchmark import BenchmarkInfo
from ..core.benchmark import DataSplits
from ..core.constants import DATA_DIR
from ..core.levels import Level
tfk = tf.keras
_DIABETIC_RETINOPATHY_DIAGNOSIS_DATA_DIR = os.path.join(
DATA_DIR, "downloads", "manual", "diabetic_retinopathy_diagnosis")
| 34.625755 | 92 | 0.658609 |
a3d6f97d9d98a31dc4f2829ae746920be2ea8e17 | 4,902 | py | Python | pysnmp-with-texts/CXConsoleDriver-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 8 | 2019-05-09T17:04:00.000Z | 2021-06-09T06:50:51.000Z | pysnmp-with-texts/CXConsoleDriver-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 4 | 2019-05-31T16:42:59.000Z | 2020-01-31T21:57:17.000Z | pysnmp-with-texts/CXConsoleDriver-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module CXConsoleDriver-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXConsoleDriver-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:32:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion")
cxConsoleDriver, = mibBuilder.importSymbols("CXProduct-SMI", "cxConsoleDriver")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Counter64, Gauge32, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, Unsigned32, Integer32, ModuleIdentity, NotificationType, ObjectIdentity, MibIdentifier, Counter32, iso, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Gauge32", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "Unsigned32", "Integer32", "ModuleIdentity", "NotificationType", "ObjectIdentity", "MibIdentifier", "Counter32", "iso", "Bits")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
cxCdBaudRate = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 6, 1), Integer32().clone(9600)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCdBaudRate.setStatus('mandatory')
if mibBuilder.loadTexts: cxCdBaudRate.setDescription('Determines the baud rate of the console port. The setting of this object is dynamic. The console port immediately implements the option you enter. Options: 9600 19200 38400 115200 Default Value: 9600 Configuration Changed: operative')
cxCdCharSize = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 6, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(7, 8)).clone(8)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCdCharSize.setStatus('mandatory')
if mibBuilder.loadTexts: cxCdCharSize.setDescription('Determines how many bits constitute a character for the console port. Options: none - the value is fixed at 8 Default Value: 8 Configuration Changed: none ')
cxCdParity = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 6, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("noParity", 1), ("evenParity", 2), ("oddParity", 3))).clone('noParity')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCdParity.setStatus('mandatory')
if mibBuilder.loadTexts: cxCdParity.setDescription('Determines the parity scheme the CPU uses to validate the characters it receives through the console port. Options: none - the value is fixed at noParity Default Value: noParity Configuration Changed: none ')
cxCdStopBit = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 6, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCdStopBit.setStatus('mandatory')
if mibBuilder.loadTexts: cxCdStopBit.setDescription('Determines how many stop bits are at the end of each character the console port receives. Options: none - the value is fixed at 1 Default Value: 1 Configuration Changed: none ')
cxCdProtocol = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 6, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("localConsole", 1), ("ppp", 2))).clone('localConsole')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCdProtocol.setStatus('mandatory')
if mibBuilder.loadTexts: cxCdProtocol.setDescription('Determines the protocol (configuration method) for the console port. The setting of this object is dynamic. The console port immediately implements the option you enter. However, if you change the protocol you are currently using to configure the port your connection will be lost. Options: localConsole (1): you use this protocol when you attach a TTY terminal directly to the console port. This protocol requires you to use command line configuration. You also must enter a password to gain access to the configuration tables. You can define the password using the object uiPassword of the CXUserInterface Table. ppp (2): you use this protocol when you are configuring via a windows-based application such as HP/OV (Hewlett Packard-OpenView). Default Value: ppp (2) Configuration Changed: operative')
mibBuilder.exportSymbols("CXConsoleDriver-MIB", cxCdParity=cxCdParity, cxCdProtocol=cxCdProtocol, cxCdBaudRate=cxCdBaudRate, cxCdStopBit=cxCdStopBit, cxCdCharSize=cxCdCharSize)
| 158.129032 | 856 | 0.786006 |
a3d7408e9bd4e19d03c2fd8dc2282dcab222a6b8 | 2,782 | py | Python | db/redis_db.py | Lifeistrange/WeiboSpider | 8aa3465487ef64bb6e9bb4bd503f182a1b38c292 | [
"MIT"
] | 1 | 2018-07-23T03:58:53.000Z | 2018-07-23T03:58:53.000Z | db/redis_db.py | 545314690/WeiboSpider-1.6.4 | d29cc9b926da5790768ddebdfdf9bf6c617a0e03 | [
"MIT"
] | null | null | null | db/redis_db.py | 545314690/WeiboSpider-1.6.4 | d29cc9b926da5790768ddebdfdf9bf6c617a0e03 | [
"MIT"
] | 2 | 2018-06-25T09:21:24.000Z | 2018-07-23T03:59:31.000Z | # coding:utf-8
import datetime
import json
import re
import redis
from config.conf import get_redis_args
redis_args = get_redis_args()
| 36.12987 | 103 | 0.611431 |
a3d75ce424bf88d4d06c99b804df0f846b952cac | 1,873 | py | Python | vivisect/storage/mpfile.py | vEpiphyte/vivisect | 14947a53c6781175f0aa83d49cc16c524a2e23a3 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | vivisect/storage/mpfile.py | vEpiphyte/vivisect | 14947a53c6781175f0aa83d49cc16c524a2e23a3 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | vivisect/storage/mpfile.py | vEpiphyte/vivisect | 14947a53c6781175f0aa83d49cc16c524a2e23a3 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | import base64
import logging
import msgpack
logger = logging.getLogger(__name__)
loadargs = {'use_list': False, 'raw': False}
if msgpack.version < (1, 0, 0):
loadargs['encoding'] = 'utf-8'
else:
loadargs['strict_map_key'] = False
VSIG = b'MSGVIV'.ljust(8, b'\x00')
| 28.815385 | 81 | 0.599573 |
a3d771361889efe007b26f62c7cd92ffc6f656a2 | 3,832 | py | Python | pytest_pgsql/plugin.py | mathiasose/pytest-pgsql | 5e076db146699c3b683b49e4a31323c4c23054de | [
"BSD-3-Clause"
] | null | null | null | pytest_pgsql/plugin.py | mathiasose/pytest-pgsql | 5e076db146699c3b683b49e4a31323c4c23054de | [
"BSD-3-Clause"
] | null | null | null | pytest_pgsql/plugin.py | mathiasose/pytest-pgsql | 5e076db146699c3b683b49e4a31323c4c23054de | [
"BSD-3-Clause"
] | null | null | null | """This forms the core of the pytest plugin."""
import pytest
import testing.postgresql
from pytest_pgsql import database
from pytest_pgsql import ext
def pytest_addoption(parser):
"""Add configuration options for pytest_pgsql."""
parser.addoption(
'--pg-extensions', action='store', default='',
help="A comma-separated list of PostgreSQL extensions to install at "
"the beginning of the session for use by all tests. Example: "
"--pg-extensions=uuid-ossp,pg_tgrm,pgcrypto")
parser.addoption(
'--pg-work-mem', type=int, default=32,
help='Set the value of the `work_mem` setting, in megabytes. '
'`pytest_pgsql` defaults to 32. Adjusting this up or down can '
'help performance; see the Postgres documentation for more details.')
parser.addoption(
'--pg-conf-opt', action='append',
help='Add a key=value line that will be appended to postgresql.conf')
#: A SQLAlchemy engine shared by the transacted and non-transacted database fixtures.
#:
#: .. seealso:: `pytest_pgsql.ext.create_engine_fixture`
# pylint: disable=invalid-name
pg_engine = ext.create_engine_fixture('pg_engine', scope='session')
# pylint: enable=invalid-name
# pylint: disable=invalid-name
#: Create a test database instance and cleans up after each test finishes.
#:
#: You should prefer the `transacted_postgresql_db` fixture unless your test
#: cannot be run in a single transaction. The `transacted_postgresql_db` fixture
#: leads to faster tests since it doesn't tear down the entire database between
#: each test.
postgresql_db = \
database.PostgreSQLTestDB.create_fixture('postgresql_db')
#: Create a test database instance that rolls back the current transaction after
#: each test finishes, verifying its integrity before returning.
#:
#: Read the warning in the main documentation page before using this fixture.
transacted_postgresql_db = \
database.TransactedPostgreSQLTestDB.create_fixture('transacted_postgresql_db')
# pylint: enable=invalid-name
| 35.813084 | 85 | 0.675626 |
a3d816c8c07445ebc9580d3703129a46fcf2cc64 | 737 | py | Python | power_data_to_sat_passes/date_utils.py | abrahamneben/orbcomm_beam_mapping | 71b3e7d6e4214db0a6f4e68ebeeb7d7f846f5004 | [
"MIT"
] | 1 | 2019-04-10T02:50:19.000Z | 2019-04-10T02:50:19.000Z | power_data_to_sat_passes/date_utils.py | abrahamneben/orbcomm_beam_mapping | 71b3e7d6e4214db0a6f4e68ebeeb7d7f846f5004 | [
"MIT"
] | null | null | null | power_data_to_sat_passes/date_utils.py | abrahamneben/orbcomm_beam_mapping | 71b3e7d6e4214db0a6f4e68ebeeb7d7f846f5004 | [
"MIT"
] | null | null | null | # written by abraham on aug 24
| 27.296296 | 89 | 0.72863 |
a3d8391391013bac7dd77afd2eebf78925078f05 | 752 | py | Python | app/base/count_lines.py | sourcery-ai-bot/personal-expenses-accounting | 55e76744a06fd502d119f57427cd7a0bfaf68fe1 | [
"MIT"
] | 5 | 2020-02-21T16:26:21.000Z | 2021-08-05T09:34:28.000Z | app/base/count_lines.py | sourcery-ai-bot/personal-expenses-accounting | 55e76744a06fd502d119f57427cd7a0bfaf68fe1 | [
"MIT"
] | 11 | 2020-06-26T09:05:04.000Z | 2022-01-24T20:35:07.000Z | app/base/count_lines.py | sourcery-ai-bot/personal-expenses-accounting | 55e76744a06fd502d119f57427cd7a0bfaf68fe1 | [
"MIT"
] | 1 | 2021-06-25T09:42:08.000Z | 2021-06-25T09:42:08.000Z | import glob
from os import walk
exclude_folders = [
'node_modules',
'ios',
'android',
'__pycache__'
]
exclude_files = [
'json',
'txt',
'traineddata',
'lstmf',
'yml',
'md'
'log',
'env',
'gitignore',
'dockerignore'
]
# get all files in directory
dirr = '/home/viktor/Documents/personal-expenses-accounting/app/services/web_service/'
folders = glob.glob(dirr + '/**/', recursive=True)
# only app related directories
directories = []
for folder in folders:
current_folder = folder.split('/')[-2]
if current_folder not in exclude_folders:
files = glob.glob(folder + '*')
print(files)
directories.append(folder)
# num_lines = sum(1 for line in open('myfile.txt'))
| 19.282051 | 86 | 0.625 |
a3d86cad8d3203300d44bd218c5b17bca9639482 | 409 | py | Python | data/contacts.py | rgurevych/python_for_testers | 04023a5d6ea480f7828aa56e8a4094b744e05721 | [
"Apache-2.0"
] | null | null | null | data/contacts.py | rgurevych/python_for_testers | 04023a5d6ea480f7828aa56e8a4094b744e05721 | [
"Apache-2.0"
] | null | null | null | data/contacts.py | rgurevych/python_for_testers | 04023a5d6ea480f7828aa56e8a4094b744e05721 | [
"Apache-2.0"
] | null | null | null |
from models.contact import Contact
testdata = [Contact(first_name="Firstname", last_name="Lastname", mobile_phone="+12345678",
work_phone="12345", home_phone="67890", fax="55443322", email_1="email_1@email.com",
email_2="email_2@email.com", email_3="email_3@email.com",
address="Street, 15 \n 12345 New-York")]
| 51.125 | 116 | 0.577017 |
a3d89936d8b1b9966571e7248379800a7bb8190c | 17,617 | py | Python | charmhelpers/contrib/charmsupport/nrpe.py | nobuto-m/charm-helpers | 4cffc05ace43234d34b040cccdde3460f68cb673 | [
"Apache-2.0"
] | null | null | null | charmhelpers/contrib/charmsupport/nrpe.py | nobuto-m/charm-helpers | 4cffc05ace43234d34b040cccdde3460f68cb673 | [
"Apache-2.0"
] | 1 | 2019-09-04T12:17:17.000Z | 2019-09-04T12:17:17.000Z | charmhelpers/contrib/charmsupport/nrpe.py | nobuto-m/charm-helpers | 4cffc05ace43234d34b040cccdde3460f68cb673 | [
"Apache-2.0"
] | null | null | null | # Copyright 2014-2015 Canonical Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Compatibility with the nrpe-external-master charm"""
# Copyright 2012 Canonical Ltd.
#
# Authors:
# Matthew Wedgwood <matthew.wedgwood@canonical.com>
import subprocess
import pwd
import grp
import os
import glob
import shutil
import re
import shlex
import yaml
from charmhelpers.core.hookenv import (
config,
hook_name,
local_unit,
log,
relation_get,
relation_ids,
relation_set,
relations_of_type,
)
from charmhelpers.core.host import service
from charmhelpers.core import host
# This module adds compatibility with the nrpe-external-master and plain nrpe
# subordinate charms. To use it in your charm:
#
# 1. Update metadata.yaml
#
# provides:
# (...)
# nrpe-external-master:
# interface: nrpe-external-master
# scope: container
#
# and/or
#
# provides:
# (...)
# local-monitors:
# interface: local-monitors
# scope: container
#
# 2. Add the following to config.yaml
#
# nagios_context:
# default: "juju"
# type: string
# description: |
# Used by the nrpe subordinate charms.
# A string that will be prepended to instance name to set the host name
# in nagios. So for instance the hostname would be something like:
# juju-myservice-0
# If you're running multiple environments with the same services in them
# this allows you to differentiate between them.
# nagios_servicegroups:
# default: ""
# type: string
# description: |
# A comma-separated list of nagios servicegroups.
# If left empty, the nagios_context will be used as the servicegroup
#
# 3. Add custom checks (Nagios plugins) to files/nrpe-external-master
#
# 4. Update your hooks.py with something like this:
#
# from charmsupport.nrpe import NRPE
# (...)
# def update_nrpe_config():
# nrpe_compat = NRPE()
# nrpe_compat.add_check(
# shortname = "myservice",
# description = "Check MyService",
# check_cmd = "check_http -w 2 -c 10 http://localhost"
# )
# nrpe_compat.add_check(
# "myservice_other",
# "Check for widget failures",
# check_cmd = "/srv/myapp/scripts/widget_check"
# )
# nrpe_compat.write()
#
# def config_changed():
# (...)
# update_nrpe_config()
#
# def nrpe_external_master_relation_changed():
# update_nrpe_config()
#
# def local_monitors_relation_changed():
# update_nrpe_config()
#
# 4.a If your charm is a subordinate charm set primary=False
#
# from charmsupport.nrpe import NRPE
# (...)
# def update_nrpe_config():
# nrpe_compat = NRPE(primary=False)
#
# 5. ln -s hooks.py nrpe-external-master-relation-changed
# ln -s hooks.py local-monitors-relation-changed
def get_nagios_hostcontext(relation_name='nrpe-external-master'):
"""
Query relation with nrpe subordinate, return the nagios_host_context
:param str relation_name: Name of relation nrpe sub joined to
"""
for rel in relations_of_type(relation_name):
if 'nagios_host_context' in rel:
return rel['nagios_host_context']
def get_nagios_hostname(relation_name='nrpe-external-master'):
"""
Query relation with nrpe subordinate, return the nagios_hostname
:param str relation_name: Name of relation nrpe sub joined to
"""
for rel in relations_of_type(relation_name):
if 'nagios_hostname' in rel:
return rel['nagios_hostname']
def get_nagios_unit_name(relation_name='nrpe-external-master'):
"""
Return the nagios unit name prepended with host_context if needed
:param str relation_name: Name of relation nrpe sub joined to
"""
host_context = get_nagios_hostcontext(relation_name)
if host_context:
unit = "%s:%s" % (host_context, local_unit())
else:
unit = local_unit()
return unit
def add_init_service_checks(nrpe, services, unit_name, immediate_check=True):
"""
Add checks for each service in list
:param NRPE nrpe: NRPE object to add check to
:param list services: List of services to check
:param str unit_name: Unit name to use in check description
:param bool immediate_check: For sysv init, run the service check immediately
"""
for svc in services:
# Don't add a check for these services from neutron-gateway
if svc in ['ext-port', 'os-charm-phy-nic-mtu']:
next
upstart_init = '/etc/init/%s.conf' % svc
sysv_init = '/etc/init.d/%s' % svc
if host.init_is_systemd():
nrpe.add_check(
shortname=svc,
description='process check {%s}' % unit_name,
check_cmd='check_systemd.py %s' % svc
)
elif os.path.exists(upstart_init):
nrpe.add_check(
shortname=svc,
description='process check {%s}' % unit_name,
check_cmd='check_upstart_job %s' % svc
)
elif os.path.exists(sysv_init):
cronpath = '/etc/cron.d/nagios-service-check-%s' % svc
checkpath = '%s/service-check-%s.txt' % (nrpe.homedir, svc)
croncmd = (
'/usr/local/lib/nagios/plugins/check_exit_status.pl '
'-e -s /etc/init.d/%s status' % svc
)
cron_file = '*/5 * * * * root %s > %s\n' % (croncmd, checkpath)
f = open(cronpath, 'w')
f.write(cron_file)
f.close()
nrpe.add_check(
shortname=svc,
description='service check {%s}' % unit_name,
check_cmd='check_status_file.py -f %s' % checkpath,
)
# if /var/lib/nagios doesn't exist open(checkpath, 'w') will fail
# (LP: #1670223).
if immediate_check and os.path.isdir(nrpe.homedir):
f = open(checkpath, 'w')
subprocess.call(
croncmd.split(),
stdout=f,
stderr=subprocess.STDOUT
)
f.close()
os.chmod(checkpath, 0o644)
def copy_nrpe_checks(nrpe_files_dir=None):
"""
Copy the nrpe checks into place
"""
NAGIOS_PLUGINS = '/usr/local/lib/nagios/plugins'
if nrpe_files_dir is None:
# determine if "charmhelpers" is in CHARMDIR or CHARMDIR/hooks
for segment in ['.', 'hooks']:
nrpe_files_dir = os.path.abspath(os.path.join(
os.getenv('CHARM_DIR'),
segment,
'charmhelpers',
'contrib',
'openstack',
'files'))
if os.path.isdir(nrpe_files_dir):
break
else:
raise RuntimeError("Couldn't find charmhelpers directory")
if not os.path.exists(NAGIOS_PLUGINS):
os.makedirs(NAGIOS_PLUGINS)
for fname in glob.glob(os.path.join(nrpe_files_dir, "check_*")):
if os.path.isfile(fname):
shutil.copy2(fname,
os.path.join(NAGIOS_PLUGINS, os.path.basename(fname)))
def add_haproxy_checks(nrpe, unit_name):
"""
Add checks for each service in list
:param NRPE nrpe: NRPE object to add check to
:param str unit_name: Unit name to use in check description
"""
nrpe.add_check(
shortname='haproxy_servers',
description='Check HAProxy {%s}' % unit_name,
check_cmd='check_haproxy.sh')
nrpe.add_check(
shortname='haproxy_queue',
description='Check HAProxy queue depth {%s}' % unit_name,
check_cmd='check_haproxy_queue_depth.sh')
| 36.174538 | 90 | 0.605097 |
a3d9e6ada4265efd73113dc71c68649cc06c25fa | 13,250 | py | Python | venv/Lib/site-packages/proglog/proglog.py | mintzer/pupillometry-rf-back | cfa86fa984a49dce0123798f8de5b838c02e10d5 | [
"CC-BY-4.0"
] | 83 | 2017-08-14T02:20:38.000Z | 2022-03-01T20:32:03.000Z | venv/lib/python3.7/site-packages/proglog/proglog.py | haideraltahan/CropMe | 75a111b9d3b2c50c6f2a9a36d21432053f02284d | [
"MIT"
] | 20 | 2021-05-03T18:02:23.000Z | 2022-03-12T12:01:04.000Z | venv/lib/python3.7/site-packages/proglog/proglog.py | haideraltahan/CropMe | 75a111b9d3b2c50c6f2a9a36d21432053f02284d | [
"MIT"
] | 6 | 2018-10-23T08:12:26.000Z | 2021-02-14T13:53:13.000Z | """Implements the generic progress logger class, and the ProgressBar class.
"""
from tqdm import tqdm, tqdm_notebook
from collections import OrderedDict
import time
SETTINGS = {
'notebook': False
}
def default_bar_logger(logger, bars=None, ignored_bars=None, logged_bars='all',
min_time_interval=0, ignore_bars_under=0):
if logger == 'bar':
return TqdmProgressBarLogger(
bars=bars,
ignored_bars=ignored_bars,
logged_bars=logged_bars,
min_time_interval=min_time_interval,
ignore_bars_under=ignore_bars_under
)
elif logger is None:
return MuteProgressBarLogger()
else:
return logger
| 33.80102 | 79 | 0.568981 |
a3d9f04c9618b248a5e94c0c7319362fccd10a9f | 665 | py | Python | gdsfactory/tests/test_component_from_yaml_bezier.py | jorgepadilla19/gdsfactory | 68e1c18257a75d4418279851baea417c8899a165 | [
"MIT"
] | 42 | 2020-05-25T09:33:45.000Z | 2022-03-29T03:41:19.000Z | gdsfactory/tests/test_component_from_yaml_bezier.py | jorgepadilla19/gdsfactory | 68e1c18257a75d4418279851baea417c8899a165 | [
"MIT"
] | 133 | 2020-05-28T18:29:04.000Z | 2022-03-31T22:21:42.000Z | gdsfactory/tests/test_component_from_yaml_bezier.py | jorgepadilla19/gdsfactory | 68e1c18257a75d4418279851baea417c8899a165 | [
"MIT"
] | 17 | 2020-06-30T07:07:50.000Z | 2022-03-17T15:45:27.000Z | import gdsfactory as gf
from gdsfactory.component import Component
yaml = """
name:
test_component_yaml_without_cell
instances:
mmi:
component: mmi1x2
bend:
component: bend_s
connections:
bend,o1: mmi,o2
"""
def test_component_from_yaml_without_cell() -> Component:
"""bezier does not have cell"""
c = gf.read.from_yaml(yaml)
assert c.name == "test_component_yaml_without_cell", c.name
assert len(c.get_dependencies()) == 2, len(c.get_dependencies())
assert len(c.ports) == 0, len(c.ports)
return c
if __name__ == "__main__":
c = test_component_from_yaml_without_cell()
print(c.name)
c.show()
| 20.151515 | 68 | 0.682707 |
a3da86d4ce645eeb7110c2f1c12a4c42e43e9f77 | 2,681 | py | Python | cats/types.py | AdamBrianBright/cats-python | 163cbde06c0d56520c217c0d66ddca34c7e0f63b | [
"MIT"
] | 2 | 2021-10-04T05:39:03.000Z | 2021-10-07T06:44:19.000Z | cats/types.py | AdamBrianBright/cats-python | 163cbde06c0d56520c217c0d66ddca34c7e0f63b | [
"MIT"
] | 7 | 2021-08-17T17:50:23.000Z | 2021-08-31T08:44:13.000Z | cats/types.py | AdamBrianBright/cats-python | 163cbde06c0d56520c217c0d66ddca34c7e0f63b | [
"MIT"
] | 2 | 2021-10-01T20:58:25.000Z | 2021-10-04T05:40:35.000Z | from pathlib import Path
from types import GeneratorType
from typing import AsyncIterable, Iterable, TypeAlias
import ujson
from cats.errors import MalformedHeadersError
try:
from django.db.models import QuerySet, Model
except ImportError:
QuerySet = type('QuerySet', (list,), {})
Model = type('Model', (list,), {})
__all__ = [
'Bytes',
'BytesGen',
'BytesAsyncGen',
'BytesAnyGen',
'Byte',
'Json',
'File',
'List',
'Missing',
'MISSING',
'QuerySet',
'Model',
'T_Headers',
'Headers',
]
Bytes: TypeAlias = bytes | bytearray | memoryview
BytesGen: TypeAlias = Iterable[Bytes]
BytesAsyncGen: TypeAlias = AsyncIterable[Bytes]
BytesAnyGen: TypeAlias = BytesGen | BytesAsyncGen
Byte: TypeAlias = Bytes
Json: TypeAlias = str | int | float | dict | list | bool | None
File: TypeAlias = Path | str
List = list | tuple | set | GeneratorType | QuerySet
MISSING = Missing()
T_Headers: TypeAlias = Headers | dict[str]
| 25.056075 | 98 | 0.631481 |
a3dad87fce4f18faf3a3d29b5cefbd7b89d614d5 | 384 | py | Python | raven/utils/urlparse.py | MyCollege/raven | 9447f3a55ae7703afe84c3493625e3c3fb700700 | [
"BSD-3-Clause"
] | null | null | null | raven/utils/urlparse.py | MyCollege/raven | 9447f3a55ae7703afe84c3493625e3c3fb700700 | [
"BSD-3-Clause"
] | null | null | null | raven/utils/urlparse.py | MyCollege/raven | 9447f3a55ae7703afe84c3493625e3c3fb700700 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
try:
import urlparse as _urlparse
except ImportError:
from urllib import parse as _urlparse
urlparse = _urlparse.urlparse
| 22.588235 | 74 | 0.708333 |
a3db35b8c7d191b6f652e750b697cd40a1dc6c0c | 516 | py | Python | setup.py | stjordanis/MONeT-1 | 98a5c7d149ca19c8c64069dbd8f27ce7f97bf3af | [
"MIT"
] | 161 | 2020-10-28T02:21:50.000Z | 2022-03-11T05:06:16.000Z | setup.py | stjordanis/MONeT-1 | 98a5c7d149ca19c8c64069dbd8f27ce7f97bf3af | [
"MIT"
] | 4 | 2020-10-28T02:27:43.000Z | 2021-03-31T00:04:43.000Z | setup.py | stjordanis/MONeT-1 | 98a5c7d149ca19c8c64069dbd8f27ce7f97bf3af | [
"MIT"
] | 15 | 2020-10-28T02:32:12.000Z | 2021-12-23T13:20:23.000Z | import setuptools
setuptools.setup(
name="monet_memory_optimized_training",
version="0.0.1",
description="Memory Optimized Network Training Framework",
url="https://github.com/philkr/lowrank_conv",
packages=setuptools.find_packages(include = ['monet', 'monet.*', 'models', 'checkmate', 'gist']),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
)
| 32.25 | 101 | 0.655039 |
a3db4ad6c588be26e30297068925d6bff9a900d1 | 5,616 | py | Python | Tests/Methods/Machine/test_Magnet_Type_11_meth.py | Superomeg4/pyleecan | 2b695b5f39e77475a07aa0ea89489fb0a9659337 | [
"Apache-2.0"
] | 2 | 2020-06-29T13:48:37.000Z | 2021-06-15T07:34:05.000Z | Tests/Methods/Machine/test_Magnet_Type_11_meth.py | Superomeg4/pyleecan | 2b695b5f39e77475a07aa0ea89489fb0a9659337 | [
"Apache-2.0"
] | null | null | null | Tests/Methods/Machine/test_Magnet_Type_11_meth.py | Superomeg4/pyleecan | 2b695b5f39e77475a07aa0ea89489fb0a9659337 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
@date Created on Thu Dec 18 13:56:33 2014
@copyright (C) 2014-2015 EOMYS ENGINEERING.
@author pierre_b
"""
from unittest import TestCase
from ddt import ddt, data
from pyleecan.Classes.Arc1 import Arc1
from pyleecan.Classes.Segment import Segment
from pyleecan.Classes.MagnetType11 import MagnetType11
from pyleecan.Classes.LamSlotMag import LamSlotMag
from pyleecan.Classes.SlotMPolar import SlotMPolar
from numpy import pi, exp, angle, array
from pyleecan.Methods.Machine.Magnet.comp_surface import comp_surface
Mag11_test = list()
# Internal Slot surface
lam = LamSlotMag(is_internal=True, Rext=0.5)
lam.slot = SlotMPolar(H0=0, W0=pi / 4, Zs=4)
lam.slot.magnet = [MagnetType11(Hmag=1, Wmag=pi / 4)]
Mag11_test.append({"test_obj": lam, "S_exp": 0.78539616, "Ao": pi / 4, "H_exp": 1})
# Internal Slot inset
lam = LamSlotMag(is_internal=True, Rext=0.5)
lam.slot = SlotMPolar(H0=40e-3, W0=pi / 4, Zs=4)
lam.slot.magnet = [MagnetType11(Hmag=20e-3, Wmag=pi / 4)]
Mag11_test.append({"test_obj": lam, "S_exp": 7.3827e-3, "Ao": pi / 4, "H_exp": 20e-3})
# Outward Slot inset
lam = LamSlotMag(is_internal=False, Rext=0.1325)
lam.slot = SlotMPolar(H0=5e-3, W0=pi / 10, Zs=8)
lam.slot.magnet = [MagnetType11(Hmag=8e-3, Wmag=pi / 12)]
Mag11_test.append({"test_obj": lam, "S_exp": 2.09439e-6, "Ao": pi / 12, "H_exp": 8e-3})
# For AlmostEqual
DELTA = 1e-4
| 33.035294 | 87 | 0.579238 |
a3db7f4c59462c81c92a9534466aa08adc11bb16 | 4,600 | py | Python | tomo_encoders/tasks/void_mapping.py | arshadzahangirchowdhury/TomoEncoders | 9c2b15fd515d864079f198546821faee5d78df17 | [
"BSD-3-Clause"
] | null | null | null | tomo_encoders/tasks/void_mapping.py | arshadzahangirchowdhury/TomoEncoders | 9c2b15fd515d864079f198546821faee5d78df17 | [
"BSD-3-Clause"
] | null | null | null | tomo_encoders/tasks/void_mapping.py | arshadzahangirchowdhury/TomoEncoders | 9c2b15fd515d864079f198546821faee5d78df17 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
from operator import mod
from tomo_encoders.misc.voxel_processing import modified_autocontrast, TimerGPU
from tomo_encoders.reconstruction.recon import recon_patches_3d
import cupy as cp
import numpy as np
from skimage.filters import threshold_otsu
from tomo_encoders import Grid
def segment_otsu(vol, s = 0.05):
'''segment volume with otsu'''
timer = TimerGPU()
timer.tic()
tmp_values = vol[::4,::4,::4].get()
# rec_min_max = modified_autocontrast(tmp_values, s = s, normalize_sampling_factor=1)
thresh = cp.float32(threshold_otsu(tmp_values.reshape(-1)))
vol = (vol < thresh).astype(cp.uint8)
timer.toc("otsu thresholding")
return vol
def edge_map(Y):
'''
this algorithm was inspired by: https://github.com/tomochallenge/tomochallenge_utils/blob/master/foam_phantom_utils.py
'''
msk = cp.zeros_like(Y)
tmp = Y[:-1]!=Y[1:]
msk[:-1][tmp] = 1
msk[1:][tmp] = 1
tmp = Y[:,:-1]!=Y[:,1:]
msk[:,:-1][tmp] = 1
msk[:,1:][tmp] = 1
tmp = Y[:,:,:-1]!=Y[:,:,1:]
msk[:,:,:-1][tmp] = 1
msk[:,:,1:][tmp] = 1
return msk > 0
| 35.384615 | 122 | 0.62087 |
a3dc8e80c4d30f101894ef231d725a510807944b | 833 | py | Python | handypackages/subscribe/migrations/0001_initial.py | roundium/handypackages | b8a0e4952644144b31168f9a4ac8e743933d87c7 | [
"MIT"
] | 1 | 2019-07-31T11:40:06.000Z | 2019-07-31T11:40:06.000Z | handypackages/subscribe/migrations/0001_initial.py | roundium/handypackages | b8a0e4952644144b31168f9a4ac8e743933d87c7 | [
"MIT"
] | 10 | 2020-02-12T01:16:25.000Z | 2021-06-10T18:42:24.000Z | handypackages/subscribe/migrations/0001_initial.py | roundium/handypackages | b8a0e4952644144b31168f9a4ac8e743933d87c7 | [
"MIT"
] | 1 | 2019-07-31T11:40:18.000Z | 2019-07-31T11:40:18.000Z | # Generated by Django 2.2.1 on 2019-06-22 11:03
from django.db import migrations, models
| 29.75 | 114 | 0.57503 |
a3dd7fa87a5a13e38a56d66d0de7938491e30d3e | 793 | py | Python | TuShare/view/sh_margins.py | lwh2015/TuShare | f244e05e5cf208e18e6237d3b81f71f0d3c1394a | [
"MIT"
] | 1 | 2018-09-26T08:34:02.000Z | 2018-09-26T08:34:02.000Z | TuShare/view/sh_margins.py | lwh2015/TuShare | f244e05e5cf208e18e6237d3b81f71f0d3c1394a | [
"MIT"
] | null | null | null | TuShare/view/sh_margins.py | lwh2015/TuShare | f244e05e5cf208e18e6237d3b81f71f0d3c1394a | [
"MIT"
] | null | null | null | # -*- coding: UTF-8 -*-
import json
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import tushare as ts
from .publiceClass import DateEncoder
| 26.433333 | 76 | 0.596469 |
a3de3ec0c21d41a610e2d90e04c28f83ca0ba4c2 | 7,332 | py | Python | dbaas/tsuru/tests/test_service_add.py | didindinn/database-as-a-service | 747de31ff8546f7874ddd654af860e130afd17a0 | [
"BSD-3-Clause"
] | null | null | null | dbaas/tsuru/tests/test_service_add.py | didindinn/database-as-a-service | 747de31ff8546f7874ddd654af860e130afd17a0 | [
"BSD-3-Clause"
] | null | null | null | dbaas/tsuru/tests/test_service_add.py | didindinn/database-as-a-service | 747de31ff8546f7874ddd654af860e130afd17a0 | [
"BSD-3-Clause"
] | null | null | null | from mock import patch, MagicMock
from django.contrib.auth.models import User
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.utils.datastructures import MultiValueDictKeyError
from account.models import Role, Team, Organization
from physical.tests.factory import EnvironmentFactory, PlanFactory
from physical.models import Plan
| 30.17284 | 76 | 0.524686 |
a3dff7c9e786003c054a9ad079320e1b77c72f5f | 439 | py | Python | Main/migrations/0072_auto_20210506_0016.py | Muhammet-Yildiz/Ecommerce_Website-HepsiOrada | 91935014ccc37e0ea57c8cbd2c4891941dcbb917 | [
"MIT"
] | 10 | 2021-06-01T19:30:00.000Z | 2021-06-28T16:16:20.000Z | Main/migrations/0072_auto_20210506_0016.py | Muhammet-Yildiz/HepsiOrada | 91935014ccc37e0ea57c8cbd2c4891941dcbb917 | [
"MIT"
] | null | null | null | Main/migrations/0072_auto_20210506_0016.py | Muhammet-Yildiz/HepsiOrada | 91935014ccc37e0ea57c8cbd2c4891941dcbb917 | [
"MIT"
] | null | null | null | # Generated by Django 3.1.4 on 2021-05-05 21:16
from django.db import migrations
| 19.954545 | 47 | 0.567198 |
a3e04f191bacc2a7d80fcd1ad9bb0b6bdef01714 | 788 | py | Python | 1.py | zweed4u/dailycodingproblem | 6e40eaad347e283f86a11adeff01c6426211a0be | [
"MIT"
] | null | null | null | 1.py | zweed4u/dailycodingproblem | 6e40eaad347e283f86a11adeff01c6426211a0be | [
"MIT"
] | null | null | null | 1.py | zweed4u/dailycodingproblem | 6e40eaad347e283f86a11adeff01c6426211a0be | [
"MIT"
] | null | null | null | #!/usr/bin/python3
"""
Good morning! Here's your coding interview problem for today.
This problem was recently asked by Google.
Given a list of numbers and a number k, return whether any two numbers from the list add up to k.
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
Bonus: Can you do this in one pass?
"""
print(func([10, 15, 3, 7], 17))
| 26.266667 | 97 | 0.593909 |
a3e06ae8cd6e0aabca5915c1a17ae312a2a03a30 | 734 | py | Python | gryphon/data/template_scaffolding/template/setup.py | ow-gryphon/gryphon | 0b34f2f61a50af46b9d1ec1d3c15d53cf4055dd5 | [
"MIT"
] | null | null | null | gryphon/data/template_scaffolding/template/setup.py | ow-gryphon/gryphon | 0b34f2f61a50af46b9d1ec1d3c15d53cf4055dd5 | [
"MIT"
] | 1 | 2022-03-08T14:54:26.000Z | 2022-03-08T15:02:52.000Z | gryphon/data/template_scaffolding/template/setup.py | ow-gryphon/gryphon | 0b34f2f61a50af46b9d1ec1d3c15d53cf4055dd5 | [
"MIT"
] | null | null | null | import json
import setuptools
with open("template/README.md", "r") as fh:
long_description = fh.read()
with open('requirements.txt') as fr:
requirements = fr.read().strip().split('\n')
with open('metadata.json') as fr:
metadata = json.load(fr)
setuptools.setup(
name="", # Name of the repository
version="0.0.1",
author=metadata.get("author", ""),
author_email=metadata.get("author_email", ""),
description=metadata.get("description", ""),
long_description=long_description,
long_description_content_type="text/markdown",
url="", # Repository URL or externally maintained page
packages=setuptools.find_packages(),
python_requires='>=3.6',
install_requires=requirements,
)
| 28.230769 | 59 | 0.688011 |
a3e0ad9312af3accd64fc327daefc5bf89405ae4 | 6,558 | py | Python | train_base3.py | Mhaiyang/iccv | 04a8ee52c2323d7ff5cdf03c0be1466e8180d2eb | [
"MIT"
] | 2 | 2019-01-10T03:44:03.000Z | 2019-05-24T08:50:14.000Z | train_base3.py | Mhaiyang/iccv | 04a8ee52c2323d7ff5cdf03c0be1466e8180d2eb | [
"MIT"
] | null | null | null | train_base3.py | Mhaiyang/iccv | 04a8ee52c2323d7ff5cdf03c0be1466e8180d2eb | [
"MIT"
] | null | null | null | """
@Time : 201/21/19 10:41
@Author : TaylorMei
@Email : mhy845879017@gmail.com
@Project : iccv
@File : train_base3.py
@Function:
"""
import datetime
import os
import torch
from torch import nn
from torch import optim
from torch.autograd import Variable
from torch.backends import cudnn
from torch.utils.data import DataLoader
from torchvision import transforms
from tensorboardX import SummaryWriter
from tqdm import tqdm
import joint_transforms
from config import msd_training_root
from config import backbone_path
from dataset import ImageFolder
from misc import AvgMeter, check_mkdir
from model.base3 import BASE3
import loss as L
cudnn.benchmark = True
device_ids = [2]
ckpt_path = './ckpt'
exp_name = 'BASE3'
args = {
'epoch_num': 100,
'train_batch_size': 14,
'last_epoch': 0,
'lr': 5e-3,
'lr_decay': 0.9,
'weight_decay': 5e-4,
'momentum': 0.9,
'snapshot': '',
'scale': 384,
'save_point': [60, 80, 90],
'add_graph': True,
'poly_train': True,
'optimizer': 'SGD'
}
# Path.
check_mkdir(ckpt_path)
check_mkdir(os.path.join(ckpt_path, exp_name))
vis_path = os.path.join(ckpt_path, exp_name, 'log')
check_mkdir(vis_path)
log_path = os.path.join(ckpt_path, exp_name, str(datetime.datetime.now()) + '.txt')
writer = SummaryWriter(log_dir=vis_path, comment=exp_name)
# Transform Data.
joint_transform = joint_transforms.Compose([
joint_transforms.RandomRotate(),
joint_transforms.Resize((args['scale'], args['scale']))
])
img_transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]) # maybe can optimized.
])
target_transform = transforms.ToTensor()
# Prepare Data Set.
train_set = ImageFolder(msd_training_root, joint_transform, img_transform, target_transform)
print("Train set: {}".format(train_set.__len__()))
train_loader = DataLoader(train_set, batch_size=args['train_batch_size'], num_workers=0, shuffle=True)
if __name__ == '__main__':
main()
| 34.15625 | 119 | 0.617261 |
a3e0c5f65be532d1c0caf49217af9908f82568d1 | 574 | py | Python | tests/test_comment.py | uwase-diane/min_pitch | 514ab5da150244e900fd51b6563173a905ef4f29 | [
"Unlicense"
] | 1 | 2020-11-29T16:18:50.000Z | 2020-11-29T16:18:50.000Z | tests/test_comment.py | uwase-diane/min_pitch | 514ab5da150244e900fd51b6563173a905ef4f29 | [
"Unlicense"
] | null | null | null | tests/test_comment.py | uwase-diane/min_pitch | 514ab5da150244e900fd51b6563173a905ef4f29 | [
"Unlicense"
] | null | null | null | import unittest
from app.models import Comment, Pitch
from app import db | 33.764706 | 82 | 0.716028 |
a3e11b8d66ab1bd3a621bca6d89f7a077e4198d7 | 3,584 | py | Python | teacher/views.py | itteamforslp/safelife_project | 53af23dec0d19acf7227a43a16d7aedad443e90d | [
"MIT"
] | null | null | null | teacher/views.py | itteamforslp/safelife_project | 53af23dec0d19acf7227a43a16d7aedad443e90d | [
"MIT"
] | 4 | 2021-04-08T20:11:37.000Z | 2021-09-22T19:37:57.000Z | safelife/safelife_project/teacher/views.py | CSUS-Scrumbags/safelife | 2de7f83f637fae930b1176af796f4cc6f0519c86 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.template import loader
from django.db import connection
from django.http import HttpResponseRedirect
import datetime
from django.http import JsonResponse
from administrator.models import Course, CourseTeacher, CourseStudent, Student
from django.core.exceptions import PermissionDenied
| 44.8 | 154 | 0.595145 |
a3e19235aa28103e4d3ebb91450083d6b6b9fdab | 5,898 | py | Python | botstory/middlewares/text/text_test.py | botstory/bot-story | 9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3 | [
"MIT"
] | 5 | 2017-01-14T13:42:13.000Z | 2021-07-27T21:52:04.000Z | botstory/middlewares/text/text_test.py | botstory/bot-story | 9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3 | [
"MIT"
] | 235 | 2016-11-07T23:33:28.000Z | 2018-03-13T11:27:33.000Z | botstory/middlewares/text/text_test.py | hyzhak/bot-story | 9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3 | [
"MIT"
] | 5 | 2017-01-14T13:42:14.000Z | 2020-11-06T08:33:20.000Z | import logging
import pytest
import re
from . import text
from ... import matchers
from ...utils import answer, SimpleTrigger
logger = logging.getLogger(__name__)
def test_serialize_text_any():
m_old = text.Any()
m_new = matchers.deserialize(matchers.serialize(m_old))
assert isinstance(m_new, text.Any)
def test_serialize_text_match():
m_old = text.Match('hello (.*)', re.IGNORECASE)
m_new = matchers.deserialize(matchers.serialize(m_old))
assert isinstance(m_new, text.Match)
assert m_new.matcher.match('Hello Piter!')
def test_text_qual_should_handle_text():
assert isinstance(matchers.get_validator('just pure text'), text.Equal)
| 25.755459 | 77 | 0.623432 |
a3e2215b6ec560d3033ce187558d53690b59cd03 | 33,955 | py | Python | pywikibot/site/_datasite.py | xqt/pwb | 9a4fe27138f32952e533256195849d05855df0b0 | [
"MIT"
] | null | null | null | pywikibot/site/_datasite.py | xqt/pwb | 9a4fe27138f32952e533256195849d05855df0b0 | [
"MIT"
] | 1 | 2021-12-08T16:29:41.000Z | 2021-12-08T16:29:41.000Z | pywikibot/site/_datasite.py | xqt/pwb | 9a4fe27138f32952e533256195849d05855df0b0 | [
"MIT"
] | 2 | 2022-01-04T04:10:38.000Z | 2022-01-04T04:18:18.000Z | """Objects representing API interface to Wikibase site."""
#
# (C) Pywikibot team, 2012-2022
#
# Distributed under the terms of the MIT license.
#
import datetime
import json
import uuid
from contextlib import suppress
from typing import Optional
from warnings import warn
import pywikibot
from pywikibot.data import api
from pywikibot.exceptions import (
APIError,
EntityTypeUnknownError,
IsRedirectPageError,
NoPageError,
NoWikibaseEntityError,
)
from pywikibot.site._apisite import APISite
from pywikibot.site._decorators import need_extension, need_right, need_version
from pywikibot.tools import itergroup, merge_unique_dicts, remove_last_args
__all__ = ('DataSite', )
def geo_shape_repository(self):
"""Return Site object for the geo-shapes repository e.g. commons."""
url = self.siteinfo['general'].get('wikibase-geoshapestoragebaseurl')
if url:
return pywikibot.Site(url=url, user=self.username())
return None
def tabular_data_repository(self):
"""Return Site object for the tabular-datas repository e.g. commons."""
url = self.siteinfo['general'].get(
'wikibase-tabulardatastoragebaseurl')
if url:
return pywikibot.Site(url=url, user=self.username())
return None
def loadcontent(self, identification, *props):
"""
Fetch the current content of a Wikibase item.
This is called loadcontent since
wbgetentities does not support fetching old
revisions. Eventually this will get replaced by
an actual loadrevisions.
:param identification: Parameters used to identify the page(s)
:type identification: dict
:param props: the optional properties to fetch.
"""
params = merge_unique_dicts(identification, action='wbgetentities',
# TODO: When props is empty it results in
# an empty string ('&props=') but it should
# result in a missing entry.
props=props if props else False)
req = self.simple_request(**params)
data = req.submit()
if 'success' not in data:
raise APIError(data['errors'], '')
return data['entities']
def preload_entities(self, pagelist, groupsize: int = 50):
"""
Yield subclasses of WikibaseEntity's with content prefilled.
Note that pages will be iterated in a different order
than in the underlying pagelist.
:param pagelist: an iterable that yields either WikibaseEntity objects,
or Page objects linked to an ItemPage.
:param groupsize: how many pages to query at a time
"""
if not hasattr(self, '_entity_namespaces'):
self._cache_entity_namespaces()
for sublist in itergroup(pagelist, groupsize):
req = {'ids': [], 'titles': [], 'sites': []}
for p in sublist:
if isinstance(p, pywikibot.page.WikibaseEntity):
ident = p._defined_by()
for key in ident:
req[key].append(ident[key])
else:
if p.site == self and p.namespace() in (
self._entity_namespaces.values()):
req['ids'].append(p.title(with_ns=False))
else:
assert p.site.has_data_repository, \
'Site must have a data repository'
req['sites'].append(p.site.dbName())
req['titles'].append(p._link._text)
req = self.simple_request(action='wbgetentities', **req)
data = req.submit()
for entity in data['entities']:
if 'missing' in data['entities'][entity]:
continue
cls = self._type_to_class[data['entities'][entity]['type']]
page = cls(self, entity)
# No api call is made because item._content is given
page._content = data['entities'][entity]
with suppress(IsRedirectPageError):
page.get() # cannot provide get_redirect=True (T145971)
yield page
def getPropertyType(self, prop):
"""
Obtain the type of a property.
This is used specifically because we can cache
the value for a much longer time (near infinite).
"""
params = {'action': 'wbgetentities', 'ids': prop.getID(),
'props': 'datatype'}
expiry = datetime.timedelta(days=365 * 100)
# Store it for 100 years
req = self._request(expiry=expiry, parameters=params)
data = req.submit()
# the IDs returned from the API can be upper or lowercase, depending
# on the version. See bug T55894 for more information.
try:
dtype = data['entities'][prop.getID()]['datatype']
except KeyError:
dtype = data['entities'][prop.getID().lower()]['datatype']
return dtype
def search_entities(self, search: str, language: str,
total: Optional[int] = None, **kwargs):
"""
Search for pages or properties that contain the given text.
:param search: Text to find.
:param language: Language to search in.
:param total: Maximum number of pages to retrieve in total, or
None in case of no limit.
:return: 'search' list from API output.
:rtype: Generator
"""
lang_codes = self._paraminfo.parameter('wbsearchentities',
'language')['type']
if language not in lang_codes:
raise ValueError('Data site used does not support provided '
'language.')
if 'site' in kwargs:
if kwargs['site'].sitename != self.sitename:
raise ValueError('The site given in the kwargs is different.')
warn('search_entities should not get a site via kwargs.',
UserWarning, 2)
del kwargs['site']
parameters = dict(search=search, language=language, **kwargs)
gen = self._generator(api.APIGenerator,
type_arg='wbsearchentities',
data_name='search',
total=total, parameters=parameters)
return gen
def wbsetaliases(self, itemdef, aliases, **kwargs):
"""
Set aliases for a single Wikibase entity.
See self._wbset_action() for parameters
"""
return self._wbset_action(itemdef, 'wbsetaliases', aliases, **kwargs)
def wbsetdescription(self, itemdef, description, **kwargs):
"""
Set description for a single Wikibase entity.
See self._wbset_action()
"""
return self._wbset_action(itemdef, 'wbsetdescription', description,
**kwargs)
def wbsetlabel(self, itemdef, label, **kwargs):
"""
Set label for a single Wikibase entity.
See self._wbset_action() for parameters
"""
return self._wbset_action(itemdef, 'wbsetlabel', label, **kwargs)
def wbsetsitelink(self, itemdef, sitelink, **kwargs):
"""
Set, remove or modify a sitelink on a Wikibase item.
See self._wbset_action() for parameters
"""
return self._wbset_action(itemdef, 'wbsetsitelink', sitelink, **kwargs)
| 36.160809 | 79 | 0.560389 |
a3e3eb5e33cc147796a90e6e65542a513c75576b | 1,210 | py | Python | app.py | MisaelVillaverde/fourier-calculator | fd50cd292e333c1a9d75e93962a0aaa0985ecef9 | [
"MIT"
] | null | null | null | app.py | MisaelVillaverde/fourier-calculator | fd50cd292e333c1a9d75e93962a0aaa0985ecef9 | [
"MIT"
] | 1 | 2021-11-07T04:40:13.000Z | 2021-11-07T04:40:13.000Z | app.py | MisaelVillaverde/fourier-calculator | fd50cd292e333c1a9d75e93962a0aaa0985ecef9 | [
"MIT"
] | null | null | null | from flask import Flask
from flask import render_template, request
from flask import jsonify
import requests
import json
app = Flask(__name__)
app.run(debug=True) | 41.724138 | 349 | 0.717355 |
a3e55a939b6d954bcaed4fd506083967468d2eb3 | 1,584 | py | Python | my_code/Chapter_2.py | kalona/Spark-The-Definitive-Guide | 0b495c4710b2030aa59d5a7f4053ee0a8345d0d8 | [
"Apache-2.0"
] | 2 | 2022-01-02T14:24:29.000Z | 2022-01-02T15:54:47.000Z | my_code/Chapter_2.py | kalona/Spark-The-Definitive-Guide | 0b495c4710b2030aa59d5a7f4053ee0a8345d0d8 | [
"Apache-2.0"
] | null | null | null | my_code/Chapter_2.py | kalona/Spark-The-Definitive-Guide | 0b495c4710b2030aa59d5a7f4053ee0a8345d0d8 | [
"Apache-2.0"
] | null | null | null | from pyspark.sql import SparkSession
# spark = SparkSession.builder.master("local[*]").getOrCreate()
spark = SparkSession.builder.getOrCreate()
file_path = "C:\home_work\local_github\Spark-The-Definitive-Guide\data\/flight-data\csv\/2015-summary.csv"
# COMMAND ----------
# COMMAND ----------
flightData2015 = spark\
.read\
.option("inferSchema", "true")\
.option("header", "true")\
.csv("./data/flight-data/csv/2015-summary.csv")
# COMMAND ----------
flightData2015.createOrReplaceTempView("flight_data_2015")
# COMMAND ----------
sqlWay = spark.sql("""
SELECT DEST_COUNTRY_NAME, count(1)
FROM flight_data_2015
GROUP BY DEST_COUNTRY_NAME
""")
dataFrameWay = flightData2015\
.groupBy("DEST_COUNTRY_NAME")\
.count()
sqlWay.explain()
dataFrameWay.explain()
# COMMAND ----------
from pyspark.sql.functions import max, col
#
flightData2015.select(max(col("count"))).show(1)
# COMMAND ----------
maxSql = spark.sql("""
SELECT DEST_COUNTRY_NAME, sum(count) as destination_total
FROM flight_data_2015
GROUP BY DEST_COUNTRY_NAME
ORDER BY sum(count) DESC
LIMIT 5
""")
maxSql.show()
# COMMAND ----------
from pyspark.sql.functions import desc
flightData2015\
.groupBy("DEST_COUNTRY_NAME")\
.sum("count")\
.withColumnRenamed("sum(count)", "destination_total")\
.sort(desc("destination_total"))\
.limit(5)\
.show()
# COMMAND ----------
flightData2015\
.groupBy("DEST_COUNTRY_NAME")\
.sum("count")\
.withColumnRenamed("sum(count)", "destination_total")\
.sort(desc("destination_total"))\
.limit(5)\
.explain()
# COMMAND ----------
| 18.418605 | 106 | 0.680556 |
a3e58f9e7062eea97241b4b05b8e709ab53b50c3 | 7,508 | py | Python | tests/test_intake_postgres.py | ContinuumIO/intake-postgres | fda7f7b2b6255544ea7ffd365a4ac8b2655fd226 | [
"BSD-2-Clause"
] | 2 | 2018-11-26T00:14:10.000Z | 2018-12-21T01:52:44.000Z | tests/test_intake_postgres.py | ContinuumIO/intake-postgres | fda7f7b2b6255544ea7ffd365a4ac8b2655fd226 | [
"BSD-2-Clause"
] | 1 | 2018-12-20T08:41:05.000Z | 2018-12-21T15:00:08.000Z | tests/test_intake_postgres.py | ContinuumIO/intake-postgres | fda7f7b2b6255544ea7ffd365a4ac8b2655fd226 | [
"BSD-2-Clause"
] | 3 | 2018-12-19T08:34:14.000Z | 2019-01-24T07:58:32.000Z | import os
import pickle
import pytest
import pandas as pd
from shapely import wkt
from intake_postgres import PostgresSource
from intake import open_catalog
from .util import verify_datasource_interface
TEST_DATA_DIR = 'tests'
TEST_DATA = [
('sample1', 'sample1.csv'),
('sample2_1', 'sample2_1.csv'),
('sample2_2', 'sample2_2.csv'),
]
TEST_GIS_DATA = [
('points', 'sample_points.psql'),
('multipoints', 'sample_multipoints.psql'),
('lines', 'sample_lines.psql'),
('multilines', 'sample_multilines.psql'),
('polygons', 'sample_polygons.psql'),
('multipolygons', 'sample_multipolygons.psql'),
# ('triangles', 'sample_triangles.psql'),
]
TEST_TEMPLATE_DATA = [
'jinja2_params_with_env',
]
def test_catalog_join(engine):
catalog_fpath = os.path.join(TEST_DATA_DIR, 'catalog1.yml')
catalog = open_catalog(catalog_fpath)
ds_name = 'sample2'
src = catalog[ds_name]
pgsrc = src.get()
pgsrc._uri = str(engine.url)
assert src.describe()['container'] == 'dataframe'
assert src.describe_open()['plugin'] == 'postgres'
assert src.describe_open()['args']['sql_expr'][:6] in ('select', 'SELECT')
metadata = pgsrc.discover()
assert metadata['npartitions'] == 1
expected_df = pd.read_sql_query(pgsrc._sql_expr, engine)
df = pgsrc.read()
assert expected_df.equals(df)
pgsrc.close()
| 31.546218 | 78 | 0.678876 |
a3e6e2cb9c18b7306bf960a8fcbaf212c1159394 | 351 | py | Python | Module_3/testImage.py | dks1018/CoffeeShopCoding | 13ac1700673c86c601eb2758570920620a956e4c | [
"ADSL"
] | null | null | null | Module_3/testImage.py | dks1018/CoffeeShopCoding | 13ac1700673c86c601eb2758570920620a956e4c | [
"ADSL"
] | null | null | null | Module_3/testImage.py | dks1018/CoffeeShopCoding | 13ac1700673c86c601eb2758570920620a956e4c | [
"ADSL"
] | null | null | null | # file = open('C:\\Users\\dks10\\OneDrive\\Desktop\\Projects\\Code\\Python\\PythonCrypto\\Module_3\\eye.png', 'rb')
file = open('encrypt_eye.png', 'rb')
image = file.read()
file.close()
image = bytearray(image)
key = 48
for index, value in enumerate(image):
image[index] = value^key
file = open('2eye.png','wb')
file.write(image)
file.close() | 21.9375 | 115 | 0.675214 |
a3e8a92c23b5ddc471c49e37f3c8dc3fb274d2ab | 1,702 | py | Python | ledfxcontroller/effects/temporal.py | Aircoookie/LedFx | 95628fc237497dd89aaf30fdbf88f780f3330166 | [
"MIT"
] | 17 | 2018-08-31T05:51:09.000Z | 2022-02-12T15:41:33.000Z | ledfxcontroller/effects/temporal.py | Aircoookie/LedFx | 95628fc237497dd89aaf30fdbf88f780f3330166 | [
"MIT"
] | null | null | null | ledfxcontroller/effects/temporal.py | Aircoookie/LedFx | 95628fc237497dd89aaf30fdbf88f780f3330166 | [
"MIT"
] | 5 | 2019-07-15T22:12:45.000Z | 2022-02-05T10:50:44.000Z | import time
import logging
from ledfxcontroller.effects import Effect
from threading import Thread
import voluptuous as vol
_LOGGER = logging.getLogger(__name__)
DEFAULT_RATE = 1.0 / 60.0
| 28.847458 | 93 | 0.621622 |
a3eb6e2df01a9295d0fd4c9d2d237ab568ea9c17 | 62 | py | Python | 07/c/3 - Square Census.py | Surferlul/csc-python-solutions | bea99e5e1e344d17fb2cb29d8bcbc6b108e24cee | [
"MIT"
] | null | null | null | 07/c/3 - Square Census.py | Surferlul/csc-python-solutions | bea99e5e1e344d17fb2cb29d8bcbc6b108e24cee | [
"MIT"
] | null | null | null | 07/c/3 - Square Census.py | Surferlul/csc-python-solutions | bea99e5e1e344d17fb2cb29d8bcbc6b108e24cee | [
"MIT"
] | null | null | null | n=int(input())
c = 1
while c**2 < n:
print(c**2)
c += 1
| 10.333333 | 15 | 0.451613 |
a3ec4aae5421f3c1473f18af462a1b949c04b4de | 1,796 | py | Python | utils.py | LuChang-CS/sherbet | d1061aca108eab8e0ccbd2202460e25261fdf1d5 | [
"Apache-2.0"
] | 2 | 2022-01-26T05:38:04.000Z | 2022-03-20T08:54:18.000Z | utils.py | LuChang-CS/sherbet | d1061aca108eab8e0ccbd2202460e25261fdf1d5 | [
"Apache-2.0"
] | null | null | null | utils.py | LuChang-CS/sherbet | d1061aca108eab8e0ccbd2202460e25261fdf1d5 | [
"Apache-2.0"
] | null | null | null | import numpy as np
| 28.967742 | 72 | 0.577394 |
a3ec779913e7a7957725c231bcea5cdaa55dcfbf | 810 | py | Python | Version1_STI.py | sudhanshu55/Speech_to_Image | 7a047725b3167cfcb7a68004b3c35b2ece75fde4 | [
"MIT"
] | null | null | null | Version1_STI.py | sudhanshu55/Speech_to_Image | 7a047725b3167cfcb7a68004b3c35b2ece75fde4 | [
"MIT"
] | null | null | null | Version1_STI.py | sudhanshu55/Speech_to_Image | 7a047725b3167cfcb7a68004b3c35b2ece75fde4 | [
"MIT"
] | null | null | null | from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
import speech_recognition as sr
import nltk
from google_images_download import google_images_download
response = google_images_download.googleimagesdownload()
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say something!")
audio = r.listen(source)
data = r.recognize_google(audio).encode("utf-8")
print (data)
stopWords = set(stopwords.words('english'))
words = word_tokenize(data)
wordsFiltered = []
for w in words:
if w not in stopWords:
wordsFiltered.append(w)
into_string = str(wordsFiltered)
print(into_string)
arguments = {"keywords":into_string,"limit":2,"print_urls":True} #creating list of arguments
response.download(arguments) #passing the arguments to the function | 32.4 | 94 | 0.769136 |
a3ee75515f2face15871213c79bd272768d90d2f | 231 | py | Python | src/models.py | jonathanlloyd/scratchstack-httpserver | 72f9bb5b1673b132786d94c017dbf2d370886b79 | [
"MIT"
] | null | null | null | src/models.py | jonathanlloyd/scratchstack-httpserver | 72f9bb5b1673b132786d94c017dbf2d370886b79 | [
"MIT"
] | null | null | null | src/models.py | jonathanlloyd/scratchstack-httpserver | 72f9bb5b1673b132786d94c017dbf2d370886b79 | [
"MIT"
] | null | null | null | from dataclasses import dataclass
| 14.4375 | 33 | 0.688312 |
a3ee8470edc038ce5afdd46d3446170b34e86c08 | 6,596 | py | Python | hoomd/communicator.py | EdwardZX/hoomd-blue | c87ac3f136534e8a80359a2faceeb730f445da21 | [
"BSD-3-Clause"
] | 204 | 2018-11-26T21:15:14.000Z | 2022-03-31T17:17:21.000Z | hoomd/communicator.py | EdwardZX/hoomd-blue | c87ac3f136534e8a80359a2faceeb730f445da21 | [
"BSD-3-Clause"
] | 769 | 2019-02-15T08:58:04.000Z | 2022-03-31T17:36:48.000Z | hoomd/communicator.py | YMWani/hoomd-blue | e574b49f0c2c6df3a1eac9cbb86fe612f1ee4c18 | [
"BSD-3-Clause"
] | 91 | 2018-10-04T21:07:46.000Z | 2022-03-26T02:44:11.000Z | # Copyright (c) 2009-2021 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause
# License.
"""MPI communicator."""
from hoomd import _hoomd
import hoomd
import contextlib
def barrier(self):
"""Perform a barrier synchronization across all ranks in the partition.
Note:
Does nothing in builds with ENABLE_MPI=off.
"""
if hoomd.version.mpi_enabled:
self.cpp_mpi_conf.barrier()
# store the "current" communicator to be used for MPI_Abort calls. This defaults
# to the world communicator, but users can opt in to a more specific
# communicator using the Device.localize_abort context manager
_current_communicator = Communicator()
| 34.715789 | 80 | 0.632656 |
a3f0553d759d16377520becb3fec3c845edf0c9f | 464 | py | Python | src/affinity-propagation/generate_data.py | dominc8/affinity-propagation | b91b18b52eb68a7eafaadf0ceac39fe10955dcf2 | [
"MIT"
] | 1 | 2020-10-22T18:11:53.000Z | 2020-10-22T18:11:53.000Z | src/affinity-propagation/generate_data.py | dominc8/affinity-propagation | b91b18b52eb68a7eafaadf0ceac39fe10955dcf2 | [
"MIT"
] | null | null | null | src/affinity-propagation/generate_data.py | dominc8/affinity-propagation | b91b18b52eb68a7eafaadf0ceac39fe10955dcf2 | [
"MIT"
] | null | null | null | from config import DataGeneratorCfg
from sklearn.datasets.samples_generator import make_blobs
import numpy as np
| 38.666667 | 192 | 0.799569 |
a3f0b2c627b66a9afed0141c901b2c8dc3a62a08 | 1,265 | py | Python | peon/tests/test_project/test_file/test_function_def/test_functions/test_reflection_at_line.py | roch1990/peon | 0e9e40956c05138c0820fe380b354fdd1fe95e01 | [
"MIT"
] | 32 | 2020-05-18T14:02:59.000Z | 2022-02-06T15:00:12.000Z | peon/tests/test_project/test_file/test_function_def/test_functions/test_reflection_at_line.py | roch1990/peon | 0e9e40956c05138c0820fe380b354fdd1fe95e01 | [
"MIT"
] | 42 | 2020-05-22T20:29:08.000Z | 2021-03-10T21:24:23.000Z | peon/tests/test_project/test_file/test_function_def/test_functions/test_reflection_at_line.py | roch1990/peon | 0e9e40956c05138c0820fe380b354fdd1fe95e01 | [
"MIT"
] | 4 | 2020-07-02T06:32:42.000Z | 2022-01-24T22:46:02.000Z | import _ast
from peon.src.project.file.function_def.function import FunctionLint
| 30.119048 | 103 | 0.746245 |
a3f0f192476289dad6988d88e198337f911d4da1 | 4,419 | py | Python | db2_funcs.py | Nama/A.T.S.P.-Website | 658db78da1b12c01ef9ead2dc44d1ecd97b178d8 | [
"MIT"
] | 4 | 2015-10-18T18:46:13.000Z | 2019-11-16T02:34:05.000Z | db2_funcs.py | Adventure-Terraria-Server-Project/A.T.S.P.-Website | 658db78da1b12c01ef9ead2dc44d1ecd97b178d8 | [
"MIT"
] | null | null | null | db2_funcs.py | Adventure-Terraria-Server-Project/A.T.S.P.-Website | 658db78da1b12c01ef9ead2dc44d1ecd97b178d8 | [
"MIT"
] | 2 | 2015-09-30T21:53:19.000Z | 2019-03-22T07:59:49.000Z | ###############################################################################
# #
'''Website Database-connection-related features''' #
# #
###############################################################################
import cymysql
from conf import website_db
from time import gmtime
from time import strftime
db_host = website_db.ip
db_port = website_db.port
db = website_db.db
db_user = website_db.user
db_pw = website_db.pw
###############################################################################
# #
'''Databse-connect and close''' #
# #
###############################################################################
###############################################################################
# #
'''Donation-Page data''' #
# #
###############################################################################
###############################################################################
# #
'''Short-URL data''' #
# #
###############################################################################
###############################################################################
# #
'''Old Worlds''' #
# #
###############################################################################
###############################################################################
# #
'''Server Backup-Size in Dash''' #
# #
###############################################################################
| 33.992308 | 90 | 0.296673 |
a3f15add28c75465b292cc3d301905a5d66f9500 | 1,169 | py | Python | nlp/handler.py | rgschmitz1/tcss702 | b0fdd7b6107401dc297b467c9e63773dfb8fd487 | [
"MIT"
] | null | null | null | nlp/handler.py | rgschmitz1/tcss702 | b0fdd7b6107401dc297b467c9e63773dfb8fd487 | [
"MIT"
] | null | null | null | nlp/handler.py | rgschmitz1/tcss702 | b0fdd7b6107401dc297b467c9e63773dfb8fd487 | [
"MIT"
] | null | null | null | from minio import Minio
import json
import os
from .Inspector import Inspector
from .topic_model import topic_model
#def handle(event):
| 24.87234 | 74 | 0.622754 |
a3f1d6f2fedc4710e7669c09fd2ad1b4f7d2b866 | 803 | py | Python | src/pve_exporter/cli.py | jmangs/prometheus-pve-exporter | 2947a1247d854791114eb5ed348a250739540708 | [
"Apache-2.0"
] | null | null | null | src/pve_exporter/cli.py | jmangs/prometheus-pve-exporter | 2947a1247d854791114eb5ed348a250739540708 | [
"Apache-2.0"
] | null | null | null | src/pve_exporter/cli.py | jmangs/prometheus-pve-exporter | 2947a1247d854791114eb5ed348a250739540708 | [
"Apache-2.0"
] | null | null | null | """
Proxmox VE exporter for the Prometheus monitoring system.
"""
import sys
from argparse import ArgumentParser
from pve_exporter.http import start_http_server
def main(args=None):
"""
Main entry point.
"""
parser = ArgumentParser()
parser.add_argument('config', nargs='?', default='pve.yml',
help='Path to configuration file (pve.yml)')
parser.add_argument('port', nargs='?', type=int, default='9221',
help='Port on which the exporter is listening (9221)')
parser.add_argument('address', nargs='?', default='',
help='Address to which the exporter will bind')
params = parser.parse_args(args if args is None else sys.argv[1:])
start_http_server(params.config, params.port, params.address)
| 32.12 | 78 | 0.646326 |
a3f41aa5108b3692f20a54704fcb143543339d31 | 12,692 | py | Python | workers/repo_info_worker/repo_info_worker.py | vinodkahuja/augur | a7688af262c2f971767962d4a20110daf4b1179a | [
"MIT"
] | 2 | 2020-08-27T17:34:38.000Z | 2020-11-05T20:31:35.000Z | workers/repo_info_worker/repo_info_worker.py | BenjaminChilson/augur | 8346be0b757c907e9b67ba870a9ace32a1b87b11 | [
"MIT"
] | 9 | 2021-04-16T23:42:53.000Z | 2021-05-04T04:26:55.000Z | workers/repo_info_worker/repo_info_worker.py | BenjaminChilson/augur | 8346be0b757c907e9b67ba870a9ace32a1b87b11 | [
"MIT"
] | 7 | 2019-03-25T13:26:42.000Z | 2020-12-30T18:43:42.000Z | #SPDX-License-Identifier: MIT
import logging, os, sys, time, requests, json
from datetime import datetime
from multiprocessing import Process, Queue
import pandas as pd
import sqlalchemy as s
from workers.worker_base import Worker
# NOTE: This worker primarily inserts rows into the REPO_INFO table, which serves the primary purposes of
# 1. Displaying discrete metadata like "number of forks" and how they change over time
# 2. Validating other workers, like those related to pull requests, issues, and commits. Our totals should be at or very near the totals in the repo_info table.
# This table also updates the REPO table in 2 cases:
# 1. Recognizing when a repository is a forked repository by updating the "forked_from" field and
# 2. Recognizing when a repository is archived, and recording the data we observed the change in status.
| 41.75 | 183 | 0.554365 |
a3f5451025cc5163c68a3eea15dfa30712bf9362 | 17,929 | py | Python | benchmark/my_argparser.py | victor-estrade/SystGradDescent | 822e7094290301ec47a99433381a8d6406798aff | [
"MIT"
] | 2 | 2019-03-20T09:05:02.000Z | 2019-03-20T15:23:44.000Z | benchmark/my_argparser.py | victor-estrade/SystGradDescent | 822e7094290301ec47a99433381a8d6406798aff | [
"MIT"
] | null | null | null | benchmark/my_argparser.py | victor-estrade/SystGradDescent | 822e7094290301ec47a99433381a8d6406798aff | [
"MIT"
] | null | null | null | # coding: utf-8
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals
import argparse
| 46.81201 | 116 | 0.593787 |
a3f6015f3b9c537d076933e65004a8315446ca82 | 11,482 | py | Python | src/main/python/main.py | SarthakJariwala/Shockley-Queisser-Calculator | 5f9cfd4c97b8141e8b4ee8d15fa5f3cccfe25b7e | [
"MIT"
] | 1 | 2020-04-08T06:33:47.000Z | 2020-04-08T06:33:47.000Z | src/main/python/main.py | SarthakJariwala/Schokley-Queisser-Calculator | 5f9cfd4c97b8141e8b4ee8d15fa5f3cccfe25b7e | [
"MIT"
] | null | null | null | src/main/python/main.py | SarthakJariwala/Schokley-Queisser-Calculator | 5f9cfd4c97b8141e8b4ee8d15fa5f3cccfe25b7e | [
"MIT"
] | 2 | 2020-05-31T02:57:55.000Z | 2020-07-30T13:24:22.000Z | from fbs_runtime.application_context.PyQt5 import ApplicationContext, cached_property
from fbs_runtime.platform import is_windows, is_mac
# system imports
import sys
# module imports
from PyQt5 import uic, QtWidgets
from PyQt5.QtWidgets import QMessageBox
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import scipy.constants as constants
from scipy.integrate import simps, quad
from scipy.interpolate import splrep, splint
from scipy.optimize import fmin
if is_windows():
matplotlib.use('Qt5Agg')
elif is_mac():
matplotlib.use('macosx')
#def run():
# win = MainWindow()
# QtGui.QApplication.instance().exec_()
# return win
#run()
if __name__ == '__main__':
appctxt = AppContext() # 1. Instantiate ApplicationContext
exit_code = appctxt.run()
sys.exit(exit_code) # 2. Invoke appctxt.app.exec_() | 38.659933 | 222 | 0.592406 |
a3f604410a10116c403796e4d6e056235535c4f9 | 9,832 | py | Python | helpus/core.py | tov101/HelpUs | 6b53d9651cf45c191774be2f70b70b130251d2a6 | [
"MIT"
] | null | null | null | helpus/core.py | tov101/HelpUs | 6b53d9651cf45c191774be2f70b70b130251d2a6 | [
"MIT"
] | null | null | null | helpus/core.py | tov101/HelpUs | 6b53d9651cf45c191774be2f70b70b130251d2a6 | [
"MIT"
] | null | null | null | import io
import logging
import os
import sys
from PyQt5 import QtGui, QtCore, QtWidgets
from helpus import icon_file_path
from helpus import __version__
LOGGER = logging.getLogger('HelpUs')
LOGGER.setLevel(logging.DEBUG)
def get_qtconsole_object():
if isinstance(sys.stdin, MyBreakPoint):
return sys.stdin.console
else:
return MyBreakPoint.console
def setup_breakpoint_hook(parent, method, redirect_streams=False):
if not isinstance(sys.stdin, MyBreakPoint):
sys.stdin = MyBreakPoint(parent)
else:
# Restore Streams
sys.stdin = sys.__stdin__
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__
raise Exception(
"Multiple Instances are not allowed. Can be possible, but I'm to lazy to go deep with development."
)
if redirect_streams:
sys.stdin.redirect_outerr_stream()
return __method
if __name__ == '__main__':
p = QtWidgets.QApplication(sys.argv)
LOGGER.error('Ceva')
LOGGER.error = setup_breakpoint_hook(None, LOGGER.error, redirect_streams=True)
# LOGGER.error = setup_breakpoint_hook(None, LOGGER.error, redirect_streams=True)
x = 90
LOGGER.error('Altceva')
print(x)
| 31.015773 | 111 | 0.610151 |
a3f6dd9ede6bbc22ab1ea49e8e955647bc30a83d | 2,206 | py | Python | biothings/hub/dataindex/indexer_schedule.py | newgene/biothings.api | e3278695ac15a55fe420aa49c464946f81ec019d | [
"Apache-2.0"
] | 30 | 2017-07-23T14:50:29.000Z | 2022-02-08T08:08:16.000Z | biothings/hub/dataindex/indexer_schedule.py | kevinxin90/biothings.api | 8ff3bbaecd72d04db4933ff944898ee7b7c0e04a | [
"Apache-2.0"
] | 163 | 2017-10-24T18:45:40.000Z | 2022-03-28T03:46:26.000Z | biothings/hub/dataindex/indexer_schedule.py | newgene/biothings.api | e3278695ac15a55fe420aa49c464946f81ec019d | [
"Apache-2.0"
] | 22 | 2017-06-12T18:30:15.000Z | 2022-03-01T18:10:47.000Z | import math
def test_01():
schedule = Schedule(100, 10)
for batch in schedule:
print(batch)
print(schedule)
if __name__ == "__main__":
test_02()
| 24.241758 | 87 | 0.56165 |
a3f7032251ab8fdd92446dda433cb7125e3c866d | 447 | py | Python | examples/py/async-basic.py | voBits/ccxt | edd2dd92053bd06232769a63465a43912b21eda0 | [
"MIT"
] | 73 | 2018-05-15T00:53:50.000Z | 2022-03-07T14:45:11.000Z | examples/py/async-basic.py | voBits/ccxt | edd2dd92053bd06232769a63465a43912b21eda0 | [
"MIT"
] | 46 | 2020-01-06T07:32:19.000Z | 2021-07-26T06:33:33.000Z | examples/py/async-basic.py | voBits/ccxt | edd2dd92053bd06232769a63465a43912b21eda0 | [
"MIT"
] | 11 | 2018-05-15T00:09:30.000Z | 2022-03-07T14:45:27.000Z | # -*- coding: utf-8 -*-
import asyncio
import os
import sys
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt.async as ccxt # noqa: E402
if __name__ == '__main__':
print(asyncio.get_event_loop().run_until_complete(test_gdax()))
| 21.285714 | 83 | 0.695749 |
a3f8263738f1248425bd621ee69178be5e83cbe4 | 19 | py | Python | pymclevel/test/__init__.py | bennettdc/MCEdit-Unified | 90abfb170c65b877ac67193e717fa3a3ded635dd | [
"0BSD"
] | 673 | 2015-01-02T02:08:13.000Z | 2022-03-24T19:38:14.000Z | pymclevel/test/__init__.py | bennettdc/MCEdit-Unified | 90abfb170c65b877ac67193e717fa3a3ded635dd | [
"0BSD"
] | 551 | 2015-01-01T02:36:53.000Z | 2018-02-01T00:03:12.000Z | pymclevel/test/__init__.py | bennettdc/MCEdit-Unified | 90abfb170c65b877ac67193e717fa3a3ded635dd | [
"0BSD"
] | 231 | 2015-01-01T16:47:30.000Z | 2022-03-31T21:51:55.000Z | __author__ = 'Rio'
| 9.5 | 18 | 0.684211 |
a3f86c1b680627a4f18d2261e3c26090baebd672 | 261 | py | Python | xview/datasets/wrapper.py | ethz-asl/modular_semantic_segmentation | 7c950f24df11540a7ddae4ff806d5b31934a3210 | [
"BSD-3-Clause"
] | 20 | 2018-08-01T15:02:59.000Z | 2021-04-19T07:22:17.000Z | xview/datasets/wrapper.py | davesean/modular_semantic_segmentation | 5f9e34243915b862e8fef5e6195f1e29f4cebf50 | [
"BSD-3-Clause"
] | null | null | null | xview/datasets/wrapper.py | davesean/modular_semantic_segmentation | 5f9e34243915b862e8fef5e6195f1e29f4cebf50 | [
"BSD-3-Clause"
] | 9 | 2018-08-01T15:03:03.000Z | 2019-12-17T05:12:48.000Z | from abc import ABCMeta, abstractmethod
| 20.076923 | 50 | 0.685824 |
a3f937683bc5952ca13a05b1c4f5742ed9f21027 | 2,307 | py | Python | partd/core.py | jrbourbeau/partd | 74016a296a760de9c7a0e0d4b012a3478c9a0831 | [
"BSD-3-Clause"
] | 2 | 2018-12-29T13:47:40.000Z | 2018-12-29T13:47:49.000Z | partd/core.py | jrbourbeau/partd | 74016a296a760de9c7a0e0d4b012a3478c9a0831 | [
"BSD-3-Clause"
] | 2 | 2021-05-11T16:00:55.000Z | 2021-08-23T20:45:22.000Z | partd/core.py | jrbourbeau/partd | 74016a296a760de9c7a0e0d4b012a3478c9a0831 | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
import os
import shutil
import locket
import string
from toolz import memoize
from contextlib import contextmanager
from .utils import nested_get, flatten
# http://stackoverflow.com/questions/295135/turn-a-string-into-a-valid-filename-in-python
valid_chars = "-_.() " + string.ascii_letters + string.digits + os.path.sep
def escape_filename(fn):
""" Escape text so that it is a valid filename
>>> escape_filename('Foo!bar?')
'Foobar'
"""
return ''.join(filter(valid_chars.__contains__, fn))
def token(key):
"""
>>> token('hello')
'hello'
>>> token(('hello', 'world')) # doctest: +SKIP
'hello/world'
"""
if isinstance(key, str):
return key
elif isinstance(key, tuple):
return os.path.join(*map(token, key))
else:
return str(key)
| 24.806452 | 89 | 0.604681 |
a3f93f71de692d828156d343cfeb58d0babb5f0e | 1,248 | py | Python | pretraining/model_ensemble.py | VITA-Group/Adv-SS-Pretraining | 4ffbebea582f858ec6165f082f52ded1fc9b817d | [
"MIT"
] | 32 | 2020-08-31T01:28:29.000Z | 2022-03-19T05:40:05.000Z | pretraining/model_ensemble.py | VITA-Group/Adv-SS-Pretraining | 4ffbebea582f858ec6165f082f52ded1fc9b817d | [
"MIT"
] | null | null | null | pretraining/model_ensemble.py | VITA-Group/Adv-SS-Pretraining | 4ffbebea582f858ec6165f082f52ded1fc9b817d | [
"MIT"
] | 7 | 2020-09-19T14:03:47.000Z | 2020-12-10T00:42:08.000Z | '''
model ensemble for cifar10 // input size(32,32)
'''
import torch
import torchvision
import copy
import torch.nn as nn
from resnetv2 import ResNet50 as resnet50v2
| 23.54717 | 54 | 0.604167 |
a3fa8d70909c40648b30be357bd41df712b21d5f | 1,519 | py | Python | scripts/ccdf.py | glciampaglia/HoaxyBots | db8d2b7d9927d5d4d94ded125f9785590dace906 | [
"MIT"
] | null | null | null | scripts/ccdf.py | glciampaglia/HoaxyBots | db8d2b7d9927d5d4d94ded125f9785590dace906 | [
"MIT"
] | null | null | null | scripts/ccdf.py | glciampaglia/HoaxyBots | db8d2b7d9927d5d4d94ded125f9785590dace906 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
""" Function that implement Complement the Complementary Cumulative
Distribution Function (CCDF).
"""
#
# written by Chengcheng Shao <sccotte@gmail.com>
import numpy as np
import pandas as pd
def ccdf(s):
"""
Parameters:
`s`, series, the values of s should be variable to be handled
Return:
a new series `s`, index of s will be X axis (number), value of s
will be Y axis (probability)
"""
s = s.copy()
s = s.sort_values(ascending=True, inplace=False)
s.reset_index(drop=True, inplace=True)
n = len(s)
s.drop_duplicates(keep='first', inplace=True)
X = s.values
Y = [n - i for i in s.index]
return pd.Series(data=Y, index=X) / n
def sum_ccdf(s):
"""
Parameters:
`s`, series, the values of s should be variable to be handled
Return:
a news series `s`, index of s will be X axis (number), values
will be Y axis (sum(X>=x))
"""
s = s.copy()
s = s.value_counts()
s = s.sort_index(ascending=True)
cumulative = []
for i in range(len(s)):
s1 = s.iloc[i:]
cumulative.append(np.inner(s1.index, s1.values))
return pd.Series(cumulative, index=s.index)
| 25.745763 | 72 | 0.601712 |
a3fac0d6ce92c1972de436f2ce748bbe19017407 | 5,335 | py | Python | lifelines/fitters/kaplan_meier_fitter.py | eliracho37/lifelines | b1c6c2732d1ccfc2ae08f7178371d0f95ae3027b | [
"MIT"
] | null | null | null | lifelines/fitters/kaplan_meier_fitter.py | eliracho37/lifelines | b1c6c2732d1ccfc2ae08f7178371d0f95ae3027b | [
"MIT"
] | null | null | null | lifelines/fitters/kaplan_meier_fitter.py | eliracho37/lifelines | b1c6c2732d1ccfc2ae08f7178371d0f95ae3027b | [
"MIT"
] | 1 | 2020-05-06T14:46:25.000Z | 2020-05-06T14:46:25.000Z | # -*- coding: utf-8 -*-
from __future__ import print_function
import numpy as np
import pandas as pd
from lifelines.fitters import UnivariateFitter
from lifelines.utils import _preprocess_inputs, _additive_estimate, StatError, inv_normal_cdf,\
median_survival_times
from lifelines.plotting import plot_loglogs
| 51.298077 | 171 | 0.662418 |
a3fad8e543716f6089f3ea4419938d3d14b1b941 | 8,498 | py | Python | pydmfet/qcwrap/pyscf_rhf.py | fishjojo/pydmfe | 93cfc655314933d3531b5733521a1f95a044f6cb | [
"MIT"
] | 3 | 2021-02-26T06:26:00.000Z | 2022-02-20T08:58:20.000Z | pydmfet/qcwrap/pyscf_rhf.py | fishjojo/pydmfet | 93cfc655314933d3531b5733521a1f95a044f6cb | [
"MIT"
] | null | null | null | pydmfet/qcwrap/pyscf_rhf.py | fishjojo/pydmfet | 93cfc655314933d3531b5733521a1f95a044f6cb | [
"MIT"
] | null | null | null | import numpy as np
from pydmfet import tools
from .fermi import find_efermi, entropy_corr
from pyscf import ao2mo, gto, scf, dft, lib
from pydmfet.qcwrap import fermi
import time
from functools import reduce
# The following is deprecated!
'''
def rhf(mol, OEI, TEI, Norb, Nelec, OneDM0=None ):
# Get the RHF solution
OEI = 0.5*(OEI.T + OEI)
#mol = gto.Mole()
#mol.max_memory = 8000
#mol.build( verbose=0 )
#mol.atom.append(('C', (0, 0, 0)))
mol.nelectron = Nelec
mol.incore_anyway = True
mf = pyscf_scf.RHF( mol )
mf.get_hcore = lambda *args: OEI
mf.get_ovlp = lambda *args: np.eye( Norb )
mf._eri = ao2mo.restore(8, TEI, Norb)
mf.max_cycle = 100
#mf.conv_tol = 1e-8
#adiis = pyscf_scf.diis.ADIIS()
#mf.diis = adiis
#mf.verbose = 5
mf.kernel(OneDM0)
if ( mf.converged == False ):
#RDM1 = mf.make_rdm1()
#cdiis = pyscf_scf.diis.SCF_DIIS()
#mf.diis = cdiis
#mf.max_cycle = 200
#mf.kernel(RDM1)
if ( mf.converged == False ):
raise Exception(" rhf not converged!")
return mf
def rks(mol, OEI, TEI, Norb, Nelec, xcfunc, OneDM0=None ):
# Get the RKS solution
OEI = 0.5*(OEI.T + OEI)
#mol = gto.Mole()
#mol.build( verbose=5 )
#mol.atom.append(('C', (0, 0, 0)))
mol.nelectron = Nelec
# mol.incore_anyway = True
mf = pyscf_scf.RKS( mol )
mf.xc = xcfunc.lower()
# mf.get_hcore = lambda *args: OEI
# mf.get_ovlp = lambda *args: np.eye( Norb )
# mf._eri = ao2mo.restore(8, TEI, Norb)
OneDM0 = None
mf.kernel( OneDM0 )
if ( mf.converged == False ):
raise Exception(" rks not converged!")
return mf
def scf(mol, OEI, TEI, Norb, Nelec, OneDM0=None, mf_method = 'HF' ):
# Get the mean-field solution
if(mf_method.lower() == 'hf'):
mf = rhf(mol, OEI, TEI, Norb, Nelec, OneDM0 )
else:
mf = rks(mol, OEI, TEI, Norb, Nelec, mf_method ,OneDM0 )
RDM1 = mf.make_rdm1()
RDM1 = 0.5*(RDM1.T + RDM1)
mo_coeff = mf.mo_coeff
mo_energy = mf.mo_energy
energy = mf.energy_elec(RDM1)[0]
mo = np.zeros([Norb,Norb+1],dtype=float)
mo[:,:-1] = mo_coeff
mo[:,-1] = mo_energy
#print "mo energy"
#print mf.mo_energy
#tools.MatPrint(mf.get_fock(),"fock")
#JK = mf.get_veff(None, dm=RDM1)
#tools.MatPrint(JK,"JK")
#tools.MatPrint(np.dot(mf.get_fock(), mf.mo_coeff),"test")
#tools.MatPrint(mf.mo_coeff,"mo_coeff")
return (energy, RDM1, mo)
'''
| 27.324759 | 120 | 0.567075 |
a3fb5ed7db5f1e3f6fa910bcda6e0eacb2e1cb30 | 2,470 | py | Python | backends/fortify/summarize-fortify.py | tautschnig/one-line-scan | 24e1deedd595e3406eb8d5c69ff9629c5a87d0aa | [
"Apache-2.0"
] | 16 | 2018-05-21T09:53:01.000Z | 2022-02-15T08:48:11.000Z | backends/fortify/summarize-fortify.py | tautschnig/one-line-scan | 24e1deedd595e3406eb8d5c69ff9629c5a87d0aa | [
"Apache-2.0"
] | 6 | 2018-07-09T06:13:05.000Z | 2020-11-11T14:49:35.000Z | backends/fortify/summarize-fortify.py | tautschnig/one-line-scan | 24e1deedd595e3406eb8d5c69ff9629c5a87d0aa | [
"Apache-2.0"
] | 5 | 2019-05-27T19:51:48.000Z | 2021-12-14T13:04:49.000Z | #!/usr/bin/env python
#
# Copyright Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# Parse the report.html of Fortify and create an ASCII summary
import os
import sys
from subprocess import call
from xml.etree import ElementTree
# print usage
if len(sys.argv) != 2:
print "usage summarizy-fortify.py LOGDIR"
sys.exit(1)
# get directory where the logs are placed
logdir=sys.argv[1]
# strip this part of the directory information of
workdirectory = os.getcwd() + '/'
# get the fortify report; first make it valid XML
filename=logdir+'/log/report.html'
call(['perl', '-p', '-i', '-e', 's#<((img|meta) [^>]+)>#<$1/>#', filename])
# make sure we can run this script multiple times on the same html file
call(['perl', '-p', '-i', '-e', 's#//>#/>#', filename])
# parse the html file and jump to the last table
data=ElementTree.parse(filename).getroot()
table=data.find('.//table')[-1]
# iterate over all rows and print their content in a more useable format
for data in table.iter('tr'):
# handle only the rows that contain results
if len(data) != 4:
continue
# extract file information, convert absolute path into relative one
location=data[2].find('a')
# header does not have <a ...>
if location is None:
continue
filename=location.get('href')
filename=filename.replace('file://','')
filename=filename.replace(workdirectory,'')
severity=data[3].text
if severity is None:
severity=data[3].find('span').text
# strip newline and space sequences
problem=data[0].text.replace('\n','').replace('\r','')
short=problem.replace(' ',' ')
while len(short) < len(problem):
problem=short
short=problem.replace(' ',' ')
column=ElementTree.tostring(data[2].findall("*")[0]).split(':')[2]
printstring = filename + ':' + column.strip() + ', ' + \
severity.strip() + ', ' + \
problem
if data[1].text is not None:
printstring = printstring + ', ' + data[1].text
print printstring
| 33.835616 | 77 | 0.681781 |
a3fc78d36ccfb5728f04880a3739b99e0d64d7a7 | 91,209 | py | Python | angr/procedures/definitions/win32_wsmsvc.py | r4b3rt/angr | c133cfd4f83ffea2a1d9e064241e9459eaabc55f | [
"BSD-2-Clause"
] | null | null | null | angr/procedures/definitions/win32_wsmsvc.py | r4b3rt/angr | c133cfd4f83ffea2a1d9e064241e9459eaabc55f | [
"BSD-2-Clause"
] | null | null | null | angr/procedures/definitions/win32_wsmsvc.py | r4b3rt/angr | c133cfd4f83ffea2a1d9e064241e9459eaabc55f | [
"BSD-2-Clause"
] | null | null | null | # pylint:disable=line-too-long
import logging
from ...sim_type import SimTypeFunction, SimTypeShort, SimTypeInt, SimTypeLong, SimTypeLongLong, SimTypeDouble, SimTypeFloat, SimTypePointer, SimTypeChar, SimStruct, SimTypeFixedSizeArray, SimTypeBottom, SimUnion, SimTypeBool
from ...calling_conventions import SimCCStdcall, SimCCMicrosoftAMD64
from .. import SIM_PROCEDURES as P
from . import SimLibrary
_l = logging.getLogger(name=__name__)
lib = SimLibrary()
lib.set_default_cc('X86', SimCCStdcall)
lib.set_default_cc('AMD64', SimCCMicrosoftAMD64)
lib.set_library_names("wsmsvc.dll")
prototypes = \
{
#
'WSManInitialize': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypePointer(SimStruct({}, name="WSMAN_API", pack=False, align=None), offset=0), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["flags", "apiHandle"]),
#
'WSManDeinitialize': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_API", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["apiHandle", "flags"]),
#
'WSManGetErrorMessage': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_API", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["apiHandle", "flags", "languageCode", "errorCode", "messageLength", "message", "messageLengthUsed"]),
#
'WSManCreateSession': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_API", pack=False, align=None), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"authenticationMechanism": SimTypeInt(signed=False, label="UInt32"), "Anonymous": SimUnion({"userAccount": SimStruct({"username": SimTypePointer(SimTypeChar(label="Char"), offset=0), "password": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_USERNAME_PASSWORD_CREDS", pack=False, align=None), "certificateThumbprint": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="<anon>", label="None")}, name="WSMAN_AUTHENTICATION_CREDENTIALS", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"accessType": SimTypeInt(signed=False, label="UInt32"), "authenticationCredentials": SimStruct({"authenticationMechanism": SimTypeInt(signed=False, label="UInt32"), "Anonymous": SimUnion({"userAccount": SimStruct({"username": SimTypePointer(SimTypeChar(label="Char"), offset=0), "password": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_USERNAME_PASSWORD_CREDS", pack=False, align=None), "certificateThumbprint": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="<anon>", label="None")}, name="WSMAN_AUTHENTICATION_CREDENTIALS", pack=False, align=None)}, name="WSMAN_PROXY_INFO", pack=False, align=None), offset=0), SimTypePointer(SimTypePointer(SimStruct({}, name="WSMAN_SESSION", pack=False, align=None), offset=0), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["apiHandle", "connection", "flags", "serverAuthenticationCredentials", "proxyInfo", "session"]),
#
'WSManCloseSession': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SESSION", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["session", "flags"]),
#
'WSManSetSessionOption': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SESSION", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="WSManSessionOption"), SimTypePointer(SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["session", "option", "data"]),
#
'WSManGetSessionOptionAsDword': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SESSION", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="WSManSessionOption"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["session", "option", "value"]),
#
'WSManGetSessionOptionAsString': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SESSION", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="WSManSessionOption"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["session", "option", "stringLength", "string", "stringLengthUsed"]),
#
'WSManCloseOperation': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["operationHandle", "flags"]),
#
'WSManCreateShell': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SESSION", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"__AnonymousBase_wsman_L665_C48": SimStruct({"inputStreamSet": SimTypePointer(SimStruct({"streamIDsCount": SimTypeInt(signed=False, label="UInt32"), "streamIDs": SimTypePointer(SimTypePointer(SimTypeChar(label="Char"), offset=0), offset=0)}, name="WSMAN_STREAM_ID_SET", pack=False, align=None), offset=0), "outputStreamSet": SimTypePointer(SimStruct({"streamIDsCount": SimTypeInt(signed=False, label="UInt32"), "streamIDs": SimTypePointer(SimTypePointer(SimTypeChar(label="Char"), offset=0), offset=0)}, name="WSMAN_STREAM_ID_SET", pack=False, align=None), offset=0), "idleTimeoutMs": SimTypeInt(signed=False, label="UInt32"), "workingDirectory": SimTypePointer(SimTypeChar(label="Char"), offset=0), "variableSet": SimTypePointer(SimStruct({"varsCount": SimTypeInt(signed=False, label="UInt32"), "vars": SimTypePointer(SimStruct({"name": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ENVIRONMENT_VARIABLE", pack=False, align=None), offset=0)}, name="WSMAN_ENVIRONMENT_VARIABLE_SET", pack=False, align=None), offset=0)}, name="WSMAN_SHELL_STARTUP_INFO_V10", pack=False, align=None), "name": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_SHELL_STARTUP_INFO_V11", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"optionsCount": SimTypeInt(signed=False, label="UInt32"), "options": SimTypePointer(SimStruct({"name": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0), "mustComply": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION", pack=False, align=None), offset=0), "optionsMustUnderstand": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION_SET", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0), SimTypePointer(SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), offset=0)], SimTypeBottom(label="Void"), arg_names=["session", "flags", "resourceUri", "startupInfo", "options", "createXml", "async", "shell"]),
#
'WSManRunShellCommand': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"argsCount": SimTypeInt(signed=False, label="UInt32"), "args": SimTypePointer(SimTypePointer(SimTypeChar(label="Char"), offset=0), offset=0)}, name="WSMAN_COMMAND_ARG_SET", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"optionsCount": SimTypeInt(signed=False, label="UInt32"), "options": SimTypePointer(SimStruct({"name": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0), "mustComply": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION", pack=False, align=None), offset=0), "optionsMustUnderstand": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION_SET", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0), SimTypePointer(SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), offset=0)], SimTypeBottom(label="Void"), arg_names=["shell", "flags", "commandLine", "args", "options", "async", "command"]),
#
'WSManSignalShell': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0), SimTypePointer(SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), offset=0)], SimTypeBottom(label="Void"), arg_names=["shell", "command", "flags", "code", "async", "signalOperation"]),
#
'WSManReceiveShellOutput': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"streamIDsCount": SimTypeInt(signed=False, label="UInt32"), "streamIDs": SimTypePointer(SimTypePointer(SimTypeChar(label="Char"), offset=0), offset=0)}, name="WSMAN_STREAM_ID_SET", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0), SimTypePointer(SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), offset=0)], SimTypeBottom(label="Void"), arg_names=["shell", "command", "flags", "desiredStreamSet", "async", "receiveOperation"]),
#
'WSManSendShellInput': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0), SimTypePointer(SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), offset=0)], SimTypeBottom(label="Void"), arg_names=["shell", "command", "flags", "streamId", "streamData", "endOfStream", "async", "sendOperation"]),
#
'WSManCloseCommand': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0)], SimTypeBottom(label="Void"), arg_names=["commandHandle", "flags", "async"]),
#
'WSManCloseShell': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0)], SimTypeBottom(label="Void"), arg_names=["shellHandle", "flags", "async"]),
#
'WSManCreateShellEx': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SESSION", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"__AnonymousBase_wsman_L665_C48": SimStruct({"inputStreamSet": SimTypePointer(SimStruct({"streamIDsCount": SimTypeInt(signed=False, label="UInt32"), "streamIDs": SimTypePointer(SimTypePointer(SimTypeChar(label="Char"), offset=0), offset=0)}, name="WSMAN_STREAM_ID_SET", pack=False, align=None), offset=0), "outputStreamSet": SimTypePointer(SimStruct({"streamIDsCount": SimTypeInt(signed=False, label="UInt32"), "streamIDs": SimTypePointer(SimTypePointer(SimTypeChar(label="Char"), offset=0), offset=0)}, name="WSMAN_STREAM_ID_SET", pack=False, align=None), offset=0), "idleTimeoutMs": SimTypeInt(signed=False, label="UInt32"), "workingDirectory": SimTypePointer(SimTypeChar(label="Char"), offset=0), "variableSet": SimTypePointer(SimStruct({"varsCount": SimTypeInt(signed=False, label="UInt32"), "vars": SimTypePointer(SimStruct({"name": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ENVIRONMENT_VARIABLE", pack=False, align=None), offset=0)}, name="WSMAN_ENVIRONMENT_VARIABLE_SET", pack=False, align=None), offset=0)}, name="WSMAN_SHELL_STARTUP_INFO_V10", pack=False, align=None), "name": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_SHELL_STARTUP_INFO_V11", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"optionsCount": SimTypeInt(signed=False, label="UInt32"), "options": SimTypePointer(SimStruct({"name": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0), "mustComply": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION", pack=False, align=None), offset=0), "optionsMustUnderstand": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION_SET", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0), SimTypePointer(SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), offset=0)], SimTypeBottom(label="Void"), arg_names=["session", "flags", "resourceUri", "shellId", "startupInfo", "options", "createXml", "async", "shell"]),
#
'WSManRunShellCommandEx': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"argsCount": SimTypeInt(signed=False, label="UInt32"), "args": SimTypePointer(SimTypePointer(SimTypeChar(label="Char"), offset=0), offset=0)}, name="WSMAN_COMMAND_ARG_SET", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"optionsCount": SimTypeInt(signed=False, label="UInt32"), "options": SimTypePointer(SimStruct({"name": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0), "mustComply": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION", pack=False, align=None), offset=0), "optionsMustUnderstand": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION_SET", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0), SimTypePointer(SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), offset=0)], SimTypeBottom(label="Void"), arg_names=["shell", "flags", "commandId", "commandLine", "args", "options", "async", "command"]),
#
'WSManDisconnectShell': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"idleTimeoutMs": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_SHELL_DISCONNECT_INFO", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0)], SimTypeBottom(label="Void"), arg_names=["shell", "flags", "disconnectInfo", "async"]),
#
'WSManReconnectShell': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0)], SimTypeBottom(label="Void"), arg_names=["shell", "flags", "async"]),
#
'WSManReconnectShellCommand': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0)], SimTypeBottom(label="Void"), arg_names=["commandHandle", "flags", "async"]),
#
'WSManConnectShell': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SESSION", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"optionsCount": SimTypeInt(signed=False, label="UInt32"), "options": SimTypePointer(SimStruct({"name": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0), "mustComply": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION", pack=False, align=None), offset=0), "optionsMustUnderstand": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION_SET", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0), SimTypePointer(SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), offset=0)], SimTypeBottom(label="Void"), arg_names=["session", "flags", "resourceUri", "shellID", "options", "connectXml", "async", "shell"]),
#
'WSManConnectShellCommand': SimTypeFunction([SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"optionsCount": SimTypeInt(signed=False, label="UInt32"), "options": SimTypePointer(SimStruct({"name": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0), "mustComply": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION", pack=False, align=None), offset=0), "optionsMustUnderstand": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION_SET", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"operationContext": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "completionFunction": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"code": SimTypeInt(signed=False, label="UInt32"), "errorDetail": SimTypePointer(SimTypeChar(label="Char"), offset=0), "language": SimTypePointer(SimTypeChar(label="Char"), offset=0), "machineName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "pluginName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_ERROR", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_SHELL", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), SimTypePointer(SimStruct({}, name="WSMAN_OPERATION", pack=False, align=None), offset=0), SimTypePointer(SimUnion({"receiveData": SimStruct({"streamId": SimTypePointer(SimTypeChar(label="Char"), offset=0), "streamData": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), "commandState": SimTypePointer(SimTypeChar(label="Char"), offset=0), "exitCode": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_RECEIVE_DATA_RESULT", pack=False, align=None), "connectData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CONNECT_DATA", pack=False, align=None), "createData": SimStruct({"data": SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None)}, name="WSMAN_CREATE_SHELL_DATA", pack=False, align=None)}, name="<anon>", label="None"), offset=0)], SimTypeBottom(label="Void"), arg_names=["operationContext", "flags", "error", "shell", "command", "operationHandle", "data"]), offset=0)}, name="WSMAN_SHELL_ASYNC", pack=False, align=None), offset=0), SimTypePointer(SimTypePointer(SimStruct({}, name="WSMAN_COMMAND", pack=False, align=None), offset=0), offset=0)], SimTypeBottom(label="Void"), arg_names=["shell", "flags", "commandID", "options", "connectXml", "async", "command"]),
#
'WSManPluginReportContext': SimTypeFunction([SimTypePointer(SimStruct({"senderDetails": SimTypePointer(SimStruct({"senderName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "authenticationMechanism": SimTypePointer(SimTypeChar(label="Char"), offset=0), "certificateDetails": SimTypePointer(SimStruct({"subject": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerThumbprint": SimTypePointer(SimTypeChar(label="Char"), offset=0), "subjectName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_CERTIFICATE_DETAILS", pack=False, align=None), offset=0), "clientToken": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "httpURL": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_SENDER_DETAILS", pack=False, align=None), offset=0), "locale": SimTypePointer(SimTypeChar(label="Char"), offset=0), "resourceUri": SimTypePointer(SimTypeChar(label="Char"), offset=0), "operationInfo": SimTypePointer(SimStruct({"fragment": SimStruct({"path": SimTypePointer(SimTypeChar(label="Char"), offset=0), "dialect": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_FRAGMENT", pack=False, align=None), "filter": SimStruct({"filter": SimTypePointer(SimTypeChar(label="Char"), offset=0), "dialect": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_FILTER", pack=False, align=None), "selectorSet": SimStruct({"numberKeys": SimTypeInt(signed=False, label="UInt32"), "keys": SimTypePointer(SimStruct({"key": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_KEY", pack=False, align=None), offset=0)}, name="WSMAN_SELECTOR_SET", pack=False, align=None), "optionSet": SimStruct({"optionsCount": SimTypeInt(signed=False, label="UInt32"), "options": SimTypePointer(SimStruct({"name": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0), "mustComply": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION", pack=False, align=None), offset=0), "optionsMustUnderstand": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION_SET", pack=False, align=None), "reserved": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "version": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_OPERATION_INFO", pack=False, align=None), offset=0), "shutdownNotification": SimTypeInt(signed=True, label="Int32"), "shutdownNotificationHandle": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dataLocale": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_PLUGIN_REQUEST", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["requestDetails", "flags", "context"]),
#
'WSManPluginReceiveResult': SimTypeFunction([SimTypePointer(SimStruct({"senderDetails": SimTypePointer(SimStruct({"senderName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "authenticationMechanism": SimTypePointer(SimTypeChar(label="Char"), offset=0), "certificateDetails": SimTypePointer(SimStruct({"subject": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerThumbprint": SimTypePointer(SimTypeChar(label="Char"), offset=0), "subjectName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_CERTIFICATE_DETAILS", pack=False, align=None), offset=0), "clientToken": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "httpURL": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_SENDER_DETAILS", pack=False, align=None), offset=0), "locale": SimTypePointer(SimTypeChar(label="Char"), offset=0), "resourceUri": SimTypePointer(SimTypeChar(label="Char"), offset=0), "operationInfo": SimTypePointer(SimStruct({"fragment": SimStruct({"path": SimTypePointer(SimTypeChar(label="Char"), offset=0), "dialect": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_FRAGMENT", pack=False, align=None), "filter": SimStruct({"filter": SimTypePointer(SimTypeChar(label="Char"), offset=0), "dialect": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_FILTER", pack=False, align=None), "selectorSet": SimStruct({"numberKeys": SimTypeInt(signed=False, label="UInt32"), "keys": SimTypePointer(SimStruct({"key": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_KEY", pack=False, align=None), offset=0)}, name="WSMAN_SELECTOR_SET", pack=False, align=None), "optionSet": SimStruct({"optionsCount": SimTypeInt(signed=False, label="UInt32"), "options": SimTypePointer(SimStruct({"name": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0), "mustComply": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION", pack=False, align=None), offset=0), "optionsMustUnderstand": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION_SET", pack=False, align=None), "reserved": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "version": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_OPERATION_INFO", pack=False, align=None), offset=0), "shutdownNotification": SimTypeInt(signed=True, label="Int32"), "shutdownNotificationHandle": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dataLocale": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_PLUGIN_REQUEST", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["requestDetails", "flags", "stream", "streamResult", "commandState", "exitCode"]),
#
'WSManPluginOperationComplete': SimTypeFunction([SimTypePointer(SimStruct({"senderDetails": SimTypePointer(SimStruct({"senderName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "authenticationMechanism": SimTypePointer(SimTypeChar(label="Char"), offset=0), "certificateDetails": SimTypePointer(SimStruct({"subject": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerThumbprint": SimTypePointer(SimTypeChar(label="Char"), offset=0), "subjectName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_CERTIFICATE_DETAILS", pack=False, align=None), offset=0), "clientToken": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "httpURL": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_SENDER_DETAILS", pack=False, align=None), offset=0), "locale": SimTypePointer(SimTypeChar(label="Char"), offset=0), "resourceUri": SimTypePointer(SimTypeChar(label="Char"), offset=0), "operationInfo": SimTypePointer(SimStruct({"fragment": SimStruct({"path": SimTypePointer(SimTypeChar(label="Char"), offset=0), "dialect": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_FRAGMENT", pack=False, align=None), "filter": SimStruct({"filter": SimTypePointer(SimTypeChar(label="Char"), offset=0), "dialect": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_FILTER", pack=False, align=None), "selectorSet": SimStruct({"numberKeys": SimTypeInt(signed=False, label="UInt32"), "keys": SimTypePointer(SimStruct({"key": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_KEY", pack=False, align=None), offset=0)}, name="WSMAN_SELECTOR_SET", pack=False, align=None), "optionSet": SimStruct({"optionsCount": SimTypeInt(signed=False, label="UInt32"), "options": SimTypePointer(SimStruct({"name": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0), "mustComply": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION", pack=False, align=None), offset=0), "optionsMustUnderstand": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION_SET", pack=False, align=None), "reserved": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "version": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_OPERATION_INFO", pack=False, align=None), offset=0), "shutdownNotification": SimTypeInt(signed=True, label="Int32"), "shutdownNotificationHandle": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dataLocale": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_PLUGIN_REQUEST", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["requestDetails", "flags", "errorCode", "extendedInformation"]),
#
'WSManPluginGetOperationParameters': SimTypeFunction([SimTypePointer(SimStruct({"senderDetails": SimTypePointer(SimStruct({"senderName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "authenticationMechanism": SimTypePointer(SimTypeChar(label="Char"), offset=0), "certificateDetails": SimTypePointer(SimStruct({"subject": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerThumbprint": SimTypePointer(SimTypeChar(label="Char"), offset=0), "subjectName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_CERTIFICATE_DETAILS", pack=False, align=None), offset=0), "clientToken": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "httpURL": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_SENDER_DETAILS", pack=False, align=None), offset=0), "locale": SimTypePointer(SimTypeChar(label="Char"), offset=0), "resourceUri": SimTypePointer(SimTypeChar(label="Char"), offset=0), "operationInfo": SimTypePointer(SimStruct({"fragment": SimStruct({"path": SimTypePointer(SimTypeChar(label="Char"), offset=0), "dialect": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_FRAGMENT", pack=False, align=None), "filter": SimStruct({"filter": SimTypePointer(SimTypeChar(label="Char"), offset=0), "dialect": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_FILTER", pack=False, align=None), "selectorSet": SimStruct({"numberKeys": SimTypeInt(signed=False, label="UInt32"), "keys": SimTypePointer(SimStruct({"key": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_KEY", pack=False, align=None), offset=0)}, name="WSMAN_SELECTOR_SET", pack=False, align=None), "optionSet": SimStruct({"optionsCount": SimTypeInt(signed=False, label="UInt32"), "options": SimTypePointer(SimStruct({"name": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0), "mustComply": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION", pack=False, align=None), offset=0), "optionsMustUnderstand": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION_SET", pack=False, align=None), "reserved": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "version": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_OPERATION_INFO", pack=False, align=None), offset=0), "shutdownNotification": SimTypeInt(signed=True, label="Int32"), "shutdownNotificationHandle": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dataLocale": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_PLUGIN_REQUEST", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["requestDetails", "flags", "data"]),
#
'WSManPluginGetConfiguration': SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"type": SimTypeInt(signed=False, label="WSManDataType"), "Anonymous": SimUnion({"text": SimStruct({"bufferLength": SimTypeInt(signed=False, label="UInt32"), "buffer": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_DATA_TEXT", pack=False, align=None), "binaryData": SimStruct({"dataLength": SimTypeInt(signed=False, label="UInt32"), "data": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WSMAN_DATA_BINARY", pack=False, align=None), "number": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None")}, name="WSMAN_DATA", pack=False, align=None), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["pluginContext", "flags", "data"]),
#
'WSManPluginReportCompletion': SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["pluginContext", "flags"]),
#
'WSManPluginFreeRequestDetails': SimTypeFunction([SimTypePointer(SimStruct({"senderDetails": SimTypePointer(SimStruct({"senderName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "authenticationMechanism": SimTypePointer(SimTypeChar(label="Char"), offset=0), "certificateDetails": SimTypePointer(SimStruct({"subject": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerThumbprint": SimTypePointer(SimTypeChar(label="Char"), offset=0), "subjectName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_CERTIFICATE_DETAILS", pack=False, align=None), offset=0), "clientToken": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "httpURL": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_SENDER_DETAILS", pack=False, align=None), offset=0), "locale": SimTypePointer(SimTypeChar(label="Char"), offset=0), "resourceUri": SimTypePointer(SimTypeChar(label="Char"), offset=0), "operationInfo": SimTypePointer(SimStruct({"fragment": SimStruct({"path": SimTypePointer(SimTypeChar(label="Char"), offset=0), "dialect": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_FRAGMENT", pack=False, align=None), "filter": SimStruct({"filter": SimTypePointer(SimTypeChar(label="Char"), offset=0), "dialect": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_FILTER", pack=False, align=None), "selectorSet": SimStruct({"numberKeys": SimTypeInt(signed=False, label="UInt32"), "keys": SimTypePointer(SimStruct({"key": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_KEY", pack=False, align=None), offset=0)}, name="WSMAN_SELECTOR_SET", pack=False, align=None), "optionSet": SimStruct({"optionsCount": SimTypeInt(signed=False, label="UInt32"), "options": SimTypePointer(SimStruct({"name": SimTypePointer(SimTypeChar(label="Char"), offset=0), "value": SimTypePointer(SimTypeChar(label="Char"), offset=0), "mustComply": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION", pack=False, align=None), offset=0), "optionsMustUnderstand": SimTypeInt(signed=True, label="Int32")}, name="WSMAN_OPTION_SET", pack=False, align=None), "reserved": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "version": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_OPERATION_INFO", pack=False, align=None), offset=0), "shutdownNotification": SimTypeInt(signed=True, label="Int32"), "shutdownNotificationHandle": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dataLocale": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_PLUGIN_REQUEST", pack=False, align=None), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["requestDetails"]),
#
'WSManPluginAuthzUserComplete': SimTypeFunction([SimTypePointer(SimStruct({"senderName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "authenticationMechanism": SimTypePointer(SimTypeChar(label="Char"), offset=0), "certificateDetails": SimTypePointer(SimStruct({"subject": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerThumbprint": SimTypePointer(SimTypeChar(label="Char"), offset=0), "subjectName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_CERTIFICATE_DETAILS", pack=False, align=None), offset=0), "clientToken": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "httpURL": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_SENDER_DETAILS", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["senderDetails", "flags", "userAuthorizationContext", "impersonationToken", "userIsAdministrator", "errorCode", "extendedErrorInformation"]),
#
'WSManPluginAuthzOperationComplete': SimTypeFunction([SimTypePointer(SimStruct({"senderName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "authenticationMechanism": SimTypePointer(SimTypeChar(label="Char"), offset=0), "certificateDetails": SimTypePointer(SimStruct({"subject": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerThumbprint": SimTypePointer(SimTypeChar(label="Char"), offset=0), "subjectName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_CERTIFICATE_DETAILS", pack=False, align=None), offset=0), "clientToken": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "httpURL": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_SENDER_DETAILS", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["senderDetails", "flags", "userAuthorizationContext", "errorCode", "extendedErrorInformation"]),
#
'WSManPluginAuthzQueryQuotaComplete': SimTypeFunction([SimTypePointer(SimStruct({"senderName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "authenticationMechanism": SimTypePointer(SimTypeChar(label="Char"), offset=0), "certificateDetails": SimTypePointer(SimStruct({"subject": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "issuerThumbprint": SimTypePointer(SimTypeChar(label="Char"), offset=0), "subjectName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_CERTIFICATE_DETAILS", pack=False, align=None), offset=0), "clientToken": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "httpURL": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WSMAN_SENDER_DETAILS", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"maxAllowedConcurrentShells": SimTypeInt(signed=False, label="UInt32"), "maxAllowedConcurrentOperations": SimTypeInt(signed=False, label="UInt32"), "timeslotSize": SimTypeInt(signed=False, label="UInt32"), "maxAllowedOperationsPerTimeslot": SimTypeInt(signed=False, label="UInt32")}, name="WSMAN_AUTHZ_QUOTA", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["senderDetails", "flags", "quota", "errorCode", "extendedErrorInformation"]),
}
lib.set_prototypes(prototypes)
| 1,036.465909 | 6,433 | 0.744082 |
a3fc7e9736f8ff7c6e4924c0d8a73afdf2dd7f02 | 81 | py | Python | aiolookin/__init__.py | bachya/aiolookin | 553731047b6910b1cb74667fbb343faf9b8656ac | [
"MIT"
] | null | null | null | aiolookin/__init__.py | bachya/aiolookin | 553731047b6910b1cb74667fbb343faf9b8656ac | [
"MIT"
] | 3 | 2021-08-16T21:32:30.000Z | 2021-10-05T00:30:03.000Z | aiolookin/__init__.py | bachya/aiolookin | 553731047b6910b1cb74667fbb343faf9b8656ac | [
"MIT"
] | null | null | null | """Define the aiolookin package."""
from .device import async_get_device # noqa
| 27 | 44 | 0.753086 |
a3fcab0b445701487209c1560ead48389dc4c643 | 2,067 | py | Python | odepy/collision_space.py | yuemingl/ode-python-1 | a9a12d9d3b7e611874a8d30f6a5c0b83b6087f86 | [
"MIT"
] | 9 | 2020-05-31T09:22:40.000Z | 2021-09-15T18:15:15.000Z | odepy/collision_space.py | yuemingl/ode-python-1 | a9a12d9d3b7e611874a8d30f6a5c0b83b6087f86 | [
"MIT"
] | 1 | 2020-11-15T11:38:45.000Z | 2020-11-15T11:38:45.000Z | odepy/collision_space.py | yuemingl/ode-python-1 | a9a12d9d3b7e611874a8d30f6a5c0b83b6087f86 | [
"MIT"
] | 2 | 2020-11-14T21:47:01.000Z | 2021-08-03T02:28:10.000Z | # -*- coding: utf-8 -*-
from .common import loadOde
from .common import dGeomID
from .common import dSpaceID
from .common import dVector3
from ctypes import POINTER
from ctypes import CFUNCTYPE
from ctypes import c_void_p
from ctypes import c_int32
dNearCallback = CFUNCTYPE(None, c_void_p, dGeomID, dGeomID)
dQuadTreeSpaceCreate = loadOde('dQuadTreeSpaceCreate', dSpaceID, dSpaceID, dVector3, dVector3, c_int32)
dSweepAndPruneSpaceCreate = loadOde('dSweepAndPruneSpaceCreate', dSpaceID, dSpaceID, c_int32)
dSpaceDestroy = loadOde('dSpaceDestroy', None, dSpaceID)
dHashSpaceSetLevels = loadOde('dHashSpaceSetLevels', None, dSpaceID, c_int32, c_int32)
dHashSpaceGetLevels = loadOde('dHashSpaceGetLevels', None, dSpaceID, POINTER(c_int32), POINTER(c_int32))
dSpaceSetCleanup = loadOde('dSpaceSetCleanup', None, dSpaceID, c_int32)
dSpaceGetCleanup = loadOde('dSpaceGetCleanup', c_int32, dSpaceID)
dSpaceSetSublevel = loadOde('dSpaceSetSublevel', None, dSpaceID, c_int32)
dSpaceGetSublevel = loadOde('dSpaceGetSublevel', c_int32, dSpaceID)
dSpaceSetManualCleanup = loadOde('dSpaceSetManualCleanup', None, dSpaceID, c_int32)
dSpaceGetManualCleanup = loadOde('dSpaceGetManualCleanup', c_int32, dSpaceID)
dSpaceAdd = loadOde('dSpaceAdd', None, dSpaceID, dGeomID)
dSpaceRemove = loadOde('dSpaceRemove', None, dSpaceID, dGeomID)
dSpaceQuery = loadOde('dSpaceQuery', c_int32, dSpaceID, dGeomID)
dSpaceClean = loadOde('dSpaceClean', None, dSpaceID)
dSpaceGetNumGeoms = loadOde('dSpaceGetNumGeoms', c_int32, dSpaceID)
dSpaceGetGeom = loadOde('dSpaceGetGeom', dGeomID, dSpaceID, c_int32)
dSpaceGetClass = loadOde('dSpaceGetClass', c_int32, dSpaceID)
| 45.933333 | 104 | 0.786164 |
a3fdeb4319b73c8b5241edc4f4a1fca818eec403 | 4,279 | py | Python | pctest/test_publish.py | DaveWK/pyth-client | 4332ef3287f584be46ec38ddd800cae8d4e7b792 | [
"Apache-2.0"
] | null | null | null | pctest/test_publish.py | DaveWK/pyth-client | 4332ef3287f584be46ec38ddd800cae8d4e7b792 | [
"Apache-2.0"
] | null | null | null | pctest/test_publish.py | DaveWK/pyth-client | 4332ef3287f584be46ec38ddd800cae8d4e7b792 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python3
# pip3 install websockets
import asyncio
import websockets
import json
import datetime
import sys
# wbsocket event loop
# connect to pythd, subscribe to and start publishing on two symbols
if __name__ == '__main__':
uri='ws://localhost:8910'
eloop = asyncio.get_event_loop()
try:
eloop.run_until_complete( poll( uri ) )
except ConnectionRefusedError:
print( f'connection refused uri={uri}' )
sys.exit(1)
| 28.151316 | 77 | 0.597803 |
a3fdf673713dab6653653e81925c27451e5f5544 | 1,866 | py | Python | Python/other/merge_interval.py | TechSpiritSS/NeoAlgo | 08f559b56081a191db6c6b1339ef37311da9e986 | [
"MIT"
] | 897 | 2020-06-25T00:12:52.000Z | 2022-03-24T00:49:31.000Z | Python/other/merge_interval.py | AnshikaAgrawal5501/NeoAlgo | d66d0915d8392c2573ba05d5528e00af52b0b996 | [
"MIT"
] | 5,707 | 2020-06-24T17:53:28.000Z | 2022-01-22T05:03:15.000Z | Python/other/merge_interval.py | AnshikaAgrawal5501/NeoAlgo | d66d0915d8392c2573ba05d5528e00af52b0b996 | [
"MIT"
] | 1,817 | 2020-06-25T03:51:05.000Z | 2022-03-29T05:14:07.000Z | '''
Given an array of intervals, merge all overlapping intervals,
and return an array of the non-overlapping intervals that cover all the intervals in the input.
Input: intervals = [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6].
'''
if __name__ == '__main__':
R = int(input("Enter the number of rows:"))
C = int(input("Enter the number of columns:"))
interval = [[int(input("Enter the elements: ")) for x in range (C)] for y in range(R)]
print("Overlapping interval: ",interval)
print("Non-overlapping intervals: ",merge(interval))
"""
Time complexity : O(n^2)
Space complexity : O(n^2)
INPUT:-
Enter the number of rows:4
Enter the number of columns:2
Enter the elements: 1
Enter the elements: 3
Enter the elements: 2
Enter the elements: 6
Enter the elements: 8
Enter the elements: 10
Enter the elements: 15
Enter the elements: 18
OUTPUT:-
Overlapping interval: [[1, 3], [2, 6], [8, 10], [15, 18]]
Non-overlapping intervals: [[1, 6], [8, 10], [15, 18]]
"""
| 29.619048 | 95 | 0.659164 |
a3fe08a8aed62efc53ccd8e1fe4f7bf8c6183509 | 9,708 | py | Python | tests/test_all.py | InnovativeTravel/humilis-lambdautils | 344e13efb68d19f61f0be8178eb6cc2219913fb0 | [
"MIT"
] | null | null | null | tests/test_all.py | InnovativeTravel/humilis-lambdautils | 344e13efb68d19f61f0be8178eb6cc2219913fb0 | [
"MIT"
] | null | null | null | tests/test_all.py | InnovativeTravel/humilis-lambdautils | 344e13efb68d19f61f0be8178eb6cc2219913fb0 | [
"MIT"
] | null | null | null | """Unit tests."""
import inspect
import json
from mock import Mock
import os
import sys
import uuid
import pytest
# Add the lambda directory to the python library search path
lambda_dir = os.path.join(
os.path.dirname(inspect.getfile(inspect.currentframe())), '..')
sys.path.append(lambda_dir)
import lambdautils.utils
def test_get_secret_from_env(monkeypatch):
"""Get a secret from an (encrypted) environment variable."""
key = str(uuid.uuid4()).replace('-', '.')
value = str(uuid.uuid4())
monkeypatch.setenv(key.replace('.', '_').upper(), value)
secret = lambdautils.utils.get_secret(key)
assert secret == value
def test_get_setting(monkeypatch):
"""Should be an alias for get_secret."""
resp = str(uuid.uuid4())
arg = str(uuid.uuid4())
kwarg = str(uuid.uuid4())
get_secret = Mock(return_value=resp)
monkeypatch.setattr("lambdautils.state.get_secret", get_secret)
resp2 = lambdautils.state.get_setting(arg, kwarg=kwarg)
assert resp2 == resp
get_secret.assert_called_with(arg, kwarg=kwarg)
def test_no_state_table(boto3_resource, monkeypatch):
"""Test accessing state variable without having a state table."""
monkeypatch.setattr("boto3.resource", boto3_resource)
monkeypatch.delenv("HUMILIS_ENVIRONMENT")
with pytest.raises(lambdautils.state.StateTableError):
lambdautils.utils.set_state("sample_state_key", "sample_state_value")
with pytest.raises(lambdautils.state.StateTableError):
lambdautils.utils.delete_state("sample_state_key")
with pytest.raises(lambdautils.state.StateTableError):
lambdautils.utils.get_state("sample_state_key")
def test_sentry_monitor_bad_client(boto3_client, raven_client, context,
monkeypatch):
"""Test that sentry_monitor handles raven client errors gracefully."""
monkeypatch.setattr("raven.Client", Mock(side_effect=raise_error))
monkeypatch.setattr("boto3.client", boto3_client)
lambda_handler(None, context)
raven_client.captureException.assert_not_called()
def test_send_to_kinesis_stream(search_events, boto3_client, monkeypatch):
"""Tests sending events to a Kinesis stream."""
monkeypatch.setattr("boto3.client", boto3_client)
lambdautils.utils.send_to_kinesis_stream(search_events, "dummy_stream")
boto3_client("kinesis").put_records.call_count == 1
def test_send_to_delivery_stream(search_events, boto3_client, monkeypatch):
"""Tests sending events to a Firehose delivery stream."""
monkeypatch.setattr("boto3.client", boto3_client)
lambdautils.utils.send_to_delivery_stream(search_events, "dummy_stream")
boto3_client("firehose").put_record_batch.call_count == 1
| 41.844828 | 79 | 0.642872 |
a3ff284c249c767a8e6d1b66a73bf03b2d790a9e | 366 | py | Python | packages/starcheck/post_regress.py | sot/ska_testr | dd84b89d0b5ebf6158c6cda4c1df432138044e20 | [
"MIT"
] | null | null | null | packages/starcheck/post_regress.py | sot/ska_testr | dd84b89d0b5ebf6158c6cda4c1df432138044e20 | [
"MIT"
] | 27 | 2016-10-19T19:39:46.000Z | 2022-03-04T14:56:40.000Z | packages/starcheck/post_regress.py | sot/ska_testr | dd84b89d0b5ebf6158c6cda4c1df432138044e20 | [
"MIT"
] | null | null | null | import os
from testr.packages import make_regress_files
regress_files = ['starcheck.txt',
'starcheck/pcad_att_check.txt']
clean = {'starcheck.txt': [(r'\s*Run on.*[\n\r]*', ''),
(os.environ['SKA'], '')],
'starcheck/pcad_att_check.txt': [(os.environ['SKA'], '')]}
make_regress_files(regress_files, clean=clean)
| 30.5 | 67 | 0.592896 |
430006e2469bed3f7e4c977ba2de4f246799468c | 1,714 | py | Python | testsite/wsgi.py | stungkit/djaodjin-saas | 93c8631509ffd5b0fb91283cd4a4aeaf9826e97e | [
"BSD-2-Clause"
] | null | null | null | testsite/wsgi.py | stungkit/djaodjin-saas | 93c8631509ffd5b0fb91283cd4a4aeaf9826e97e | [
"BSD-2-Clause"
] | null | null | null | testsite/wsgi.py | stungkit/djaodjin-saas | 93c8631509ffd5b0fb91283cd4a4aeaf9826e97e | [
"BSD-2-Clause"
] | null | null | null | """
WSGI config for testsite project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
"""
import os, signal
#pylint: disable=invalid-name
if os.getenv('DJANGO_COVERAGE'):
import atexit, sys
import coverage
cov = coverage.coverage(data_file=os.path.join(os.getenv('DJANGO_COVERAGE'),
".coverage.%d" % os.getpid()))
cov.start()
atexit.register(save_coverage)
try:
signal.signal(signal.SIGTERM, save_coverage)
except ValueError as e:
# trapping signals does not work with manage
# trying to do so fails with
# ValueError: signal only works in main thread
pass
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testsite.settings")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
#pylint: disable=invalid-name
application = get_wsgi_application()
| 34.979592 | 80 | 0.748541 |
4300329d7c7ed5214d1d6d7a95fd6dd634fbc6d1 | 11,269 | py | Python | authserver/maildaemons/forwarder/server.py | jdelic/authserver | e800664436b252fcdf224a9af46a1122c87be3ca | [
"MIT"
] | 8 | 2017-07-04T10:07:32.000Z | 2022-01-02T10:31:43.000Z | authserver/maildaemons/forwarder/server.py | jdelic/authserver | e800664436b252fcdf224a9af46a1122c87be3ca | [
"MIT"
] | 14 | 2020-02-11T21:42:38.000Z | 2022-03-28T16:00:55.000Z | authserver/maildaemons/forwarder/server.py | jdelic/authserver | e800664436b252fcdf224a9af46a1122c87be3ca | [
"MIT"
] | 1 | 2020-03-01T10:39:28.000Z | 2020-03-01T10:39:28.000Z | #!/usr/bin/env python3 -u
# -* encoding: utf-8 *-
import argparse
import asyncore
import json
import logging
import signal
import sys
import os
from types import FrameType
from typing import Tuple, Sequence, Any, Union, Optional, List, Dict
from concurrent.futures import ThreadPoolExecutor as Pool
import daemon
from django.db.utils import OperationalError
import authserver
from maildaemons.utils import SMTPWrapper, PatchedSMTPChannel, SaneSMTPServer
_log = logging.getLogger(__name__)
pool = Pool()
if __name__ == "__main__":
main()
| 45.623482 | 119 | 0.604401 |
430070d2630f84dfb573574ae265484cbf0ee429 | 2,074 | py | Python | services/backend/project/api/sites.py | kzkaneoka/custom-job-search | ca6054aee979cb1eff701dc5ba0cf56fb92baf44 | [
"MIT"
] | null | null | null | services/backend/project/api/sites.py | kzkaneoka/custom-job-search | ca6054aee979cb1eff701dc5ba0cf56fb92baf44 | [
"MIT"
] | 1 | 2021-06-02T00:51:06.000Z | 2021-06-02T00:51:06.000Z | services/backend/project/api/sites.py | kzkaneoka/custom-job-search | ca6054aee979cb1eff701dc5ba0cf56fb92baf44 | [
"MIT"
] | null | null | null | import requests
from bs4 import BeautifulSoup, element
| 38.407407 | 90 | 0.450338 |
4301cf37bd9ece6b54456c22562dfc5aa8e8a7cb | 748 | py | Python | product_details/utils.py | gene1wood/django-product-details | 53f245d76fa11d073ba686e0ece7b0293ec21942 | [
"BSD-3-Clause"
] | null | null | null | product_details/utils.py | gene1wood/django-product-details | 53f245d76fa11d073ba686e0ece7b0293ec21942 | [
"BSD-3-Clause"
] | null | null | null | product_details/utils.py | gene1wood/django-product-details | 53f245d76fa11d073ba686e0ece7b0293ec21942 | [
"BSD-3-Clause"
] | null | null | null | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from product_details import settings_defaults
def settings_fallback(key):
"""Grab user-defined settings, or fall back to default."""
try:
return getattr(settings, key)
except (AttributeError, ImportError, ImproperlyConfigured):
return getattr(settings_defaults, key)
| 29.92 | 63 | 0.720588 |
4302245408f7928b493623fbaac5ca5daff6a97c | 229 | py | Python | kattis/Soda Slurper.py | jaredliw/python-question-bank | 9c8c246623d8d171f875700b57772df0afcbdcdf | [
"MIT"
] | 1 | 2021-04-08T07:49:15.000Z | 2021-04-08T07:49:15.000Z | kattis/Soda Slurper.py | jaredliw/leetcode-solutions | 9c8c246623d8d171f875700b57772df0afcbdcdf | [
"MIT"
] | null | null | null | kattis/Soda Slurper.py | jaredliw/leetcode-solutions | 9c8c246623d8d171f875700b57772df0afcbdcdf | [
"MIT"
] | 1 | 2022-01-23T02:12:24.000Z | 2022-01-23T02:12:24.000Z | # CPU: 0.06 s
possessed, found, condition = map(int, input().split())
possessed += found
count = 0
while possessed >= condition:
div, mod = divmod(possessed, condition)
count += div
possessed = div + mod
print(count)
| 22.9 | 55 | 0.663755 |
430328989c54e456016360148c864a60ebe10a5f | 6,405 | py | Python | efficientdet/dataset/csv_.py | HyunjiEllenPak/automl | fedf04adf12c5fd11045ea06e2f5c11a5a5490c4 | [
"Apache-2.0"
] | null | null | null | efficientdet/dataset/csv_.py | HyunjiEllenPak/automl | fedf04adf12c5fd11045ea06e2f5c11a5a5490c4 | [
"Apache-2.0"
] | null | null | null | efficientdet/dataset/csv_.py | HyunjiEllenPak/automl | fedf04adf12c5fd11045ea06e2f5c11a5a5490c4 | [
"Apache-2.0"
] | null | null | null | """
Copyright 2017-2018 yhenon (https://github.com/yhenon/)
Copyright 2017-2018 Fizyr (https://fizyr.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
# from generators.common import Generator
import cv2
import numpy as np
from PIL import Image
from six import raise_from
import csv
import sys
import os.path as osp
from collections import OrderedDict
import os
def _parse(value, function, fmt):
"""
Parse a string into a value, and format a nice ValueError if it fails.
Returns `function(value)`.
Any `ValueError` raised is catched and a new `ValueError` is raised
with message `fmt.format(e)`, where `e` is the caught `ValueError`.
"""
try:
return function(value)
except ValueError as e:
raise_from(ValueError(fmt.format(e)), None)
def _read_classes(csv_reader):
"""
Parse the classes file given by csv_reader.
"""
result = OrderedDict()
for line, row in enumerate(csv_reader):
line += 1
try:
class_name, class_id = row
except ValueError:
raise_from(ValueError('line {}: format should be \'class_name,class_id\''.format(line)), None)
class_id = _parse(class_id, int, 'line {}: malformed class ID: {{}}'.format(line))
if class_name in result:
raise ValueError('line {}: duplicate class name: \'{}\''.format(line, class_name))
result[class_name] = class_id
return result
def _read_quadrangle_annotations(csv_reader, classes, detect_text=False):
"""
Read annotations from the csv_reader.
Args:
csv_reader: csv reader of args.annotations_path
classes: list[str] all the class names read from args.classes_path
Returns:
result: dict, dict is like {image_path: [{'x1': x1, 'y1': y1, 'x2': x2, 'y2': y2,
'x3': x3, 'y3': y3, 'x4': x4, 'y4': y4, 'class': class_name}]}
"""
result = OrderedDict()
for line, row in enumerate(csv_reader, 1):
try:
img_file, x1, y1, x2, y2, x3, y3, x4, y4, class_name = row[:10]
if img_file not in result:
result[img_file] = []
# If a row contains only an image path, it's an image without annotations.
if (x1, y1, x2, y2, x3, y3, x4, y4, class_name) == ('', '', '', '', '', '', '', '', ''):
continue
x1 = _parse(x1, int, 'line {}: malformed x1: {{}}'.format(line))
y1 = _parse(y1, int, 'line {}: malformed y1: {{}}'.format(line))
x2 = _parse(x2, int, 'line {}: malformed x2: {{}}'.format(line))
y2 = _parse(y2, int, 'line {}: malformed y2: {{}}'.format(line))
x3 = _parse(x3, int, 'line {}: malformed x3: {{}}'.format(line))
y3 = _parse(y3, int, 'line {}: malformed y3: {{}}'.format(line))
x4 = _parse(x4, int, 'line {}: malformed x4: {{}}'.format(line))
y4 = _parse(y4, int, 'line {}: malformed y4: {{}}'.format(line))
# check if the current class name is correctly present
if detect_text:
if class_name == '###':
continue
else:
class_name = 'text'
if class_name not in classes:
raise ValueError(f'line {line}: unknown class name: \'{class_name}\' (classes: {classes})')
result[img_file].append({'x1': x1, 'y1': y1, 'x2': x2, 'y2': y2,
'x3': x3, 'y3': y3, 'x4': x4, 'y4': y4, 'class': class_name})
except ValueError:
raise_from(ValueError(
f'line {line}: format should be \'img_file,x1,y1,x2,y2,x3,y3,x4,y4,class_name\' or \'img_file,,,,,\''),
None)
return result
def _read_annotations(csv_reader, classes, base_dir):
"""
Read annotations from the csv_reader.
Args:
csv_reader: csv reader of args.annotations_path
classes: list[str] all the class names read from args.classes_path
Returns:
result: dict, dict is like {image_path: [{'x1': x1, 'y1': y1, 'x2': x2, 'y2': y2, 'class': class_name}]}
"""
result = OrderedDict()
for line, row in enumerate(csv_reader, 1):
try:
img_file, x1, y1, x2, y2 = row[:5]
class_name = img_file.split("/")[0]
if img_file not in result:
result[img_file] = []
# If a row contains only an image path, it's an image without annotations.
if (x1, y1, x2, y2, class_name) == ('', '', '', '', ''):
continue
x1 = _parse(x1, int, 'line {}: malformed x1: {{}}'.format(line))
y1 = _parse(y1, int, 'line {}: malformed y1: {{}}'.format(line))
x2 = _parse(x2, int, 'line {}: malformed x2: {{}}'.format(line))
y2 = _parse(y2, int, 'line {}: malformed y2: {{}}'.format(line))
if class_name not in classes:
raise ValueError(f'line {line}: unknown class name: \'{class_name}\' (classes: {classes})')
result[img_file].append({'x1': x1, 'y1': y1, 'x2': x2, 'y2': y2, 'class': class_name,
'filename':img_file})
except ValueError:
raise_from(ValueError(
f'line {line}: format should be \'img_file,x1,y1,x2,y2,class_name\' or \'img_file,,,,,\''),
None)
return result
def _open_for_csv(path):
"""
Open a file with flags suitable for csv.reader.
This is different for python2 it means with mode 'rb', for python3 this means 'r' with "universal newlines".
"""
if sys.version_info[0] < 3:
return open(path, 'rb')
else:
return open(path, 'r', newline='')
def load_image(path):
"""
Load an image at the image_index.
"""
image = cv2.imread(path)
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
return image | 37.023121 | 119 | 0.577518 |
430437fe39813c58d169d2be946182b08eb80151 | 200 | py | Python | hoover/site/wsgi.py | hoover/hoover | 84053b2479e966b0f639692c9e226261e3188709 | [
"MIT"
] | 15 | 2016-08-18T10:48:06.000Z | 2019-10-15T14:41:20.000Z | hoover/site/wsgi.py | hoover/hoover | 84053b2479e966b0f639692c9e226261e3188709 | [
"MIT"
] | 88 | 2019-10-28T14:55:16.000Z | 2021-05-14T12:42:52.000Z | hoover/site/wsgi.py | hoover/hoover | 84053b2479e966b0f639692c9e226261e3188709 | [
"MIT"
] | 14 | 2016-09-27T13:11:57.000Z | 2019-10-08T23:33:59.000Z | from . import events # noqa
from django.core.wsgi import get_wsgi_application
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hoover.site.settings")
application = get_wsgi_application()
| 25 | 71 | 0.81 |
4304c73b6843ca7119c4f1f8d49418f514b2fb58 | 9,413 | py | Python | submodules/hal/analysis/constraintTurnover/turnoverModel.py | pbasting/cactus | 833d8ca015deecdfa5d0aca01211632cdaca9e58 | [
"MIT-0"
] | null | null | null | submodules/hal/analysis/constraintTurnover/turnoverModel.py | pbasting/cactus | 833d8ca015deecdfa5d0aca01211632cdaca9e58 | [
"MIT-0"
] | null | null | null | submodules/hal/analysis/constraintTurnover/turnoverModel.py | pbasting/cactus | 833d8ca015deecdfa5d0aca01211632cdaca9e58 | [
"MIT-0"
] | null | null | null | #!/usr/bin/env python
#Copyright (C) 2013 by Glenn Hickey
#
#Released under the MIT license, see LICENSE.txt
#!/usr/bin/env python
"""This is a two-state continuous time markov model: 0: unconstratined. 1: constrained. There are two transition rates to go between states. lossRate: 1->0 and gainRate: 0->1. Probability Matrix and Stationary Distribution are computed from the two rates and a time t. (see pdf)
"""
import argparse
import os
import sys
import copy
import random
import math
from collections import defaultdict
import numpy as np
import subprocess
import tempfile
#constrained is always 1. unconstrained is always 0
# compute probability matrix from rates and time.
# compute stationary distribution from rates and time
# compute the absolute difference between the values of the
# probability matrix and stationary distribution computed from a given
# rate, and a set of absolute values of the same. This is a sum of four
# differences, 2 for the distribution, 4 for the matrix.
# compute the sum of squared differences for a pair of rate parameters
# and a set of data points. Each data point is a 3 tuple:
# (1x2 stationary distribution pi, 2x2 probability matrix P, time t)
# use really simple gradient descent type approach to find rate values that
# minimize the squared difference with some data points. Each data point
# is a 3-tuple as described above. The gradient descent iteratres over
# maxIt iterations. Each iteration it tries to add and subtract delta from
# the current best rates (4 combinations: add delta to gain, add delta to loss,
# subtract delta from gain, subtract delta from loss). The best pair
# of rate parameters are returned, along with their square difference from
# the data.
# add some noise to parameters
# generate some random "estimated" parameters for values of t
# within a given range. random noise is added as specifed by maxNoise
if __name__ == "__main__":
sys.exit(main())
| 38.577869 | 282 | 0.566769 |
430510812312a4bfda7f6ca962f49716cd0833a8 | 3,610 | py | Python | SimpleBudget/SimpleBudget/budgets/tests.py | speratus/SimpleBudget | d4903db8693694572c4bcb367fe4a318a3867d68 | [
"MIT"
] | null | null | null | SimpleBudget/SimpleBudget/budgets/tests.py | speratus/SimpleBudget | d4903db8693694572c4bcb367fe4a318a3867d68 | [
"MIT"
] | null | null | null | SimpleBudget/SimpleBudget/budgets/tests.py | speratus/SimpleBudget | d4903db8693694572c4bcb367fe4a318a3867d68 | [
"MIT"
] | null | null | null | from django.test import TestCase
from .validators import validate_budget_period
from .models import Budget, Expense, Payment
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
| 39.67033 | 122 | 0.495568 |
43064e88b72bbd60715e819272f83d07fbf6fa68 | 322 | py | Python | feed/migrations/0002_remove_player_finished_decks.py | kubapi/hater | fe4ef653e169143b9ea8cc17494e8e35b2a7bc76 | [
"MIT"
] | null | null | null | feed/migrations/0002_remove_player_finished_decks.py | kubapi/hater | fe4ef653e169143b9ea8cc17494e8e35b2a7bc76 | [
"MIT"
] | null | null | null | feed/migrations/0002_remove_player_finished_decks.py | kubapi/hater | fe4ef653e169143b9ea8cc17494e8e35b2a7bc76 | [
"MIT"
] | null | null | null | # Generated by Django 3.2.3 on 2021-06-13 19:58
from django.db import migrations
| 17.888889 | 47 | 0.583851 |
4306c6bd0579b126c04f1694e74e21eaed99d124 | 3,440 | py | Python | var/spack/repos/builtin/packages/abacus/package.py | jeanbez/spack | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | var/spack/repos/builtin/packages/abacus/package.py | jeanbez/spack | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | var/spack/repos/builtin/packages/abacus/package.py | jeanbez/spack | f4e51ce8f366c85bf5aa0eafe078677b42dae1ba | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2 | 2019-02-08T20:37:20.000Z | 2019-03-31T15:19:26.000Z | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
from spack.package import *
| 29.655172 | 92 | 0.57907 |
4307d8063e06e64e479cf930dd3456b183590f95 | 98 | py | Python | test/regression/features/arithmetic/mult.py | ppelleti/berp | 30925288376a6464695341445688be64ac6b2600 | [
"BSD-3-Clause"
] | 137 | 2015-02-13T21:03:23.000Z | 2021-11-24T03:53:55.000Z | test/regression/features/arithmetic/mult.py | ppelleti/berp | 30925288376a6464695341445688be64ac6b2600 | [
"BSD-3-Clause"
] | 4 | 2015-04-01T13:49:13.000Z | 2019-07-09T19:28:56.000Z | test/regression/features/arithmetic/mult.py | bjpop/berp | 30925288376a6464695341445688be64ac6b2600 | [
"BSD-3-Clause"
] | 8 | 2015-04-25T03:47:52.000Z | 2019-07-27T06:33:56.000Z | print(18 * 1234)
print(18 * 1234 * 2)
print(0 * 1)
print(1 * 0)
print(0.0 * 1.0)
print(1.0 * 0.0)
| 14 | 20 | 0.561224 |
4307e6cee1e0a5d05e36c874e743174e0b006360 | 354 | py | Python | 001146StepikPyBegin/Stepik001146PyBeginсh02p05st15C09_20200411.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | 001146StepikPyBegin/Stepik001146PyBeginсh02p05st15C09_20200411.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | 001146StepikPyBegin/Stepik001146PyBeginсh02p05st15C09_20200411.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | num = int(input())
d1 = (num % 10 ** 4) // 10 ** 3
d2 = (num % 10 ** 3) // 10 ** 2
d3 = (num % 10 ** 2) // 10
d4 = num % 10
print(" ", d1)
print(" ", d2)
print(" ", d3)
print(" ", d4)
# print("Python", , "is the best")
_quit = 1
print(_quit * 2)
| 27.230769 | 43 | 0.596045 |
43099e0956c66d804368b7d95ddbb6f01a3756de | 2,349 | py | Python | WP3/Task3.2/spark/shared/addcountry2dataset.py | on-merrit/ON-MERRIT | a21324a54a6365f2f769b5952b0cf5347a97d480 | [
"MIT"
] | 2 | 2019-12-10T13:10:58.000Z | 2019-12-13T10:11:41.000Z | WP3/Task3.2/spark/shared/addcountry2dataset.py | on-merrit/ON-MERRIT | a21324a54a6365f2f769b5952b0cf5347a97d480 | [
"MIT"
] | 4 | 2020-03-31T12:13:45.000Z | 2020-04-15T15:59:17.000Z | WP3/Task3.2/spark/shared/addcountry2dataset.py | on-merrit/ON-MERRIT | a21324a54a6365f2f769b5952b0cf5347a97d480 | [
"MIT"
] | 1 | 2020-02-26T08:52:39.000Z | 2020-02-26T08:52:39.000Z | import csv
from os import listdir
from os.path import isfile, join
from osgeo import ogr
from multiprocessing import Pool
driver = ogr.GetDriverByName('GeoJSON')
countryFile = driver.Open("../data/external/countries.json")
layer = countryFile.GetLayer()
def getCountry(lat, lng):
"""
Checks given gps-incoming coordinates for country.
Output is either country shape index or None
"""
point = ogr.Geometry(ogr.wkbPoint)
point.AddPoint(lng, lat)
for i in range(layer.GetFeatureCount()):
country = layer.GetFeature(i)
if country.geometry().Contains(point):
return Country(country).iso
# nothing found
return None
def process_chunk(file):
with open(file, 'r') as read_obj, open(f"{file}_done.csv", 'w') as write_obj:
# pass the file object to reader() to get the reader object
csv_reader = csv.reader(read_obj)
csv_writer = csv.writer(write_obj)
# Iterate over each row in the csv using reader object
count=0
for row in csv_reader:
# row variable is a list that represents a row in csv
if row[2] and row[3]:
country = getCountry(float(row[2]), float(row[3]))
row.append(country)
csv_writer.writerow(row)
count+=1
if count%100==0:
print(f"File {file} progress: {count}/100000")
print(f"Processing {file} terminated")
allfiles = [join("q1a_latlon_split", f) for f in listdir("q1a_latlon_split") if isfile(join("q1a_latlon_split", f))]
with Pool(32) as p:
p.map(process_chunk, allfiles)
| 27.313953 | 116 | 0.635164 |
430aa61162281dff31190e84ebaac0dead9910f0 | 3,126 | py | Python | ai-experiments/sudoku/rdisplay.py | Henchel-Santillan/open-ai | 545bf8468330dce7e705c17e0ac4ce3889f20d5b | [
"MIT"
] | null | null | null | ai-experiments/sudoku/rdisplay.py | Henchel-Santillan/open-ai | 545bf8468330dce7e705c17e0ac4ce3889f20d5b | [
"MIT"
] | null | null | null | ai-experiments/sudoku/rdisplay.py | Henchel-Santillan/open-ai | 545bf8468330dce7e705c17e0ac4ce3889f20d5b | [
"MIT"
] | null | null | null | import cv2
import numpy as np
def process_core(image):
'''
Returns an inverted preprocessed binary image, with noise
reduction achieved with greyscaling, Gaussian Blur, Otsu's Threshold, and
an open morph.
'''
#apply greyscaling, Gaussian Blur, and Otsu's Threshold
greyscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(greyscale, (3, 3), 0)
threshold = cv2.threshold(blur, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]
#apply an open morph to invert image to remove noise
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3))
invert = 255 - cv2.morphologyEx(threshold, cv2.MORPH_OPEN, kernel, iterations=1)
return invert
#Transform the perspective to render as if looking down on paper (top-down view)
#Process the grid based on expected clean binary image input
| 35.931034 | 102 | 0.636596 |
430abd204ed6b789ffeb3c172d2bcf921345ff43 | 7,419 | py | Python | pythia/tasks/base_task.py | abhiskk/pythia | c33fb45d74353c25b6269b44551bcafefecb5c7e | [
"BSD-3-Clause"
] | 2 | 2019-05-23T02:07:03.000Z | 2019-06-08T18:56:05.000Z | pythia/tasks/base_task.py | abhiskk/pythia | c33fb45d74353c25b6269b44551bcafefecb5c7e | [
"BSD-3-Clause"
] | null | null | null | pythia/tasks/base_task.py | abhiskk/pythia | c33fb45d74353c25b6269b44551bcafefecb5c7e | [
"BSD-3-Clause"
] | null | null | null | # Copyright (c) Facebook, Inc. and its affiliates.
"""
Tasks come above datasets in hierarchy level. In case you want to
implement a new task, you need to inherit ``BaseTask`` class. You need
to implement ``_get_available_datasets`` and ``_preprocess_item`` functions
to complete the implementation. You can check the source to see if you need
to override any other methods like ``prepare_batch``.
Check example of ``VQATask`` here_.
Example::
from pythia.tasks.base_task import BaseTask
from pythia.common.registry import registry
@registry.register_task("my")
class MyTask(BaseTask):
def __init__(self):
super().__init__("my")
def _get_available_datasets(self):
return ["my"]
def _preprocess_item(self):
item.text = None
return item
.. _here: https://github.com/facebookresearch/pythia/blob/v0.3/pythia/tasks/vqa/vqa_task.py
"""
import sys
import numpy as np
from torch.utils.data import Dataset
from pythia.common.registry import registry
| 31.841202 | 91 | 0.604529 |
430bbb9266cf6f1301fe26015af1bcd016d7ae1a | 862 | py | Python | src/gauss_n.py | Konstantysz/InterGen | 1a1d0bde165f864daea70c6339a9b8426343fdd9 | [
"MIT"
] | null | null | null | src/gauss_n.py | Konstantysz/InterGen | 1a1d0bde165f864daea70c6339a9b8426343fdd9 | [
"MIT"
] | null | null | null | src/gauss_n.py | Konstantysz/InterGen | 1a1d0bde165f864daea70c6339a9b8426343fdd9 | [
"MIT"
] | null | null | null | from numba import jit
import numpy as np | 26.121212 | 66 | 0.598608 |
430c4f20a5d171398035a332ff9b2e75bf80435b | 5,403 | py | Python | satori.core/satori/core/export/pc.py | Cloud11665/satori-git | ea1855a920c98b480423bf247bce6e5626985c4a | [
"MIT"
] | 4 | 2021-01-05T01:35:36.000Z | 2021-12-13T00:05:14.000Z | satori.core/satori/core/export/pc.py | Cloud11665/satori-git | ea1855a920c98b480423bf247bce6e5626985c4a | [
"MIT"
] | 2 | 2020-06-06T01:12:07.000Z | 2020-06-06T01:16:01.000Z | satori.core/satori/core/export/pc.py | Cloud11665/satori-git | ea1855a920c98b480423bf247bce6e5626985c4a | [
"MIT"
] | 2 | 2021-01-05T01:33:30.000Z | 2021-03-06T13:48:21.000Z | # vim:ts=4:sts=4:sw=4:expandtab
from token import token_container
from satori.core.export.type_helpers import DefineException
AccessDenied = DefineException('AccessDenied', 'You don\'t have rights to call this procedure')
def init():
global Privilege
from satori.core.models import Privilege
| 29.686813 | 105 | 0.661299 |