repo_name stringlengths 7 65 | path stringlengths 5 186 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 941 973k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 5 100 | line_max int64 26 999 | alpha_frac float64 0.25 0.93 | ratio float64 1.5 7.35 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
demisto/content | Packs/PerimeterX/Integrations/BotDefender/BotDefender.py | 2 | 11145 | from typing import Dict
from CommonServerPython import * # noqa: E402 lgtm [py/polluting-import]
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
# CONSTANTS
DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
class pXScoring:
"""
Class to handle all current and future scoring for PerimeterX object... | mit | af9516bbe75fbbb115966e507c372f4d | 32.169643 | 128 | 0.603858 | 4.069003 | false | false | false | false |
demisto/content | Packs/Incapsula/Scripts/IncapWhitelistCompliance/IncapWhitelistCompliance.py | 2 | 3650 | import re
from CommonServerPython import * # noqa: F401
import demistomock as demisto # noqa: F401
# Consts
COMPLIANCE_LABEL = "Compliance"
CURL_GET_COMMAND = 'curl --insecure -L -I -m 1 http://{0} | grep -C 1 "200 OK"'
HTTP_OK = "200 OK"
MAIL_TO_RECIPIENT = "IncapsulaUpdates@demisto.com"
INCAPSULA_WARNING = "****... | mit | 63db9dbcf18d2cbeb5b3c7604963f67a | 36.628866 | 115 | 0.533151 | 3.624628 | false | false | false | false |
demisto/content | Packs/Malwarebytes/Integrations/Malwarebytes/Malwarebytes_test.py | 1 | 69530 | import demistomock as demisto
from Malwarebytes import scan_and_remediate, scan_and_report, isolate_endpoint, list_endpoint_info, \
isolate_process, isolate_network, isolate_desktop, deisolate_endpoint,\
scan_detections, scan_status, fetch_incidents, list_all_endpoints, open_sa_incident,\
remediate_sa_incid... | mit | 5c4c25f1e9f351faaee7bd5147268e46 | 37.161361 | 127 | 0.543751 | 3.434598 | false | false | false | false |
demisto/content | Packs/MapPattern/Scripts/MapPattern/MapPattern.py | 2 | 17731 | import fnmatch
import json
import re
from typing import Any, Dict, Generator, List, Optional, Tuple, Union
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
DEFAULT_ALGORITHM = 'literal'
DEFAULT_PRIORITY = 'first_match'
def demisto_get(obj: Any, path: Any) -> Any:
"""
... | mit | 8c9b9030262ff8d5bc7d38b4d2cb3e14 | 38.055066 | 126 | 0.53601 | 4.674664 | false | false | false | false |
demisto/content | Packs/TaniumThreatResponse/Integrations/TaniumThreatResponseV2/TaniumThreatResponseV2.py | 2 | 85663 | import ast
import copy
import json
import os
import traceback
import urllib.parse
from typing import Any, List, Tuple
import demistomock as demisto # noqa: F401
import urllib3
from CommonServerPython import * # noqa: F401
from dateutil.parser import parse
from lxml import etree
''' IMPORTS '''
urllib3.disable_warn... | mit | 06d57d2abc7feced6b690c3fea845c2a | 39.274095 | 129 | 0.629058 | 3.763587 | false | false | false | false |
demisto/content | Packs/PhishingURL/Scripts/DBotUpdateLogoURLPhishing/DBotUpdateLogoURLPhishing.py | 2 | 11040 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import dill
from PIL import Image
import io
MAJOR_VERSION = 1
MINOR_DEFAULT_VERSION = 0
URL_PHISHING_MODEL_NAME = "url_phishing_model"
MSG_EMPTY_NAME_OR_URL = "Empty logo name or/and logo image ID"
MSG_EMPTY_LOGO_NAME ... | mit | 3c1f7589860c929d62fa6362798686c8 | 36.808219 | 120 | 0.630978 | 3.493671 | false | false | false | false |
demisto/content | Packs/DuoAdminApi/Integrations/DuoEventCollector/DuoEventCollector.py | 2 | 7292 | from collections import deque
from enum import Enum
import duo_client
from pydantic import BaseModel # pylint: disable=E0611
from CommonServerPython import *
VENDOR = "duo"
PRODUCT = "duo"
class LogType(str, Enum):
"""
A list that represent the types of log collecting
"""
AUTHENTICATION = 'AUTHENTIC... | mit | de997fe3addd827b79c9e6f6ff2b72a0 | 35.46 | 110 | 0.581596 | 4.024283 | false | false | false | false |
demisto/content | Packs/Salesforce/Integrations/Salesforce_IAM/Salesforce_IAM.py | 2 | 18041 | import demistomock as demisto
from CommonServerPython import *
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
DEFAULT_OUTGOING_MAPPER = "User Profile - Salesforce (Outgoing)"
DEFAULT_INCOMING_MAPPER = "User Profile - Salesforce (Incoming)"
URI_PREFIX = '/services/data/v44.0/'
GENERATE_TOKEN... | mit | 8cb043b711aa2a5486b39982bf9def3b | 38.13449 | 120 | 0.528574 | 4.338865 | false | false | false | false |
demisto/content | Packs/OnboardingIntegration/Integrations/OnboardingIntegration/OnboardingIntegration.py | 2 | 41856 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
'''IMPORTS'''
from faker import Faker
from faker.providers import internet, misc, lorem, user_agent
from datetime import datetime
import json
import random
import math
from email.mime.multipart import MIMEMultipart
from ... | mit | 41be3c1aa7c1b77940de476829adccbf | 43.012618 | 119 | 0.5237 | 4.07437 | false | false | false | false |
demisto/content | Packs/CovalenceManagedSecurity/Integrations/CovalenceManagedSecurity/CovalenceManagedSecurity.py | 2 | 12887 | import os
import requests
import traceback
import json
from datetime import datetime, timedelta
from requests import HTTPError
from CommonServerPython import *
import demistomock as demisto
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
EMAIL = demisto.params().get('credentials')['identifier']
API_KEY = demisto.params().get('crede... | mit | 799510084dffb8fc661123c971bdd45a | 35.098039 | 117 | 0.539148 | 3.914642 | false | false | false | false |
demisto/content | Packs/Qintel/Integrations/QintelQSentry/QintelQSentry.py | 2 | 5527 | import demistomock as demisto
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
''' IMPORTS '''
import urllib3
from typing import Dict, Any
from datetime import datetime
from dateutil.parser import parse as parse_dt
from pytz import utc as pyutc
import traceback
# Disable insecure war... | mit | a1ea0240a6c166fb6ea5276e9ccbd82d | 22.419492 | 81 | 0.58169 | 3.515903 | false | false | false | false |
demisto/content | Packs/FeedCyjax/Integrations/FeedCyjax/FeedCyjax.py | 2 | 19322 | import demistomock as demisto
from CommonServerPython import *
import urllib3
import traceback
import dateparser
from datetime import datetime, timezone, timedelta
from typing import Any, Dict, Tuple, List, Optional
import cyjax as cyjax_sdk
from cyjax.exceptions import UnauthorizedException, TooManyRequestsException... | mit | e2e174bf9a4ef199b46607af3ff2ff8d | 32.662021 | 120 | 0.611479 | 3.989676 | false | false | false | false |
demisto/content | Packs/CommonScripts/Scripts/ExtractIndicatorsFromTextFile/ExtractIndicatorsFromTextFile.py | 2 | 1177 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
def extract_indicators_from_file(args):
try:
maxFileSize = int(args.get('maxFileSize'))
except Exception:
maxFileSize = 1024 ** 2
res = demisto.executeCommand('getFilePath', {
'id':... | mit | 3c85ec83525b78a8965eea4b265be28a | 25.75 | 81 | 0.605777 | 3.976351 | false | false | false | false |
demisto/content | Packs/DeveloperTools/Integrations/CreateIncidents/CreateIncidents.py | 2 | 6373 | import pathlib
from collections import namedtuple
import demistomock as demisto
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
import urllib3
from typing import Dict, Any
# Disable insecure warnings
urllib3.disable_warnings() # pylint: disable=no-member
''' CONSTANTS '''
Attachm... | mit | 71c6d3ab01018a959077e953875b7004 | 34.209945 | 115 | 0.636906 | 3.995611 | false | false | false | false |
demisto/content | Packs/epo/Integrations/epoV2/epoV2.py | 2 | 73109 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import json
import urllib3
import traceback
from typing import Any, Tuple, Dict
# Disable insecure warnings
urllib3.disable_warnings()
''' CONSTANTS '''
GET = 'GET'
DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
EPO_SYSTEM_ATTRI... | mit | fbfa93edfca9e8a229ebf90d7574b8aa | 38.327058 | 119 | 0.56305 | 4.298759 | false | false | false | false |
demisto/content | Packs/VMwareWorkspaceONEUEM/Integrations/VMwareWorkspaceONEUEM/VMwareWorkspaceONEUEM_test.py | 2 | 11840 | import json
import io
import pytest
from CommonServerPython import *
from VMwareWorkspaceONEUEM import Client, HTTP_ERROR, MESSAGES
from test_data import input_data
SERVER_URL = "https://host.awmdm.com"
BASE_URL = "https://host.awmdm.com/API/mdm/"
client = Client("user", "user123", BASE_URL, {'aw-tenant-code': "abed"... | mit | 2451df568c2b4767533f34390626ff0a | 38.205298 | 123 | 0.706841 | 3.387697 | false | true | false | false |
demisto/content | Packs/Cherwell/Integrations/Cherwell/Cherwell_test.py | 2 | 7223 | from datetime import datetime, timedelta
from CommonServerPython import date_to_timestamp
import demistomock as demisto
from Cherwell import cherwell_get_business_object_summary_command, cherwell_get_one_step_actions_command,\
get_one_step_actions_recursive
from unittest.mock import patch
BO_SUMMARY_RES = {"first... | mit | 20cd24ecfeea94ebd8bd7ff7d48b12e4 | 50.964029 | 121 | 0.642531 | 3.32092 | false | false | false | false |
demisto/content | Packs/ServiceDeskPlus/Integrations/ServiceDeskPlus/test_data/response_constants.py | 4 | 23890 | RESPONSE_CREATE_REQUEST = {
'request': {
'subject': 'Create request test',
'resolution': None,
'linked_to_request': None,
'mode': {
'name': 'E-Mail',
'id': '123640000000006665'
},
'lifecycle': None,
'is_read': False,
'cancellati... | mit | 81eb540208e6b3c7cf9aa8c46dbe0558 | 28.60347 | 104 | 0.443993 | 3.729899 | false | false | false | false |
demisto/content | Packs/MicrosoftGraphGroups/Integrations/MicrosoftGraphGroups/MicrosoftGraphGroups.py | 2 | 19527 | from typing import Dict, Tuple, Optional, Any
import demistomock as demisto
import urllib3
from CommonServerPython import *
# Disable insecure warnings
urllib3.disable_warnings()
INTEGRATION_CONTEXT_NAME = 'MSGraphGroups'
NO_OUTPUTS: dict = {}
APP_NAME = 'ms-graph-groups'
def camel_case_to_readable(text: str) -> s... | mit | ae1e2ec7a2c05da229a6d9c35263c7eb | 39.428571 | 129 | 0.621806 | 3.900719 | false | false | false | false |
demisto/content | Packs/McAfee_Advanced_Threat_Defense/Integrations/McAfee_Advanced_Threat_Defense/McAfee_Advanced_Threat_Defense.py | 1 | 30866 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import json
import re
import base64
import time
import requests
import urllib3
# disable insecure warnings
urllib3.disable_warnings()
''' PREREQUISITES '''
def load_server_url():
"""
Cleans a... | mit | 47ae79e31a18231d0bdd61d0b219e5f8 | 34.765933 | 110 | 0.572701 | 3.761394 | false | false | false | false |
demisto/content | Packs/AlienVault_OTX/Integrations/AlienVault_OTX_v2/AlienVault_OTX_v2_test.py | 2 | 32910 | # Import std packages
# Import 3-rd party packages
import pytest
# Import local packages
from AlienVault_OTX_v2 import \
calculate_dbot_score, Client, file_command, url_command, domain_command, ip_command, \
delete_duplicated_entities
from CommonServerPython import *
import demistomock as demisto
# DBot calc... | mit | a65bfa2c004ed0bda80e9558e810267b | 41.574386 | 129 | 0.539714 | 3.37089 | false | false | false | false |
demisto/content | Packs/GreyNoise/Integrations/GreyNoise_Community/test_data/input_data.py | 2 | 4022 | import copy
valid_ip_response = {
"ip": "71.6.135.131",
"noise": True,
"riot": False,
"classification": "benign",
"name": "Shodan.io",
"link": "https://viz.greynoise.io/ip/71.6.135.131",
"last_seen": "2021-05-10",
"message": "Success",
}
valid_riot_ip_response = {
"ip": "1.1.1.1",
... | mit | f49fe0982368e9bc6d3005474b9f3073 | 25.813333 | 106 | 0.531576 | 3.058555 | false | false | false | false |
demisto/content | Packs/PAN-OS/Integrations/Panorama/Panorama.py | 2 | 533265 | from collections import defaultdict
from dataclasses import dataclass, fields
from types import SimpleNamespace
import enum
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
import panos.errors
from panos.base import PanDevice, VersionedPanObject, Root, ENTRY, VersionedParamP... | mit | 8748a8bd98f28b0e07877340f78ca357 | 38.425181 | 197 | 0.604382 | 3.97514 | false | false | false | false |
demisto/content | Packs/Tenable_io/Integrations/TenableioEventCollector/TenableioEventCollector.py | 2 | 17223 | import time
from typing import Dict
import demistomock as demisto
import requests
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
# Disable insecure warnings
requests.packages.urllib3.disable_warnings() # pylint: disable=no-member
''' CONSTANTS '''
MAX_EVENTS_PER_REQUEST = 100
VEN... | mit | 1c9ec7b373eed6b6db414f81920b550f | 38.054422 | 120 | 0.606282 | 3.980356 | false | false | false | false |
demisto/content | Packs/Dropbox/Integrations/DropboxEventCollector/DropboxEventCollector.py | 2 | 7677 | # pylint: disable=no-name-in-module
# pylint: disable=no-self-argument
import json
import urllib3
from pydantic import parse_obj_as
from SiemApiModule import * # noqa: E402
urllib3.disable_warnings()
DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
VENDOR = "dropbox"
PRODUCT = "dropbox"
class DropboxEventsRequestConfig(Int... | mit | 3d8dcb57800041480a85724a7b225889 | 39.162304 | 118 | 0.630817 | 4.082491 | false | false | false | false |
demisto/content | Packs/CommonScripts/Scripts/FileReputation/FileReputation_test.py | 2 | 1600 | import demistomock as demisto
def test_file_reputation(mocker):
"""
Given:
- Script args: MD5 hash string.
When:
- Running the file_reputation function.
Then:
- Validating the outputs as expected.
"""
from FileReputation import file_reputation
mocker.patch.object... | mit | 9f165ee272951339fe374e2950367665 | 36.209302 | 118 | 0.66625 | 3.532009 | false | false | false | false |
demisto/content | Packs/Gatewatcher-AionIQ/Integrations/GCenter/GCenter.py | 2 | 44035 | """Base Integration for Cortex XSOAR (aka Demisto)"""
from typing import (
Any,
Dict
)
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
import urllib3
# Disable insecure warnings
urllib3.disable_warnings() # pylint: disable=no-member... | mit | 2d5838fd7866c97d7ce892519f7b3285 | 31.474189 | 107 | 0.550108 | 4.201011 | false | false | false | false |
demisto/content | Packs/Blueliv/Integrations/Blueliv/Blueliv.py | 2 | 2629 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
from sdk.blueliv_api import BluelivAPI
''' GLOBALS/PARAMS '''
TOKEN = demisto.params().get('token')
URL = demisto.params()['url']
SERVER = URL[:-1] if URL.endswith('/') else URL
if not demisto.params(... | mit | 836175c8ad60db588048a89104eae8ae | 25.29 | 74 | 0.693039 | 3.340534 | false | false | false | false |
demisto/content | Packs/iDefense/Integrations/iDefense_v2/test_data/response_constants.py | 2 | 8693 |
URL_RES_JSON = {
'results': [{'confidence': 50, 'display_text': 'http://www.malware.com',
'files': [{'confidence': 50, 'display_text': '934a72f37d861097c85dc3c2e16bca3c',
'key': '934a72f37d861097c85dc3c2e16bca3c', 'last_seen': '2020-10-07T20:26:30.000Z',
... | mit | a27d533e23d17fa480b95354d609f503 | 44.513089 | 120 | 0.521454 | 2.838067 | false | false | true | false |
demisto/content | Packs/Wordpress/Integrations/Wordpress/Wordpress.py | 2 | 21011 | import demistomock as demisto
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
import requests
import traceback
from typing import Callable, Dict
# Disable insecure warnings
requests.packages.urllib3.disable_warnings() # pylint: disable=no... | mit | 13568e54b6791d748f98ce21304caa9d | 33.444262 | 108 | 0.631574 | 3.68614 | false | false | false | false |
demisto/content | Packs/FeedIntel471/Integrations/Intel471Malware/Intel471Malware.py | 2 | 5671 | import jmespath
import demistomock as demisto
from CommonServerPython import *
from JSONFeedApiModule import * # noqa: E402
from typing import Dict
DEFAULT_COUNT = 100
SEARCH_PARAMS = {
'indicator': 'indicator',
'from': 'from',
'until': 'until',
'threat_type': 'threatType',
'malware_family': 'malw... | mit | 1324799145e2f7f34292a398ab4af13f | 36.806667 | 116 | 0.612943 | 3.687256 | false | false | false | false |
demisto/content | Packs/PrismaCloudCompute/Scripts/PrismaCloudComputeParseComplianceAlert/PrismaCloudComputeParseComplianceAlert.py | 2 | 1221 | import demistomock as demisto
from CommonServerPython import *
import json
def parse_compliance(raw_json):
data = json.loads(raw_json)
if data.get('kind') != 'compliance':
raise ValueError(f'Input should be a raw JSON compliance alert, received: {raw_json}')
outputs = {'PrismaCloudCompute.Compli... | mit | bacf24fa29e1d2b64b614c6a21436875 | 27.395349 | 99 | 0.616708 | 4.195876 | false | false | false | false |
demisto/content | Packs/AWS_Sagemaker/Integrations/AWSSagemaker/AWSSagemaker.py | 2 | 2077 | import json
import os
import sys
import boto3
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
if not demisto.params()['proxy']:
del os.environ['http_proxy']
del os.environ['https_proxy']
del os.environ['HTTP_PROXY']
del os.environ['HTTPS_PROXY']
def invoke_... | mit | 2c161fca283be7fb4a7b130de5268f01 | 32.5 | 106 | 0.636976 | 3.875 | false | false | false | false |
demisto/content | Packs/CommonScripts/Scripts/CopyNotesToIncident/CopyNotesToIncident.py | 2 | 1766 | import demistomock as demisto # noqa # pylint: disable=unused-wildcard-import
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa # pylint: disable=unused-wildcard-import
from typing import Dict, Any, List
import traceback
''' STANDALONE FUNC... | mit | 9e2e0709e67f9f320857a860ef76d70c | 27.95082 | 98 | 0.635334 | 3.710084 | false | false | false | false |
demisto/content | Packs/RsaNetwitnessSecurityAnalytics/Scripts/NetwitnessSAListIncidents/NetwitnessSAListIncidents.py | 2 | 1033 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
def netwitness_im_list_incidents():
resp = demisto.executeCommand("netwitness-im-list-incidents", demisto.args())
if isError(resp[0]):
result = resp
else:
data = demisto.get(resp[0], "Contents.incid... | mit | 2a2c7b8fc0b3472a888edcb718a8bca8 | 32.322581 | 103 | 0.605034 | 3.650177 | false | false | false | false |
demisto/content | Packs/PrismaCloud/Integrations/RedLock/RedLock.py | 1 | 34512 | import urllib3
from CommonServerPython import *
import demistomock as demisto
# disable insecure warnings
urllib3.disable_warnings() # pylint: disable=no-member
URL = ''
VERIFY = False
DEFAULT_LIMIT = 100
# Standard headers
HEADERS = {'Content-Type': 'application/json', 'Accept': '*/*'}
TOKEN = None
def get_toke... | mit | 3d582b270331bd45e8f997e7fc243e8a | 35.176101 | 121 | 0.575974 | 3.859971 | false | false | false | false |
demisto/content | Packs/NCSCCyberAsssessmentFramework/Scripts/NCSCReportDetailsA/NCSCReportDetailsA.py | 2 | 3754 | import json
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
def calculate_overall(data: dict = None) -> str:
if not data:
return ""
results = [x['Result'] for x in data]
if "Not Achieved" in results:
return "Not Achieved"
elif "Partially Achi... | mit | d05760f23627d1d71ade143e24564d7b | 42.149425 | 121 | 0.570858 | 4.049622 | false | false | false | false |
demisto/content | Packs/HackerOne/Integrations/HackerOne/HackerOne.py | 2 | 23887 | from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
import traceback
import demistomock as demisto
from typing import Callable, Dict, Tuple, Any
# Disable insecure warnings
requests.packages.urllib3.disable_warnings() # pylint: disable=no-memb... | mit | 16b83b6033fb2aa15b3d16ed8a862a1b | 34.440653 | 117 | 0.617072 | 3.969259 | false | false | false | false |
demisto/content | Packs/DeveloperTools/Scripts/CompareIndicators/CompareIndicators.py | 2 | 2764 | from typing import Tuple, Iterable
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
from netaddr import IPSet, IPRange
import re
CIDR_RE = re.compile(ipv4cidrRegex)
IP_RE = re.compile(ipv4Regex)
def extract_list_from_args(args: dict, list_key: str) -> List[str]:
ioc_lis... | mit | 6a26232a942b35580129198a98991e37 | 30.409091 | 108 | 0.60275 | 2.997831 | false | false | false | false |
demisto/content | Packs/MailListener/Integrations/MailListenerV2/MailListenerV2_test.py | 2 | 7071 | from datetime import datetime
import pytest
MAIL_STRING = br"""Delivered-To: to@test1.com
MIME-Version: 1.0
From: John Smith <from@test1.com>
Date: Mon, 10 Aug 2020 10:17:16 +0300
Subject: Testing email for mail listener
To: to@test1.com
Content-Type: multipart/alternative; boundary="0000000000002b271405ac80bf8b"
-... | mit | 09748fdc3cc20f00c6cb2cf6c0368254 | 30.008772 | 124 | 0.566478 | 3.568905 | false | true | false | false |
demisto/content | Packs/DeprecatedContent/Integrations/PaloAlto_MineMeld/PaloAlto_MineMeld.py | 2 | 27267 | import demistomock as demisto
from CommonServerPython import *
import urllib2
import json
import base64
import ssl
import os.path
import os
import time
import re
# globals and constants
IPV4_CLASS = 'minemeld.ft.local.YamlIPv4FT'
IPV6_CLASS = 'minemeld.ft.local.YamlIPv6FT'
URL_CLASS = 'minemeld.ft.local.YamlURLFT'
DOM... | mit | e91f06228bce144d60f6202a70696aa4 | 34.457737 | 128 | 0.551106 | 3.474388 | false | false | false | false |
demisto/content | Packs/FeedMitreAttackv2/Integrations/FeedMitreAttackv2/test_data/mitre_test_data.py | 2 | 33991 | ATTACK_PATTERN = {
'response': {
"id": "attack-pattern--01a5a209-b94c-450b-b7f9-946497d91055",
"name": "ATTACK_PATTERN 1",
"type": "attack-pattern",
"modified": "2020-05-13T22:50:51.258Z",
"created": "2017-05-31T21:30:44.329Z",
"description": "Adversaries may abuse Wi... | mit | 7049ef0081a5c9ebba86befd6dc06df8 | 50.974006 | 126 | 0.432791 | 3.616833 | false | false | true | false |
demisto/content | Packs/ExpanseV2/Scripts/ExpanseAggregateAttributionUser/ExpanseAggregateAttributionUser.py | 2 | 3646 | """ExpanseAggregateAttributionUser
"""
import demistomock as demisto
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
from typing import Dict, List, Any, Tuple, Optional
''' STANDALONE FUNCTION '''
def deconstruct_entry(entry: Dict[str... | mit | 5e74569c7f9e26e1daa9f06f9a4b9758 | 30.162393 | 112 | 0.602578 | 4.133787 | false | false | false | false |
demisto/content | Packs/CiscoWSA/Integrations/CiscoWSA/CiscoWSA.py | 2 | 10549 | from CommonServerPython import *
from CommonServerUserPython import *
''' CONSTANTS '''
DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
''' CLIENT CLASS '''
class Client(BaseClient):
def _httpp_request(self, method, url_suffix='', full_url=None, headers=None, auth=None, json_data=None,
params={}, da... | mit | 42118555c1c5d8d414938f46a934015e | 33.139159 | 118 | 0.545644 | 4.360893 | false | false | false | false |
demisto/content | Packs/PolySwarm/Integrations/PolySwarmV2/PolySwarmV2.py | 2 | 12761 | ''' IMPORTS '''
import demistomock as demisto
from CommonServerPython import *
from polyswarm_api.api import PolyswarmAPI
import socket
import io
''' CONSTANTS '''
POLYSWARM_DEMISTO_VERSION = '0.2.0'
ERROR_ENDPOINT = 'Error with endpoint: '
# Allows nested keys to be accesible
def makehash():
import collection... | mit | f1bafea0dc78d698de94fb5c8d75f178 | 34.645251 | 114 | 0.4933 | 4.603535 | false | false | false | false |
demisto/content | Packs/ImpossibleTraveler/Scripts/CalculateGeoDistance/CalculateGeoDistance.py | 2 | 1055 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import geopy.distance
requests.packages.urllib3.disable_warnings()
try:
# Extract each set of coordinates and create a list
src_coords_list = argToList(demisto.args()['src_coords'])
dest_coords_list = argTo... | mit | e89f0ff66002354ec2e6b6ad07c1b0ff | 35.37931 | 97 | 0.707109 | 3.552189 | false | false | false | false |
demisto/content | Packs/PingIdentity/Integrations/PingOne/PingOne.py | 2 | 18459 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
# IMPORTS
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
PROFILE_ARGS = [
'formatted',
'given',
'middle',
'family',
'nickname',
'title',
'locale',
'email',
'primaryP... | mit | b97100e275c11fa5c59ce720b0dae348 | 28.820679 | 120 | 0.562977 | 3.76407 | false | false | false | false |
demisto/content | Packs/GitLab/Integrations/GitLabv2/GitLabv2.py | 2 | 72548 | from xmlrpc.client import Boolean
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
from typing import Dict, Any, List
import urllib.parse
'''--------------------- CLIENT CLASS --------------------'''
class Client(BaseClient):
def __init__(self, project_id, base_... | mit | 64f58eac056e8fdf4419ccb10a069dc9 | 44.201246 | 130 | 0.600802 | 3.983527 | false | false | false | false |
demisto/content | Packs/PaloAltoNetworks_IoT3rdParty/Scripts/SendAllPANWIoTDevicesToServiceNow/SendAllPANWIoTDevicesToServiceNow.py | 2 | 6714 | import demistomock as demisto
from CommonServerPython import *
PANW_IOT_INSTANCE = "PANW IoT 3rd Party Integration Instance"
SERVICENOW_INSTANCE = "PANW IoT 3rd Party ServiceNow Integration Instance"
PAGE_SIZE = 100
SERVICENOW_TABLE_NAME = "u_zingbox_discovered_devices"
def send_status_to_panw_iot_cloud(status=None, ... | mit | 6c0bf8860d5d275747957305a50e1572 | 34.903743 | 106 | 0.608579 | 3.471562 | false | false | false | false |
demisto/content | Packs/ExportToXLSX/Scripts/ExportToXLSX/ExportToXLSX.py | 2 | 3612 | from typing import List, Optional, Union
from CommonServerPython import *
import demistomock as demisto
from xlsxwriter import Workbook
from xlsxwriter.format import Format
def write_data(sheet: str, data_item: Union[dict, list], data_headers: Optional[list], workbook: Workbook, bold: Format,
border: ... | mit | cb3d26a138e95b194aa7c4e3e057be63 | 33.730769 | 120 | 0.590532 | 3.921824 | false | false | false | false |
demisto/content | Packs/TOPdesk/Integrations/TOPdesk/TOPdesk_test.py | 2 | 46416 | import pytest
import demistomock as demisto
import json
import io
from TOPdesk import Client, INTEGRATION_NAME, MAX_API_PAGE_SIZE, \
fetch_incidents, entry_types_command, call_types_command, categories_command, subcategories_command, \
list_persons_command, list_operators_command, branches_command, get_incident... | mit | e3463942723f56c15662e6569c9e5730 | 42.501406 | 120 | 0.579089 | 3.60877 | false | true | false | false |
demisto/content | Packs/SecurityTrails/Integrations/SecurityTrails/SecurityTrails.py | 2 | 38873 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
''' CONSTANTS '''
removed_keys = ['endpoint', 'domain', 'hostname']
''' CLIENT CLASS '''
class Client(BaseClient):
def __init__(self, base_url, verify=True, proxy=False, ok_codes=tuple(), headers=None, auth=None, timeou... | mit | 7cb03285fa26191572bd806658e96b13 | 34.339091 | 118 | 0.552131 | 3.868345 | false | false | false | false |
demisto/content | Packs/Cyberint/Integrations/Cyberint/Cyberint.py | 2 | 26520 | # pylint: disable=unsubscriptable-object
from CommonServerPython import *
''' IMPORTS '''
from requests import Response
from contextlib import closing
import json
import requests
import dateparser
from typing import Dict, List, Optional, Tuple, Iterable
requests.packages.urllib3.disable_warnings()
''' C... | mit | 31c53e6a1d3cdb8e1933680280ff64b1 | 42.496644 | 119 | 0.57549 | 4.32697 | false | false | false | false |
demisto/content | Packs/Arkime/Integrations/Arkime/Arkime.py | 2 | 49163 | # ----------------------------------------- Imports ---------------------------
import copy
import math
from typing import Tuple, Callable
from requests import Response
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
from requests.auth import HTTPDigestAuth
import urllib3
#... | mit | 84e314d4d044d65d8d9a1ce77c42c5a8 | 43.251125 | 120 | 0.433904 | 5.450443 | false | false | false | false |
demisto/content | Packs/Tenable_io/Integrations/Tenable_io/Tenable_io_test.py | 2 | 5476 | import demistomock as demisto
MOCK_PARAMS = {
'access-key': 'fake_access_key',
'secret-key': 'fake_access_key',
'url': 'http://123-fake-api.com/',
'unsecure': True,
'proxy': True
}
MOCK_RAW_VULN_BY_ASSET = {
'vulnerabilities': [
{
'count': 117,
'plugin_family': ... | mit | be45617f78311786fef11882ef75f79b | 35.751678 | 108 | 0.616326 | 3.363636 | false | false | false | false |
demisto/content | Packs/NCSCCyberAsssessmentFramework/Scripts/NCSCCalculateQuestionsScore/NCSCCalculateQuestionsScore.py | 2 | 5019 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
args = demisto.args()
assessment = args.get("assessment")
assessment_results = args.get("assessment_results")
original_data = json.loads(
demisto.executeCommand("getList", {"listName": "NCSC CAF Assessment"})[0][
"Co... | mit | a7e79ae5c867f266358f5ea9400f2f8d | 29.981481 | 98 | 0.607292 | 4.0152 | false | false | false | false |
demisto/content | Packs/VirusTotal/Integrations/FeedRetrohunt/FeedRetrohunt_test.py | 2 | 5000 | from FeedRetrohunt import Client, fetch_indicators_command, main
import demistomock as demisto
from unittest.mock import call
MOCK_VT_JOBS = {
"data": [
{
"attributes": {
"status": "finished",
"finish_date": 1637921161,
"rules": "lorem ipsum",
... | mit | 550e8818158213cbe9f0fa539f795395 | 29.864198 | 101 | 0.52 | 3.360215 | false | false | false | false |
demisto/content | Packs/FeedProofpoint/Integrations/FeedProofpoint/FeedProofpoint_test.py | 2 | 1960 | import pytest
from FeedProofpoint import Client, fetch_indicators_command
from CommonServerPython import FeedIndicatorType
url = "https://example.com"
auth_code = "cool"
client = Client(url, auth_code)
def test_fetch_ips(requests_mock):
ip_path = "./TestData/detailed-iprep.txt"
with open(ip_path) as f:
... | mit | ebfcfae89f0df9d4bd89a17c4e5f7ebb | 33.385965 | 97 | 0.669388 | 3.450704 | false | true | false | false |
demisto/content | Packs/CommonScripts/Scripts/RunPollingCommand/RunPollingCommand_test.py | 2 | 1634 | # coding=utf-8
import pytest
from RunPollingCommand import prepare_arg_dict
IDS_ARGS = [
# sanity
(
('ids', ['a', 'b', 'c'], None, None, 'SomeIntegration'),
{'ids': 'a,b,c', 'using': 'SomeIntegration'},
),
# single ID
(
('ids', 'a', None, None),
{'ids': 'a'},
),... | mit | 5bee5ed98537d03aaca406ecb8e131cd | 26.827586 | 88 | 0.472739 | 2.667769 | false | true | false | false |
demisto/content | Packs/Gophish/Integrations/Gophish/Gophish.py | 2 | 11645 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
''' IMPORTS '''
import dateparser
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
def results_return(command, thingtoreturn):
results = CommandResults(
outputs_prefix='Gophish.' + str(com... | mit | 714c85185e3efbbba3fafd93ec6a7b51 | 50.299559 | 127 | 0.581967 | 3.854684 | false | false | false | false |
demisto/content | Packs/C2sec/Integrations/C2sec/C2sec.py | 2 | 7313 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import requests
# disable insecure warnings
requests.packages.urllib3.disable_warnings()
API_KEY = demisto.params()['apikey']
HEADERS = {
'Content-Type': 'application/json',
'Accept': 'applica... | mit | 8649f6f685247cbc827b511d8ac97792 | 34.158654 | 117 | 0.567209 | 3.940194 | false | false | false | false |
demisto/content | Packs/Troubleshoot/Scripts/TroubleshootTestInstance/TroubleshootTestInstance.py | 2 | 3157 | """
Gets an instance configuration and a parameter to modify, to check if is works.
"""
from typing import Iterable
from CommonServerPython import *
def get_errors(response: Union[list, dict]) -> List[str]:
errors = ''
if is_error(response):
errors = get_error(response)
return errors.splitlines()... | mit | 446cd5fe349934b8d5c15a007ec490c5 | 31.885417 | 124 | 0.573646 | 4.175926 | false | true | false | false |
demisto/content | Packs/CommonScripts/Scripts/UnPackFile/UnPackFile.py | 2 | 4441 | import os
from os.path import isdir, isfile
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
from pyunpack import Archive
filePath = None
fileEntryID = ''
if 'fileName' in demisto.args() or 'lastPackedFileInWarroom' in demisto.args():
entries = demisto.executeCommand('get... | mit | 63a96f3ef638f5885057ce1e2233dac3 | 40.12037 | 120 | 0.592434 | 3.990117 | false | false | false | false |
demisto/content | Packs/HealthCheck/Scripts/HealthCheckPlaybookAnalysis/HealthCheckPlaybookAnalysis.py | 2 | 5566 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
def findTopUsedPLaybooks(accountName):
stats = demisto.executeCommand(
"demisto-api-post",
{
"uri": f"{accountName}statistics/widgets/query",
"body": {
"size": 3,
... | mit | c8af489b9800be7d624777224555fe4b | 34.227848 | 120 | 0.612469 | 3.854571 | false | false | false | false |
demisto/content | Packs/PhishUp/Integrations/PhishUp/PhishUp.py | 2 | 5303 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import requests
# import dateparser
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
''' CONSTANTS '''
DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
class Client(BaseClient):
def in... | mit | 16491c094b15b896d27d3a8f43c26c2a | 30.565476 | 116 | 0.597775 | 3.755666 | false | false | false | false |
demisto/content | Packs/TOPdesk/Integrations/TOPdesk/TOPdesk.py | 2 | 72045 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
"""TOPdesk integration for Cortex XSOAR"""
import math
import os
import shutil
from distutils.version import LooseVersion
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import dateparser
import urllib3
... | mit | 60924c040ebdf8e3a3482bf4fe259208 | 42.244298 | 125 | 0.582206 | 4.304278 | false | false | false | false |
demisto/content | Packs/GoogleDocs/Integrations/GoogleDocs/GoogleDocs.py | 2 | 12494 | from CommonServerPython import *
''' IMPORTS '''
import urllib3
import httplib2
import urllib.parse
from oauth2client import service_account
from googleapiclient import discovery
import typing
from collections import defaultdict
# Disable insecure warnings
urllib3.disable_warnings()
''' GLOBALS/PARAMS '''
SCOPES ... | mit | 670f9bc2130117a61146ce89803263fd | 30.550505 | 120 | 0.618137 | 3.882536 | false | false | false | false |
demisto/content | Templates/Integrations/Authentication/Authentication.py | 2 | 16274 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
from typing import Dict, Tuple, List, AnyStr, Union
import urllib3
# Disable insecure warnings
urllib3.disable_warnings()
"""GLOBALS/PARAMS
Attributes:
INTEGRATION_NAME:
Name of the integra... | mit | f7443da413642363daf21c28920e6d5a | 34.767033 | 112 | 0.63328 | 3.922391 | false | false | false | false |
demisto/content | Packs/AnsibleAlibabaCloud/Integrations/AnsibleAlibabaCloud/AnsibleAlibabaCloud.py | 2 | 1670 | import ssh_agent_setup
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
# Import Generated code
from AnsibleApiModule import * # noqa: E402
host_type = 'local'
# MAIN FUNCTION
def main() -> None:
"""main function, parses params and runs command functions
:return:... | mit | 37f1656774631072ed76fc2b9fc05e1a | 28.298246 | 119 | 0.614371 | 3.901869 | false | false | false | false |
demisto/content | Packs/Thycotic/Integrations/Thycotic/test_data/context.py | 2 | 7438 | GET_PASSWORD_BY_ID_CONTEXT = {
'Thycotic.Secret.Password(val.secret_password && val.secret_password == obj.secret_password)': {
"Thycotic": {
"Secret": {
"Password": "test00111"
}
}
}
}
GET_USERNAME_BY_ID_CONTENT = {
'Thycotic.Secret.Username(val.secr... | mit | 8d77031d2c77f6f5282b3e0e70f80e47 | 30.922747 | 112 | 0.507932 | 3.896281 | false | false | false | false |
demisto/content | Packs/ContentManagement/Scripts/CommitFiles/CommitFiles.py | 2 | 8216 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
import os
import io
from os.path import exists
from typing import Dict
from contextlib import redirect_stderr, redirect_stdout
from demisto_sdk.commands.split.ymlsplitter import YmlSplitter
from demisto_sdk.commands.common.const... | mit | 1cbc2d913d833fa9d0868da57be99a46 | 32.672131 | 118 | 0.591772 | 3.584642 | false | false | false | false |
demisto/content | Packs/Exabeam/Integrations/Exabeam/Exabeam_test.py | 2 | 6979 | import pytest
from Exabeam import Client, contents_append_notable_user_info, contents_user_info, get_peer_groups, \
get_user_labels, get_watchlist, get_asset_data, get_session_info_by_id, get_rules_model_definition, \
parse_context_table_records_list, get_notable_assets, get_notable_session_details, get_notable... | mit | 76498222db0b65f56da2e7ff8db3d38f | 41.042169 | 119 | 0.615274 | 3.296646 | false | true | false | false |
demisto/content | Packs/RandomImages_VideosAndAudio/Scripts/RandomPhotoNasa/RandomPhotoNasa.py | 2 | 2155 | import random
from datetime import datetime
import demistomock as demisto # noqa: F401
import requests
from CommonServerPython import * # noqa: F401
args = demisto.args()
search = args.get('search', 'nebula')
widget_type = args.get('widgetType')
date_now = datetime.utcnow()
end_year = date_now.year
headers = {
... | mit | 52acb32cf5606f2d6582c0139cce1765 | 28.121622 | 83 | 0.565197 | 3.597663 | false | false | false | false |
demisto/content | Packs/Cymulate/Integrations/Cymulate/Cymulate.py | 2 | 17551 | from CommonServerPython import *
''' IMPORTS '''
import requests
import dateparser
from datetime import datetime, timedelta
import enum
# disable insecure warnings
requests.packages.urllib3.disable_warnings()
''' CONSTANTS '''
DATE_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
BASE_URL = 'https://api.cymulate.com/v1/'
DEFAULT_LIMIT... | mit | a4bd358de904015a5e4dacfa48ab7ca0 | 37.071584 | 120 | 0.554669 | 4.130619 | false | false | false | false |
demisto/content | Utils/github_workflow_scripts/run_secrets_detection.py | 2 | 1896 | #!/usr/bin/env python3
import argparse
import requests
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
SECRETS_INSTANCE_URL = "https://content-gold.paloaltonetworks.com/instance/execute/GenericWebhook_Secrets"
def arguments_handler():
""" Validates and parses script argument... | mit | d0a6e431be7f8141958fb051bf6c5899 | 30.081967 | 120 | 0.671941 | 3.869388 | false | false | false | false |
demisto/content | Packs/ServiceNow/Integrations/ServiceNow_IAM/ServiceNow_IAM.py | 2 | 14264 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
# noqa: F401
# noqa: F401
# noqa: F401
# noqa: F401
import traceback
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
IAM_GET_USER_ATTRIBUTES = ['id', 'user_name', 'email']
'''CLIENT CLASS'''
class C... | mit | 92ad2591ef48af8fdd1849725d6528e4 | 37.76087 | 112 | 0.564989 | 4.048822 | false | false | false | false |
demisto/content | Packs/ShiftManagement/Scripts/GetUsersOnCall/GetUsersOnCall.py | 2 | 2730 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
from typing import List
def filter_OOO_users(get_users_response, ooo_list_name):
"""
Given the response with all OnCall users, remove the users that are Out Of Office, using the list `OOO List`.
"""
al... | mit | 7e114ca5a01fab3eab6883c6fc940454 | 39.746269 | 127 | 0.636996 | 3.563969 | false | false | false | false |
demisto/content | Packs/FlashpointFeed/Integrations/FlashpointFeed/FlashpointFeed.py | 2 | 16004 | from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
import requests
import traceback
from typing import Dict, Any
# Disable insecure warnings
requests.packages.urllib3.disable_warnings() # pylint: disable=no-member
''' CONSTANTS '''
DATE_FO... | mit | 3e39b25bea36e0a1b4e25becd0edb438 | 33.196581 | 118 | 0.595914 | 4.023127 | false | false | false | false |
demisto/content | Packs/ConvertTimezoneFromUTC/Scripts/ConvertTimezoneFromUTC/ConvertTimezoneFromUTC.py | 2 | 1188 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
''' IMPORTS '''
import pytz
''' GLOBAL VARIABLES '''
args = demisto.args()
''' Helper Code '''
def determine_correct_format(time, fmt):
time = datetime.strptime(time, fmt)
return time
def convert_UTC_Timezone(tim... | mit | 908d3f257d48cf13cc44fb898c67e2e2 | 21 | 79 | 0.63468 | 3.678019 | false | false | false | false |
demisto/content | Packs/Cloaken/Integrations/Cloaken/Cloaken.py | 2 | 3296 | import demistomock as demisto
from CommonServerPython import *
import urllib3
from cloakensdk.client import SyncClient
from cloakensdk.resources import Url
from cloakensdk import utility
# Disable insecure warnings
urllib3.disable_warnings()
PROXY = handle_proxy("proxy", False)
def get_client():
server = demi... | mit | 6962db74022f5f3c4f4986a623dee9ed | 32.979381 | 92 | 0.570995 | 4.209451 | false | false | false | false |
demisto/content | Packs/F5LTM/Integrations/F5LTM/F5LTM.py | 2 | 14545 | from CommonServerPython import *
from CommonServerUserPython import *
import requests
import traceback
requests.packages.urllib3.disable_warnings()
''' CONSTANTS '''
DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
''' CLIENT CLASS '''
class Client(BaseClient):
def __init__(self, base_url: str, token: object, partition: ... | mit | 2a9f20a33fbc2611a389c1c35df76860 | 36.294872 | 118 | 0.599175 | 3.837731 | false | false | false | false |
houtianze/bypy | bypy/printer_util.py | 2 | 3034 | #!/usr/bin/env python
# encoding: utf-8
# PYTHON_ARGCOMPLETE_OK
# this file exists to avoid circular dependencies
# from __future__ imports must occur at the beginning of the file
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
import os
import math
import... | mit | a6b9ad58b8641fa33111a7d820af9929 | 20.51773 | 143 | 0.604483 | 2.495066 | false | false | false | false |
igordejanovic/parglare | tests/func/persistence/calc_with_actions/test_table_persistance.py | 1 | 2016 | import os
import time
from parglare import Grammar, Parser
this_folder = os.path.dirname(__file__)
def test_save_load_table():
"""
Test basic table save/load cycle with table file creation.
"""
calc_file = os.path.join(this_folder, 'calc.pg')
variable_file = os.path.join(this_folder, 'variable.pg... | mit | 66ced8b6387427d8a8a859d87394465b | 32.04918 | 77 | 0.671627 | 3.587189 | false | false | false | false |
igordejanovic/parglare | parglare/parser.py | 1 | 35162 | # -*- coding: utf-8 -*-
import io
import logging
from parglare.grammar import EMPTY, STOP
from parglare.tables import LALR, SLR, SHIFT, REDUCE, ACCEPT
from parglare.exceptions import (ParseError, ParserInitError,
DisambiguationError,
DynamicDisambiguatio... | mit | e6bc01e9202edadae8478d5b037b13e7 | 36.606417 | 85 | 0.494085 | 4.818032 | false | false | false | false |
igordejanovic/parglare | parglare/tables/persist.py | 1 | 3172 | import json
from collections import OrderedDict
def table_to_serializable(table):
"""Convert table object to serializable representation composed of
lists and dicts."""
# states
states = []
for state in table.states:
states.append(_dump_state(state))
return states
def save_table(fil... | mit | 618cb743304f3434b49b52c34a1edc50 | 30.098039 | 74 | 0.583859 | 3.849515 | false | false | false | false |
jiaaro/pydub | pydub/generators.py | 2 | 4045 | """
Each generator will return float samples from -1.0 to 1.0, which can be
converted to actual audio with 8, 16, 24, or 32 bit depth using the
SiganlGenerator.to_audio_segment() method (on any of it's subclasses).
See Wikipedia's "waveform" page for info on some of the generators included
here: http://en.wikipedia.... | mit | 0003e59900b46916aff3507a435179cd | 27.485915 | 154 | 0.587639 | 3.717831 | false | false | false | false |
flasgger/flasgger | examples/custom_validation_function.py | 3 | 7135 | import time
import jsonschema
try:
import simplejson as json
except ImportError:
import json
try:
from http import HTTPStatus
except ImportError:
import httplib as HTTPStatus
from flask import Flask
from flask import jsonify
from flask import request
from flasgger import Swagger
def drop_id_validate(d... | mit | b5a79e642513091af39b72e190d9f81c | 26.026515 | 87 | 0.601542 | 4.247024 | false | false | false | false |
flasgger/flasgger | examples/swagger_config_3_with_components_schemas.py | 1 | 3353 | """
In this example `openapi` version is used instead of `swagger` version.
"""
from flask import Flask
from flasgger import Swagger
app = Flask(__name__)
swagger_config = {
"headers": [],
"openapi": "3.0.2",
"components": {
"securitySchemes": {
"oAuthSample": {
"type":... | mit | 4be31b213ed5888596b450a6137a3cfd | 21.353333 | 84 | 0.482553 | 3.733853 | false | false | false | false |
thumbor/thumbor | thumbor/optimizers/__init__.py | 1 | 1404 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
import os
from tempfile import NamedTemporaryFile
class BaseOptim... | mit | d4c455ef696b732e26a2d351a737818f | 26.529412 | 87 | 0.611111 | 4.034483 | false | false | false | false |
thumbor/thumbor | tests/result_storages/test_no_storage.py | 2 | 1032 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from preggy import expect
from tornado.testing import gen_test
from... | mit | a5880f87162be777ea61ed4d120a3d65 | 27.666667 | 67 | 0.690891 | 3.595819 | false | true | false | false |
thumbor/thumbor | thumbor/engines/__init__.py | 1 | 12628 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
# This is a base class, it makes sense to have many public methods a... | mit | dd0405ca589e8e251668660e5ae75b3f | 28.924171 | 130 | 0.583307 | 3.998733 | false | false | false | false |
thumbor/thumbor | thumbor/error_handlers/sentry.py | 1 | 1857 | import sentry_sdk
from sentry_sdk.integrations.logging import ignore_logger
from sentry_sdk.utils import event_from_exception, exc_info_from_error
from thumbor import __version__
class ErrorHandler:
def __init__(self, config):
self.config = config
dsn = config.SENTRY_DSN_URL
if not dsn:... | mit | 60794719db546e449b607f4de6c4bc31 | 28.951613 | 73 | 0.57189 | 4.081319 | false | true | false | false |
thumbor/thumbor | thumbor/engines/gif.py | 1 | 5119 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
import re
from io import BytesIO
from shutil import which
from subpr... | mit | 8f3139e0a186c8178fc83208619b1d81 | 28.41954 | 85 | 0.58234 | 3.901677 | false | false | false | false |
danielperna84/pyhomematic | pyhomematic/devicetypes/sensors.py | 1 | 48974 | import logging
from pyhomematic.devicetypes.generic import HMDevice
from pyhomematic.devicetypes.misc import HMEvent, Remote
from pyhomematic.devicetypes.helper import (HelperLowBat, HelperSabotage,
HelperLowBatIP, HelperSabotageIP,
... | mit | 26f02b004bfe7b1a922727404f3439a2 | 35.357832 | 109 | 0.622249 | 3.731921 | false | false | false | false |
danielperna84/pyhomematic | pyhomematic/devicetypes/thermostats.py | 1 | 19176 | import logging
from pyhomematic.devicetypes.generic import HMDevice
from pyhomematic.devicetypes.sensors import AreaThermostat, IPAreaThermostat, IPAreaThermostatNoBattery
from pyhomematic.devicetypes.helper import HelperValveState, HelperBatteryState, HelperLowBat, HelperLowBatIP, HelperRssiPeer, HelperRssiDevice, Hel... | mit | e6b99e3362804afaac5b9e2897525a51 | 38.214724 | 156 | 0.580778 | 3.73947 | false | false | false | false |
danielperna84/pyhomematic | pyhomematic/vccu.py | 1 | 5112 | import os
import time
import logging
import threading
from xmlrpc.server import SimpleXMLRPCServer
from xmlrpc.server import SimpleXMLRPCRequestHandler
import xmlrpc.client
import json
LOG = logging.getLogger(__name__)
LOCAL = "127.0.0.1"
LOCALPORT = 2001
DEVICE_DESCRIPTIONS = "devicetypes/json/device_descriptions.jso... | mit | 1cd43a66bf6376095d336085b584a3df | 36.043478 | 108 | 0.61698 | 4.063593 | false | false | false | false |
arq5x/gemini | gemini/gemini_set_somatic.py | 3 | 5153 | #!/usr/bin/env python
from __future__ import absolute_import, print_function
from .gemini_constants import *
from . import gemini_subjects
from . import GeminiQuery
def tag_somatic_mutations(args):
t_n_pairs = gemini_subjects.get_families(args.db)
gq = GeminiQuery.GeminiQuery(args.db)
depth_string, qual... | mit | c5a5cf10c458244c88db8b2abdd49f62 | 35.546099 | 110 | 0.499709 | 3.510218 | false | false | false | false |
arq5x/gemini | gemini/gemini_merge_chunks.py | 3 | 7114 | #!/usr/bin/env python
from __future__ import absolute_import
import os
import shutil
import sqlite3
import sys
import uuid
import gemini.database as gemini_db
from gemini import gemini_load_chunk
def append_variant_info(main_curr, chunk_db):
"""
Append the variant and variant_info data from a chunk_db
t... | mit | 7183f83d2ef2e2f5a395e54399def96e | 28.27572 | 92 | 0.589963 | 3.580272 | false | false | false | false |
arq5x/gemini | gemini/gemini_load.py | 3 | 16137 | #!/usr/bin/env python
from __future__ import division, print_function
# native Python imports
import os.path
import shutil
import sys
from gemini import annotations
import subprocess
from cluster_helper.cluster import cluster_view
from gemini.gemini_load_chunk import GeminiLoader
import uuid
import time
import dateti... | mit | ca4b86d92224b164df90a5a2fdbe99b9 | 32.479253 | 102 | 0.599492 | 3.334091 | false | false | false | false |
matplotlib/basemap | examples/plotsst.py | 2 | 1838 | from __future__ import (absolute_import, division, print_function)
from mpl_toolkits.basemap import Basemap
from netCDF4 import Dataset, date2index
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
date = datetime(2007,12,15,0) # date to plot.
# open dataset.
dataset = \
Dataset('http://... | mit | f576286c36e34f62dc448c61db6da2ae | 40.772727 | 82 | 0.741567 | 2.959742 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.