prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | newlogentry = 'Malware Bazaar data has been generated to file here: <a href=\"' + output + '\"> Malware Bazaar Host Output </a>'
LOG.WriteSubLog(POE.logdir, POE.targetfilename, newlogentry) |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | newlogentry = 'Unable to write Malware Bazaar data to file'
LOG.WriteStrongSubLog(POE.logdir, POE.targetfilename, newlogentry)
POE.csv_line += 'N/A,' |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | with open(output.strip(), 'r') as read_file:
for string in read_file:
if (POE.debug == True):
print ('[DEBUG] string: ' + string.strip())
if ('first_seen' in string):
first_seen = string.strip() ... |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | print ('[DEBUG] string: ' + string.strip()) |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | first_seen = string.strip() |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | last_seen = string.strip() |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | signature = string.strip()
sig_count += 1 |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | newlogentry = 'Sample ' + first_seen.replace(',','')
LOG.WriteSubLog(POE.logdir, POE.targetfilename, newlogentry)
newlogentry = 'Sample ' + last_seen.replace(',','')
LOG.WriteSubLog(POE.logdir, POE.targetfilename, newlogentry)
newlogentry ... |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | print (colored('[-] The hash value has not been found...', 'yellow', attrs=['bold']))
if (POE.logging == True):
newlogentry = 'No results available for host...'
LOG.WriteSubLog(POE.logdir, POE.targetfilename, newlogentry) |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | newlogentry = 'No results available for host...'
LOG.WriteSubLog(POE.logdir, POE.targetfilename, newlogentry) |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | print (colored('[-] No results available for host...', 'yellow', attrs=['bold']))
if (POE.logging == True):
newlogentry = 'No results available for host...'
LOG.WriteSubLog(POE.logdir, POE.targetfilename, newlogentry) |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | newlogentry = 'No results available for host...'
LOG.WriteSubLog(POE.logdir, POE.targetfilename, newlogentry) |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | print (colored('[x] An error has occurred...', 'red', attrs=['bold']))
if (POE.logging == True):
newlogentry = 'An error has occurred...'
LOG.WriteSubLog(POE.logdir, POE.targetfilename, newlogentry) |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | newlogentry = 'An error has occurred...'
LOG.WriteSubLog(POE.logdir, POE.targetfilename, newlogentry) |
<|file_name|>malware_bazaar_search.py<|end_file_name|><|fim▁begin|>#python imports
import sys
import os
import time
import datetime
import subprocess
import json
import requests
from termcolor import colored
#third-party imports
#No third-party imports
#programmer generated imports
from logger import logger
from file... | POE |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | from roster_server import credentials
|
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | def setUp(self):
self.config_instance = roster_core.Config(file_name=CONFIG_FILE)
self.cred_instance = credentials.CredCache(self.config_instance,
u'sharrell')
db_instance = self.config_instance.GetDb()
db_instance.CreateRosterDatabase()
data = open... |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | self.config_instance = roster_core.Config(file_name=CONFIG_FILE)
self.cred_instance = credentials.CredCache(self.config_instance,
u'sharrell')
db_instance = self.config_instance.GetDb()
db_instance.CreateRosterDatabase()
data = open(DATA_FILE, 'r').re... |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | """
TAKEN FROM THE BLUEZ MODULE
is_valid_uuid (uuid) -> bool
returns True if uuid is a valid 128-bit UUID.
valid UUIDs are always strings taking one of the following forms:
XXXX
XXXXXXXX
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
where each X is a hexadecimal digit (case ins... |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | self.assertTrue(self.cred_instance.Authenticate(u'sharrell', 'test'))
cred_string = self.cred_instance.GetCredentials(u'sharrell', 'test',
self.core_instance)
self.assertEqual(self.cred_instance.CheckCredential(cred_string,
... |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | if int (uuid, 16) < 0: return False |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | return False |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | if int (uuid, 16) < 0: return False |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | return False |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | pieces = uuid.split ("-")
if len (pieces) != 5 or \
len (pieces[0]) != 8 or \
len (pieces[1]) != 4 or \
len (pieces[2]) != 4 or \
len (pieces[3]) != 4 or \
len (pieces[4]) != 12:
return False
[ int (p, 16) for p in p... |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | return False |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | return False |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | unittest.main() |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | setUp |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | is_valid_uuid |
<|file_name|>credentials_test.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of so... | testCredentials |
<|file_name|>PRESUBMIT.py<|end_file_name|><|fim▁begin|># Copyright 2017 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be<|fim▁hole|>
def CheckChangeOnCommit(input_api, output_api):
tests = input_api.canned_checks.GetUnitTestsInDirectory(
input... | # found in the LICENSE file. |
<|file_name|>PRESUBMIT.py<|end_file_name|><|fim▁begin|># Copyright 2017 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def CheckChangeOnCommit(input_api, output_api):
<|fim_middle|>
<|fim▁end|> | tests = input_api.canned_checks.GetUnitTestsInDirectory(
input_api, output_api, '.', files_to_check=['test_scripts.py$'])
return input_api.RunTests(tests) |
<|file_name|>PRESUBMIT.py<|end_file_name|><|fim▁begin|># Copyright 2017 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def <|fim_middle|>(input_api, output_api):
tests = input_api.canned_checks.GetUnitTestsInDirectory... | CheckChangeOnCommit |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from pyperator.utils import InputPort, OutputPort
import pyperator.components<|fim▁end|> | from pyperator.decorators import inport, outport, component, run_once
from pyperator.nodes import Component
from pyperator.DAG import Multigraph |
<|file_name|>test_sig_source_i.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under ... | |
<|file_name|>test_sig_source_i.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under ... | """Test for all component implementations in sig_source_i"""
def testScaBasicBehavior(self):
#######################################################################
# Launch the component with the default execparams
execparams = self.getPropertySet(kinds=("execparam",), modes=("readwrit... |
<|file_name|>test_sig_source_i.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under ... | execparams = self.getPropertySet(kinds=("execparam",), modes=("readwrite", "writeonly"), includeNil=False)
execparams = dict([(x.id, any.from_any(x.value)) for x in execparams])
self.launch(execparams)
#######################################################################
... |
<|file_name|>test_sig_source_i.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under ... | ossie.utils.testing.main("../sig_source_i.spd.xml") # By default tests all implementations |
<|file_name|>test_sig_source_i.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under ... | testScaBasicBehavior |
<|file_name|>Plot.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | #Scripts to plot the data, currently only in the context of Q&A communites. |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | return (-np.log(pi) - np.log(self.scale) - |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | r"""Create a relaxed Cauchy distribution object.
Parameters
----------
loc : Tensor or scalar, default 0
mode or median of the distribution
scale : Tensor or scalar, default 1
half width at half maximum
"""
# pylint: disable=abstract-method
has_grad = True
support =... |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | self.loc = loc
self.scale = scale
super(Cauchy, self).__init__(
event_dim=0, validate_args=validate_args) |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | return nan |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | return nan |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | if (isinstance(self.loc, Number), isinstance(self.scale, Number)) == (True, True):
u = np.random.uniform(size=size)
else:
u = np.random.uniform(np.zeros_like( # pylint: disable=too-many-function-args
self.loc + self.scale), size=size)
return self.icdf(u) |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | return self.sample(sample_n_shape_converter(size)) |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | if self._validate_args:
self._validate_samples(value)
return (-np.log(pi) - np.log(self.scale) -
np.log(1 + ((value - self.loc) / self.scale) ** 2)) |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | if self._validate_args:
self._validate_samples(value)
return np.arctan((value - self.loc) / self.scale) / pi + 0.5 |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | return np.tan(pi * (value - 0.5)) * self.scale + self.loc |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | return np.log(4 * pi) + np.log(self.scale) |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | u = np.random.uniform(size=size) |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | u = np.random.uniform(np.zeros_like( # pylint: disable=too-many-function-args
self.loc + self.scale), size=size) |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | self._validate_samples(value) |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | self._validate_samples(value) |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | __init__ |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | mean |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | variance |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | sample |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | sample_n |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | log_prob |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | cdf |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | icdf |
<|file_name|>cauchy.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache L... | entropy |
<|file_name|>17.py<|end_file_name|><|fim▁begin|>import struct
''' Refer to docs for all the exact formats. There are many so check them out before converting things yourself '''
''' If there's a specific offset you want to do things from, use pack_into and unack_into from the docs '''
#Integer to string
i1= 1234
prin... | print "String to 4 byte integer little endian", struct.unpack("<i", s1)
print "String to 4 byte integer big endian", struct.unpack(">i", s1) |
<|file_name|>229MajorityElementII.py<|end_file_name|><|fim▁begin|>class Solution:
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""<|fim▁hole|>
for num in nums:
if num == num1:
cnt1 += 1
elif num =... | num1, cnt1 = 0, 0
num2, cnt2 = 1, 0 |
<|file_name|>229MajorityElementII.py<|end_file_name|><|fim▁begin|>class Solution:
<|fim_middle|>
<|fim▁end|> | def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
num1, cnt1 = 0, 0
num2, cnt2 = 1, 0
for num in nums:
if num == num1:
cnt1 += 1
elif num == num2:
cnt2 += 1
... |
<|file_name|>229MajorityElementII.py<|end_file_name|><|fim▁begin|>class Solution:
def majorityElement(self, nums):
<|fim_middle|>
<|fim▁end|> | """
:type nums: List[int]
:rtype: List[int]
"""
num1, cnt1 = 0, 0
num2, cnt2 = 1, 0
for num in nums:
if num == num1:
cnt1 += 1
elif num == num2:
cnt2 += 1
else:
if cnt1 ==... |
<|file_name|>229MajorityElementII.py<|end_file_name|><|fim▁begin|>class Solution:
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
num1, cnt1 = 0, 0
num2, cnt2 = 1, 0
for num in nums:
if num == num1:
... | cnt1 += 1 |
<|file_name|>229MajorityElementII.py<|end_file_name|><|fim▁begin|>class Solution:
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
num1, cnt1 = 0, 0
num2, cnt2 = 1, 0
for num in nums:
if num == num1:
... | cnt2 += 1 |
<|file_name|>229MajorityElementII.py<|end_file_name|><|fim▁begin|>class Solution:
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
num1, cnt1 = 0, 0
num2, cnt2 = 1, 0
for num in nums:
if num == num1:
... | if cnt1 == 0:
num1, cnt1 = num, 1
elif cnt2 == 0:
num2, cnt2 = num, 1
else:
cnt1, cnt2 = cnt1 - 1, cnt2 - 1 |
<|file_name|>229MajorityElementII.py<|end_file_name|><|fim▁begin|>class Solution:
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
num1, cnt1 = 0, 0
num2, cnt2 = 1, 0
for num in nums:
if num == num1:
... | num1, cnt1 = num, 1 |
<|file_name|>229MajorityElementII.py<|end_file_name|><|fim▁begin|>class Solution:
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
num1, cnt1 = 0, 0
num2, cnt2 = 1, 0
for num in nums:
if num == num1:
... | num2, cnt2 = num, 1 |
<|file_name|>229MajorityElementII.py<|end_file_name|><|fim▁begin|>class Solution:
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
num1, cnt1 = 0, 0
num2, cnt2 = 1, 0
for num in nums:
if num == num1:
... | cnt1, cnt2 = cnt1 - 1, cnt2 - 1 |
<|file_name|>229MajorityElementII.py<|end_file_name|><|fim▁begin|>class Solution:
def <|fim_middle|>(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
num1, cnt1 = 0, 0
num2, cnt2 = 1, 0
for num in nums:
if num == num1:
... | majorityElement |
<|file_name|>pe029_distinct_powers.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python<|fim▁hole|>"""
Distinct powers
Problem 29
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
2^2=4, 2^3=8, 2^4=16, 2^5=32
3^2=9, 3^3=27, 3^4=81, 3^5=243
4^2=16, 4^3=64, 4^4=256, 4^5=1024
5^2=25, ... | # coding=utf-8 |
<|file_name|>pe029_distinct_powers.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding=utf-8
"""
Distinct powers
Problem 29
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
2^2=4, 2^3=8, 2^4=16, 2^5=32
3^2=9, 3^3=27, 3^4=81, 3^5=243
4^2=16, 4^3=64, 4^4=256, 4^5=1024
5^2=... | , a):
for j in range(2, b):
yield i ** j
if __name__ = |
<|file_name|>pe029_distinct_powers.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding=utf-8
"""
Distinct powers
Problem 29
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
2^2=4, 2^3=8, 2^4=16, 2^5=32
3^2=9, 3^3=27, 3^4=81, 3^5=243
4^2=16, 4^3=64, 4^4=256, 4^5=1024
5^2=... | wer_combinations(101, 101)))) # 9183
|
<|file_name|>pe029_distinct_powers.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding=utf-8
"""
Distinct powers
Problem 29
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
2^2=4, 2^3=8, 2^4=16, 2^5=32
3^2=9, 3^3=27, 3^4=81, 3^5=243
4^2=16, 4^3=64, 4^4=256, 4^5=1024
5^2=... | ns(a, b):
for |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert isinstance(wrap_var(u'foo'), AnsibleUnsafeText) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert isinstance(wrap_var(b'foo'), AnsibleUnsafeBytes) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | if PY3:
assert isinstance(wrap_var('foo'), AnsibleUnsafeText)
else:
assert isinstance(wrap_var('foo'), AnsibleUnsafeBytes) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert isinstance(wrap_var(dict(foo='bar')), dict)
assert not isinstance(wrap_var(dict(foo='bar')), AnsibleUnsafe)
assert isinstance(wrap_var(dict(foo=u'bar'))['foo'], AnsibleUnsafeText) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert wrap_var(dict(foo=None))['foo'] is None
assert not isinstance(wrap_var(dict(foo=None))['foo'], AnsibleUnsafe) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert isinstance(wrap_var(['foo']), list)
assert not isinstance(wrap_var(['foo']), AnsibleUnsafe)
assert isinstance(wrap_var([u'foo'])[0], AnsibleUnsafeText) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert wrap_var([None])[0] is None
assert not isinstance(wrap_var([None])[0], AnsibleUnsafe) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert isinstance(wrap_var(set(['foo'])), set)
assert not isinstance(wrap_var(set(['foo'])), AnsibleUnsafe)
for item in wrap_var(set([u'foo'])):
assert isinstance(item, AnsibleUnsafeText) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | for item in wrap_var(set([None])):
assert item is None
assert not isinstance(item, AnsibleUnsafe) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert isinstance(wrap_var(('foo',)), tuple)
assert not isinstance(wrap_var(('foo',)), AnsibleUnsafe)
assert isinstance(wrap_var(('foo',))[0], AnsibleUnsafe) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert wrap_var((None,))[0] is None
assert not isinstance(wrap_var((None,))[0], AnsibleUnsafe) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert wrap_var(None) is None
assert not isinstance(wrap_var(None), AnsibleUnsafe) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert isinstance(wrap_var(AnsibleUnsafeText(u'foo')), AnsibleUnsafeText) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert isinstance(wrap_var(AnsibleUnsafeBytes(b'foo')), AnsibleUnsafeBytes) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | thing = {
'foo': {
'bar': 'baz'
},
'bar': ['baz', 'qux'],
'baz': ('qux',),
'none': None,
'text': 'text',
}
wrapped_thing = wrap_var(thing)
thing is not wrapped_thing
thing['foo'] is not wrapped_thing['foo']
thing['bar'][0] is not wrappe... |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert isinstance(AnsibleUnsafeText(u'foo'), AnsibleUnsafe) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert isinstance(AnsibleUnsafeBytes(b'foo'), AnsibleUnsafe) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert isinstance(wrap_var('foo'), AnsibleUnsafeText) |
<|file_name|>test_unsafe_proxy.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.... | assert isinstance(wrap_var('foo'), AnsibleUnsafeBytes) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.