id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
373883
<reponame>CellProfiling/test-challenge<filename>testchallenge/__main__.py """Score predictions for the test challenge.""" from testchallenge.scoring import score def main(): """Launch scorer.""" score() if __name__ == '__main__': main()
StarcoderdataPython
12809060
# -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the ""Software""), ...
StarcoderdataPython
11257273
<filename>smapp_text_classifier/tests/test_vectorizers.py<gh_stars>1-10 import os import shutil import pandas as pd from smapp_text_classifier.vectorizers import (CachedCountVectorizer, CachedEmbeddingVectorizer) # Directory for caching during tests # Warning: if this dir...
StarcoderdataPython
9739930
from util.data_loader import burgers_data_loader from util.generate_plots import * # Resolution n_spatial = 1281 n_temporal = 1001 # Load data _, _, u_exact = burgers_data_loader(n_spatial=n_spatial, n_temporal=n_temporal) # generate_contour_and_snapshots_plot(u=u_exact) generate_contour_and_snapshots_plot(u=u_exact...
StarcoderdataPython
6706404
<gh_stars>1-10 # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc from . import policy_pb2 as policy__pb2 class PolicyServiceStub(object): """PolicyService manages policy creation and definition """ ...
StarcoderdataPython
3457523
#! /usr/bin/env python import rospy from nav_msgs.msg import Odometry from tf.transformations import euler_from_quaternion from geometry_msgs.msg import Point, Twist from math import atan2, pi, pow, sqrt, cos, sin from std_msgs.msg import Empty from time import time from sensor_msgs.msg import LaserScan import numpy a...
StarcoderdataPython
3225870
<gh_stars>0 # coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # --------------------------------------------------------...
StarcoderdataPython
5008197
<reponame>almahdiy/IT_PDP_Conference<gh_stars>0 from django.db import models #For the Q&A session; PDPs are going to be able to submit questions and vote on already submitted questions class Question(models.Model): """ Model for PDPs to submit their questions. """ body = models.TextField(default='') ...
StarcoderdataPython
207589
<filename>imputeTSpy/locf.py import numpy as np import pandas as pd from check_data import check_data, consecutive from tsAirgap import ts_airgap, ts_heating, ts_nh4 #from impyute.ops import error <EMAIL> <EMAIL> def locf(data, na_remaining = "rev", maxgap = None): """ Last Observation Carried Forward For...
StarcoderdataPython
8017562
from django.contrib.auth import authenticate, login, logout from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import serializers from rest_framework import status from styleguide_example.api.mixins import ApiAuthMixin from styleguide_example.users.selectors imp...
StarcoderdataPython
9608463
from sys import exit from os import path from glob import glob from PIL import Image from PIL.ExifTags import TAGS from plotly.graph_objects import Layout, Figure def main(): # get path to directory filepath = input('Path to directory ...
StarcoderdataPython
329890
import os.path import re import string import unicodedata from typing import List, Sequence def clean_word(word: str, allowed_chars: str = string.ascii_letters) -> str: """ Remove all accents and non-allowed characters from the given word, and uppercase it >>> clean_word('Mongolië') MONGOLIE """ ...
StarcoderdataPython
1861028
<reponame>AYaddaden/attention-learn-to-route # module genius.py # # Copyright (c) 2018 <NAME> # """ genius module - Implements GENIUS, an algorithm for generation of a solution. """ __version__="1.0" from pctsp.model.pctsp import * from pctsp.model import solution import numpy as np def genius(pctsp): s = solut...
StarcoderdataPython
5185685
from thefuck import utils from thefuck.utils import replace_argument @utils.git_support def match(command, settings): return ('fatal: Not a git repository' in command.stderr and "Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)." in command.stderr) @utils.git_support def get...
StarcoderdataPython
3494435
import numpy as np import json grid = np.fromfile("altfilter.bin", dtype='uint8') area = { "NE": "", "NW": "", "SE": "", "SW": "" } def exist(lng, lat, x, y): grid_x = (lng + 180) * 3 + x grid_y = (lat + 90) * 3 + y byte = grid_x / 8 bit = 1 << (grid_x % 8) return grid[grid_y * 1...
StarcoderdataPython
6401691
<gh_stars>1-10 def Owasp_top(): nc='\033[0m' green='\033[0;32m' print(green+"\n-----Owasp-top-10-----") print(green+"\nThis option tell about the 10 most common application vulnerabilities.\n\ncommand:\n\netw --info or netw --i\nthen it will provide you list of those vulneabilites\n\nselect any one of them to kno...
StarcoderdataPython
3267728
<reponame>maclema/aws-parallelcluster<gh_stars>100-1000 # Copyright 2020 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://aws.amaz...
StarcoderdataPython
3369365
<gh_stars>0 import os """Default configuration Use env var to override """ DEBUG = True SECRET_KEY = "changeme" SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or "sqlite:////tmp/myapi.db" SQLALCHEMY_TRACK_MODIFICATIONS = False JWT_BLACKLIST_ENABLED = True JWT_BLACKLIST_TOKEN_CHECKS = ['access', 'refresh'] ...
StarcoderdataPython
120848
import odespy from vib_odespy import run_solvers_and_plot, RHS, \ VibSolverWrapper4Odespy, plt from numpy import pi, sin # Primary ODE: m=1, s(u)=(2*pi)**2*u, such that the period is 1. # Then we add linear damping and a force term A*sin(w*t) where # w is half and double of the frequency of the free oscillations....
StarcoderdataPython
171433
"""Run parallel shallow water domain. run using command like: mpiexec -np m python run_parallel_sw_merimbula.py where m is the number of processors to be used. Will produce sww files with names domain_Pn_m.sww where m is number of processors and n in [0, m-1] refers to specific processor that own...
StarcoderdataPython
3462470
<reponame>gooaah/GraphINVENT<filename>tools/utils.py """ Miscellaneous functions. """ import rdkit from rdkit.Chem.rdmolfiles import SmilesMolSupplier def load_molecules(path : str) -> rdkit.Chem.rdmolfiles.SmilesMolSupplier: """ Reads a SMILES file (full path/filename specified by `path`) and returns the ...
StarcoderdataPython
6552177
import pytest from .. import (expression_walker, expressions, logic, solver_datalog_extensional_db) from ..exceptions import NeuroLangException from ..existential_datalog import (ExistentialDatalog, Implication, SolverNonRecursiveExistentialDatalog) from ..expressions...
StarcoderdataPython
3378598
#---------------------------------------------------------------------------- # Name: datetimeparser.py # # Purpose: - Instantiate datetime.datetime/date instance from a string # date representation. # Uses dateutil from http://labix.org/python-dateutil. # # - ...
StarcoderdataPython
11349870
<gh_stars>0 # -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
StarcoderdataPython
6407414
from collections import deque def delivery(products, args): for product in args: products.append(product) return products def sell(products, args): products = deque(products) if len(args) == 1 and str(args[0]).isdigit(): for i in range(int(args[0])): products.popleft() ...
StarcoderdataPython
8002387
# Group superclass definition # Maintained by <NAME> and <NAME> import pickle class Group: def __init__(self, group_id, engineers=[]): # Defined things self.group_id = group_id self.engineers = engineers def export(self, path="./exports/"): pickle.dump(self, op...
StarcoderdataPython
11216264
<gh_stars>0 from numpy.lib.function_base import median import cv2 import numpy as np from matplotlib import pyplot as plt img = cv2.imread("crestamento_4.jpg") image_RGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) image_gray = cv2.cvtColor(image_RGB, cv2.COLOR_RGB2GRAY) median_blur = cv2.medianBlur(image_gray,9) #canny ...
StarcoderdataPython
6696925
<reponame>opentensor/neurons from __init__ import neuron if __name__ == "__main__": template = neuron().run()
StarcoderdataPython
3327086
"""Add constraint to validate if one of credential column is not null Revision ID: 3e6d8d0a9cfe Revises: 835549b518a2 Create Date: 2020-01-29 10:08:37.117163 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "3e6d8d0a9cfe...
StarcoderdataPython
1689849
<reponame>tomhosker/polygon_puzzle<gh_stars>0 """ This code tests the PuzzleMaker class. """ # Test imports. import config from puzzle_maker import PuzzleMaker from word_arbiter import WordArbiter ############## # MAIN CLASS # ############## def test_generated_polygon(): """ Test that the polygon generated by th...
StarcoderdataPython
6504711
<reponame>algonomicon/a-neural-algorithm-of-artistic-style from PIL import Image import matplotlib.pyplot as plt import torch import torchvision.transforms as T from settings import DEVICE, SIZE # Image Transforms loader = T.Compose([ T.Resize(SIZE), T.CenterCrop(SIZE), T.ToTensor() ]) unloader = T.ToPILImage()...
StarcoderdataPython
6480021
from abjadext import microtones def test_dummy(): assert microtones.__version__ is not None
StarcoderdataPython
3200219
#!/usr/bin/env python # -*- coding: utf-8 -*- from flask.ext.restful import Resource from flask.ext.restful import reqparse from flask_mail import Message from .. import mail from ..login.views import auth class sendMail(Resource): decorators = [auth.login_required] def post(self): paser = reqparse.R...
StarcoderdataPython
1672297
<reponame>zcong1993/django from django.apps import AppConfig class ImagesConfig(AppConfig): name = 'start.apps.images' verbose_name = "Images"
StarcoderdataPython
12853591
import torch def save_param(model, pth_path): ''' save the parameters of the model Args: model: the model to which the params belong pth_path: the path where .pth file is saved ''' torch.save(model.state_dict(), pth_path) def load_param(model, pth_path): ''' load t...
StarcoderdataPython
1907973
# Copyright (c) 2015 Huawei Technologies India Pvt.Limited. # 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-...
StarcoderdataPython
9788669
#!/usr/bin/python3 # Adding src code to the test folder path import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../src'))) # Loading the required packages import unittest from add_custom_words import add_new_words from anagram_generator import get_anagrams from c...
StarcoderdataPython
59846
# coding: utf-8 -*- ''' GFS.py contains utility functions for GFS ''' __all__ = ['get_akbk', 'get_pcoord', 'read_atcf'] import numpy as _np import pandas as _pd def get_akbk(): ''' Returns ak,bk for 64 level GFS model vcoord is obtained from global_fcst.fd/gfsio_module.f ak,bk ...
StarcoderdataPython
1891534
# ----------------------------------------------------------------------------- # Copyright (c) 2021, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License (version 2 # or later) with exception for distributing the bootloader. # # The full license is in the file COPYING.txt, di...
StarcoderdataPython
285007
from helper import unittest, PillowTestCase from PIL import Image, ImageFont, ImageDraw image_font_installed = True try: ImageFont.core.getfont except ImportError: image_font_installed = False @unittest.skipIf(not image_font_installed, "image font not installed") class TestImageFontBitmap(PillowTestCase): ...
StarcoderdataPython
1988212
<gh_stars>0 #!/usr/bin/env python2.7 """ Combine tsv files with read depth. Files should have all the same lines and should have a column for chromosome/contig, a column for position, and a column for depth. script/bin/combine_depth_files.py <file(s)...> The directory name of each file is used as ...
StarcoderdataPython
220047
import getpass user = getpass.getuser() passwd = <PASSWORD>() print('User:', user) print('Passwd:', passwd)
StarcoderdataPython
3423447
<filename>flowUsagePlotWorker.py import pyqtgraph as pg import logging from PyQt5.QtCore import QObject, QThread, QTimer, pyqtSignal logging.basicConfig(format="%(message)s", level=logging.INFO) class FlowUsagePlotWorker(QObject): def __init__(self): super(FlowUsagePlotWorker, self).__init__() #...
StarcoderdataPython
300486
<filename>src/project/projects/urls.py from django.urls import path from .views import project_file app_name = 'projects' urlpatterns = [ path('<str:project_code>/', project_file, name='project-root'), path('<str:project_code>/<path:file_path>', project_file, name='project-file'), ]
StarcoderdataPython
1794320
<filename>pivot/apps.py<gh_stars>1-10 # Copyright 2021 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from __future__ import unicode_literals from django.apps import AppConfig class PivotConfig(AppConfig): name = 'pivot'
StarcoderdataPython
1741016
<filename>btclib/der.py #!/usr/bin/env python3 # Copyright (C) 2017-2020 The btclib developers # # This file is part of btclib. It is subject to the license terms in the # LICENSE file found in the top-level directory of this distribution. # # No part of btclib including this file, may be copied, modified, propagated,...
StarcoderdataPython
175965
"""002_addISBN_10 Revision ID: 04659e2c3a9a Revises: 69a9f86e5636 Create Date: 2022-01-21 02:01:57.474589 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '04659e2c3a9a' down_revision = '69a9f86e5636' branch_labels = None depends_on = None def upgrade(): #...
StarcoderdataPython
6459653
# GENERATED FILE - DO NOT EDIT VERSION = '201809121509' BUILDS = {'Darwin': {'sha256': 'e922af671d7baccc099a8bf1e57f40b32d4e92b2abd144437c05da0ce5961abd', 'url': 'http://s3-us-west-2.amazonaws.com/ai2-thor/builds/thor-201809121509-OSXIntel64.zip'}, 'Docker': {'tag': '201809121509'}, 'Linux': {'sha256': '8...
StarcoderdataPython
1918563
import unittest from transducer.functional import compose from transducer.react import transduce from transducer.sinks import CollectingSink, SingularSink from transducer.sources import iterable_source from transducer.transducers import (mapping, pairwise, filtering, first) class TestComposedTransducers(unittest.Test...
StarcoderdataPython
3442050
from PIL import Image import sys import urllib.request #import urllib, cStringIO import requests #im = Image.open(requests.get(url, stream=True).raw) ASCII_CHARS = ['.',',',':',';','+','*','?','%','S','#','@'] #ASCII_CHARS = ['..',',,','::',';;','++','**','??','%%','SS','##','@@'] ASCII_CHARS = ASCII_CHARS[::...
StarcoderdataPython
1625171
#!/usr/bin/env python3 # Copyright 2020 Stanford 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 applicab...
StarcoderdataPython
6450335
# by <NAME> # Extract Variable (alias introduce explaining variable) WELL_DONE = 900000 MEDIUM = 600000 COOKED_CONSTANT = 0.05 def is_cookeding_criteria_satisfied(time, temperature, pressure, desired_state): if desired_state == 'well-done' and time * temperature * pressure * COOKED_CONSTANT >= WELL_DONE: ...
StarcoderdataPython
11214940
<filename>package/lucas.py from functools import cache @cache def lucas(index: int) -> int: """ lucas This the rercusive function of the lucas suite Args: index (int): the index of lucas Returns: [int]: the number of lucas at the index """ if index == "": return 2 ...
StarcoderdataPython
1788129
<gh_stars>0 from flask import Flask, abort, make_response import redis app = Flask(__name__) db = redis.Redis(host='redisserver') @app.route('/<file>') @app.route('/<file>.<ext>') def serve_file(file, ext=None): result = db.get(file) if result is None: return abort(425) result = make_response(res...
StarcoderdataPython
3299018
<gh_stars>10-100 import unittest from dexter.models import Document, DocumentSource, db from dexter.models.seeds import seed_db class TestDocumentSource(unittest.TestCase): def test_same_person(self): self.assertEqual( DocumentSource( source_type='person', unnamed=False, person...
StarcoderdataPython
9645425
<reponame>DrFirestream/NLP<gh_stars>0 import json from pathlib import Path from typing import List, Tuple import sentencepiece as spm import torch import numpy as np import fire from .fire_utils import only_allow_defined_args from .model import Model, HParams from .common import END_OF_LINE, END_OF_TEXT class Model...
StarcoderdataPython
123330
<filename>appCore/apps/replica/contrib/insta/management/commands/insta_import.py import requests from urllib.parse import urlparse from io import BytesIO from django.core.management.base import BaseCommand, CommandError from django.template.defaultfilters import slugify, wordcount from django.shortcuts import render_t...
StarcoderdataPython
3247085
<gh_stars>0 import asyncio import base64 from pathlib import Path from urllib import parse import aiofiles import aiohttp from google_img.collectors.base import BaseCollector from .collectors.registry import collector def download_async( keywords: str, output_folder: Path, collector_name: str = "google_full", ...
StarcoderdataPython
6472222
<reponame>mys-anusha/NISB-Rosetta-Code # -*- coding: utf-8 -*- """ Created on Mon Jun 7 17:47:01 2021 jumbled @author: <NAME> """ import random def choose(): words=['computer','python','english','work','random','pencil','frustration','understand','words','water','apple','smartphone','laptop','quality','m...
StarcoderdataPython
9654261
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from scapy.all import * class SensorData(Packet): fields_desc = [ ByteField("sensor_id", 0), ByteField("sensor_value", 0), ] bind_layers(Ether, SensorData, type=0x842) bind_layers(SensorData, IP)
StarcoderdataPython
1796226
<filename>learnpyqt/source/concurrent/qrunner_stop.py import sys import time from PySide2.QtCore import QObject, QRunnable, Qt, QThreadPool, Signal, Slot from PySide2.QtWidgets import ( QApplication, QHBoxLayout, QMainWindow, QProgressBar, QPushButton, QWidget, ) class WorkerKil...
StarcoderdataPython
333389
<gh_stars>0 # !/usr/bin/env python3 """ Author: <NAME> Date: 2021-06-03 10:10:04 LastEditTime: 2021-06-03 10:10:04 LastEditors: <NAME> Description: unzip bagfile to asc file FilePath: """ import rosbag import rospy import sys, getopt import os from datetime import datetime from rospy import rostime class RosAscWri...
StarcoderdataPython
130763
def arithmeticExpression(a, b, c): """ Consider an arithmetic expression of the form a#b=c. Check whether it is possible to replace # with one of the four signs: +, -, * or / to obtain a correct """ return ( True if (a + b == c) or (a - b == c) or (a * b == c) or (a / b == c) else Fals...
StarcoderdataPython
4940438
<gh_stars>1-10 from .install import Installer def update(package_name: str, entrypoint_name: str = "") -> None: installer = Installer(package=package_name, entrypoint_name=entrypoint_name) installer.update()
StarcoderdataPython
6648822
<filename>Python/prova/calendario.py aniversairo = input('Digite a data de nascimento no formado __/__/____ : ') dia = int(aniversairo[:2]) mes = int(aniversairo[3:5]) if 20 <= dia <= 31 and mes == 3 or 1 <= dia <= 20 and mes == 4: print('aries') elif 21 <= dia <= 30 and mes == 4 or 1 <= dia <= 20 and mes ...
StarcoderdataPython
6409957
<reponame>e-yuzo/distributed-systems-for-fun<gh_stars>0 # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: book.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobu...
StarcoderdataPython
1877760
<reponame>LaudateCorpus1/lisa<gh_stars>0 # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import pathlib import re from lisa.executable import Tool from lisa.operating_system import Posix from lisa.util import LisaException, constants, get_matched_str class CodeExistsException(LisaException)...
StarcoderdataPython
393843
<reponame>prplz/cadquery from typing import ( List, Tuple, Union, Any, Callable, Optional, Dict, Literal, cast as tcast, Type, ) from nptyping import NDArray as Array from math import radians from typish import instance_of, get_type from numpy import array, eye, pi import nlopt ...
StarcoderdataPython
11375684
<reponame>wehak/reservoirpy<filename>reservoirpy/datasets/_seed.py _DEFAULT_SEED = 5555 def get_seed(): """Return the current random state seed used for dataset generation. Returns ------- int Current seed value. """ global _DEFAULT_SEED return _DEFAULT_SEED def set_seed(s: ...
StarcoderdataPython
9749042
import os import unittest from pathsjson.path import Path class TestPath(unittest.TestCase): def test_equal(self): a = Path('some/path', ['a', 'b', 'c'], [1, 2, 3]) b = Path('some/path', ['a', 'b', 'c'], [1, 2, 3]) c = Path('some/path', ['A', 'B', 'C'], [1, 2, 3]) self.assertEqual...
StarcoderdataPython
1837500
# Import the Images module from pillow from PIL import Image import os class rpImage(): def __init__(self,name:str,image_blob,path='/'): self.img_name = name self.img_blob = image_blob self.path = path def get_image_meta(self): width, height, = self.img_blob.size size...
StarcoderdataPython
3536430
import datetime import re import sys from . import utils import gocardless from gocardless.exceptions import ClientError import six class ResourceMetaClass(type): def __new__(meta, name, bases, attrs): #resoures inherit date fields from superclasses for base in bases: if hasattr(bas...
StarcoderdataPython
9735006
#! /usr/bin/env python from typing import Optional import pytest from marshmallow.exceptions import ValidationError as MarshmallowValidationError from marshmallow_dataclass import dataclass import ludwig.marshmallow.marshmallow_schema_utils as lusutils import ludwig.modules.optimization_modules as lmo # Tests for cu...
StarcoderdataPython
1819062
from flask import render_template from app.blueprints.account.views import account @account.app_errorhandler(403) def forbidden(_): return render_template('errors/403.html'), 403 @account.app_errorhandler(404) def page_not_found(_): return render_template('errors/404.html'), 404 @account.app_errorhandler...
StarcoderdataPython
9743143
import asyncio import functools from io import BytesIO from typing import Any, Callable, Union import numpy as np from loguru import logger as log try: import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt plt.style.use("dark_background") except (ImportError, ImportWarning) as e: ...
StarcoderdataPython
3330494
import dash_bootstrap_components as dbc import dash_core_components as dcc import dash_html_components as html from dash_app.app import app layout = html.Div( [ dbc.Jumbotron( [ html.H1('Welcome to PaIntDB!'), dcc.Markdown( '*Pseudomonas aeru...
StarcoderdataPython
1893868
#!/usr/bin/env python import logging import os import subprocess import sys import argparse import shlex logger = None def init_logger(filename): global logger if logger == None: logger = logging.getLogger() else: for handler in logger.handlers[:]: logger.removeHandler(handler)...
StarcoderdataPython
8188544
import re import streamlit as st from sagas.conf.conf import cf # all_labels = {"Dutch":'nl', "Persian":'fa', "Japanese":'ja', # "Korea":'ko', "Afrikaans":'af', "Russian":'ru', # "Italian":'it', "Turkish":'tr', 'Finnish':'fi', # 'Estonian':'et', # "Arabic":'ar'} ...
StarcoderdataPython
12813067
<filename>mac.py<gh_stars>0 #!/usr/bin/env python # _*_ coding=utf-8 _*_ import Tkinter import ttk import socket import binascii import dpkt from scapy.all import * import sys reload(sys) sys.setdefaultencoding('utf8') def catchPcap(): dpkt = sniff(count=40) wrpcap("demo.pcap",dpkt) def...
StarcoderdataPython
12828206
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import pulumi import pulumi.runtime from .. import utilities, tables class RegionInstanceGroupManager(pulumi.CustomResource): """ ...
StarcoderdataPython
9695357
# Hiccup - Burp Suite Python Extensions # Copyright 2012 Zynga Inc. from burp import IBurpExtender import sys, os, re, time, logging from hiccup import GlobalConfig, PluginManager, FileWatcher, Message, MenuItemHandler from hiccup import SharedFunctions as shared class BurpExtender(IBurpExtender): config_file =...
StarcoderdataPython
1616543
<reponame>alexandrwang/hackmit<filename>server.py from flask import Flask, request, redirect import twilio.twiml import subprocess import json import sklearn import random import datetime from sklearn.feature_extraction import DictVectorizer from sklearn import svm import re import nltk import datetime import traceback...
StarcoderdataPython
11230627
<filename>src/arrays/merge-intervals-2.py def solve(intervals): intervals.sort(reverse=True) result = [] while len(intervals) > 0: if len(result) == 0: result.append(intervals.pop()) else: prev_interval = result.pop() next_interval = intervals.pop() ...
StarcoderdataPython
1972574
<reponame>avcopan/elstruct-interface """ Library of functions to retrieve frequency information from a Psi4 1.0 output file. """ __authors__ = "<NAME>, <NAME>" __updated__ = "2019-01-15" from ..rere import parse as repar from ..rere import find as ref from ..rere import pattern as rep from ..rere import pattern_lib ...
StarcoderdataPython
1605506
<reponame>Liyra/ArchiveScript #!/usr/bin/env python from setuptools import setup, find_packages setup( name='ArchiveScript', version="1", author='<NAME>', author_email='<EMAIL>', packages=find_packages(), entry_points = { 'console_scripts': [ 'archivescript=ArchiveS...
StarcoderdataPython
79495
<reponame>qlcchain/WinQ-Android-code #!/c/python27/python import os from utils import * def cli_cpp(parms): return os.path.join(parms['OVPN3'], "core", "test", "ovpncli", "cli.cpp") def src_fn(parms, srcfile): # Get source file name if srcfile: if '.' not in os.path.basename(srcfile): ...
StarcoderdataPython
132220
import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output, State import plotly.graph_objs as go import math import dash_table from app import app import pandas as pd data = pd.read_excel('data/2018/economic-aggregates/S1.10.xlsx') years = data.iloc[...
StarcoderdataPython
130776
<filename>desktop/core/ext-py/phoenixdb-1.1.0/phoenixdb/sqlalchemy_phoenix.py # Copyright 2017 <NAME> # # 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/LIC...
StarcoderdataPython
6570346
#!/usr/bin/env python from datetime import datetime from random import randint import kivy kivy.require('1.10.0') from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.image import Image from kivy.properties import DictProperty, ObjectProperty, StringProperty from kivy.clock import Clock fro...
StarcoderdataPython
11348366
from dataclasses import dataclass from enum import Enum from typing import Union, Dict @dataclass class ExplainerDependencyReference: """Class for keeping track of dependencies required to Alibi runtime.""" explainer_name: str alibi_class: str runtime_class: str _ANCHOR_IMAGE_TAG = "anchor_image" _...
StarcoderdataPython
3412056
<filename>implicit/datasets/sketchfab.py import logging import os import time import h5py import numpy as np from scipy.sparse import coo_matrix, csr_matrix from implicit.datasets import _download log = logging.getLogger("implicit") URL = "https://github.com/benfred/recommender_data/releases/download/v1.0/sketchfa...
StarcoderdataPython
1636783
# __author__ = 'artreven'
StarcoderdataPython
8064236
<filename>gmail/gmail_message.py """Get a list of Messages from the user's mailbox. """ from apiclient import errors from itertools import islice def ListMessagesMatchingQuery(service, user_id, **kwargs): """List all Messages of the user's mailbox matching the query. Args: service: Authorized Gmail AP...
StarcoderdataPython
1971505
import unittest from models.meta import Meta, Episode_Meta class TestMeta(unittest.TestCase): def test_meta(self): meta = Meta( "id", "title", "rating", "image_name", "episodes", "description" ) self.assertEqual(meta...
StarcoderdataPython
8145240
# function zone def summary(): global water, milk, coffee_beans, disposable_cups, money print("The coffee machine has:") print(f"{water} of water") print(f"{milk} of milk") print(f"{coffee_beans} of coffee beans") print(f"{disposable_cups} of disposable cups") print(f"{money} of money") de...
StarcoderdataPython
11399903
<gh_stars>1000+ # Copyright 2017 Google LLC. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following...
StarcoderdataPython
6537373
"""Handle Wordle Commands.""" from hikari.events.message_events import GuildMessageCreateEvent from bot.wordle.engine import WORDLE_PATTERN, Wordle wordle = Wordle() def should_handle(event: GuildMessageCreateEvent) -> bool: """Should this event be handled?""" return bool( event.content and ...
StarcoderdataPython
51357
import os import itertools import re from typing import List, Optional, Tuple, Dict, Callable, Any, NamedTuple from string import Template from typing import List from tokenizers import Tokenizer, Encoding dirname = os.path.dirname(__file__) css_filename = os.path.join(dirname, "visualizer-styles.css") with open(css_...
StarcoderdataPython
1725819
<reponame>cylondata/parsl import pytest import parsl from parsl.app.errors import AppTimeout @parsl.python_app def my_app(walltime=1): import time time.sleep(1.2) return True def test_python_walltime(): f = my_app() with pytest.raises(AppTimeout): f.result() def test_python_longer_wal...
StarcoderdataPython
1853133
import argparse import json import logging import os from typing import Dict, List import numpy as np from deepdream import DeepDream logger = logging.getLogger(__name__) parser: argparse.ArgumentParser = argparse.ArgumentParser(description="Deep Dreams with Keras. Multiple experiments.") parser.add_argument("base_...
StarcoderdataPython