text
string
size
int64
token_count
int64
from django.contrib import admin from django.contrib.auth.admin import UserAdmin from .models import * # Register your models here. def set_active(modeladmin, request, queryset): for user in queryset: user.is_active = True user.save() set_active.short_description = 'Set Account Status: Active' de...
1,436
440
# -*- coding: utf-8 -*- """task module.""" from __future__ import unicode_literals import sys import os import pydoc import time import json import logging import collections import pkg_resources import subprocess import webbrowser import websocket from pyloco.parse import TaskArgParser, PylocoArgParser from pyloco....
26,912
7,856
"""Azure IoT Device Library - Asynchronous This library provides asynchronous clients for communicating with Azure IoT services from an IoT device. """ from azure.iot.device.iothub.aio import * from azure.iot.device.provisioning.aio import * from . import patch_documentation # Dynamically patch the clients to add sh...
1,376
392
# -*- coding: UTF-8 -*- # Copyright 2013-2016 Luc Saffre # # License: BSD (see file COPYING for details) """This module is for managing a reception desk and a waiting queue: register clients into a waiting queue as they present themselves at a reception desk (Empfangsschalter), and unregister them when they leave agai...
1,716
557
from accent_analyser.rules.EngRule import EngRule class RuleRemoveThe(EngRule): def __init__(self, likelihood=1.0): super().__init__(likelihood) def _convert_core(self, words: list, current_index: int): word = words[current_index].content if word == "the": return "" else: return word
320
104
# -*- coding:utf-8 -*- class BaseProvider(object): @staticmethod def loads(link_url): raise NotImplementedError("Implemetion required.") @staticmethod def dumps(conf): raise NotImplementedError("Implemetion required.")
255
82
session.forget() def get(args): if args[0].startswith('__'): return None try: obj = globals(), get(args[0]) for k in range(1, len(args)): obj = getattr(obj, args[k]) return obj except: return None def vars(): """the running controller function!""" ...
1,505
481
# DRUNKWATER TEMPLATE(add description and prototypes) # Question Title and Description on leetcode.com # Function Declaration and Function Prototypes on leetcode.com #223. Rectangle Area #Find the total area covered by two rectilinear rectangles in a 2D plane. #Each rectangle is defined by its bottom left corner and to...
857
266
import serial import RPi.GPIO as GPIO import time ser=serial.Serial("/dev/ttyACM0",9600) start_time = time.time() imu = open("IMU.txt","w") while time.time() - start_time <= 1: ser.readline() while time.time() - start_time <= 8: read_ser=ser.readline() if float(read_ser) == 0.00: pa...
437
184
from pyg_base._types import is_iterable from pyg_base._loop import len0 __all__ = ['zipper', 'lens'] def lens(*values): """ measures (and enforces) a common length across all values :Parameters: ---------------- *values : lists Raises ------ ValueError if you have values with...
1,950
751
import json from typing import List import requests from pawls.preprocessors.model import Page def fetch_grobid_structure(pdf_file: str, grobid_host: str = "http://localhost:8070"): files = { "input": (pdf_file, open(pdf_file, "rb"), "application/pdf", {"Expires": "0"}) } url = "{}/api/processPdf...
1,997
605
# coding: utf-8 # # Copyright 2020 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
2,614
858
from __future__ import print_function from pyomo.environ import * from pyomo.core.base import Constraint, Objective, Suffix, minimize from pyomo.opt import ProblemFormat, SolverFactory from nmpc_mhe.dync.NMPCGenv2 import NmpcGen from nmpc_mhe.mods.bfb.nob5_hi_t import bfb_dae from snap_shot import snap import sys, os i...
6,274
2,982
from urllib.parse import urlparse from quart import current_app as app, request, jsonify def filter_referrers(): filters = app.config.get('REFERRERS_FILTER') if not filters: return None referrer = request.referrer if referrer: parsed = urlparse(referrer) for filter in filters:...
493
144
from django.db import models from filer.fields.file import FilerFileField class FakeLink(models.Model): """ In our widget we need to manually render a AdminFileFormField. Basically for every other Field type this is not a problem at all, but Failer needs a rel attribute which consists of a reverse relatio...
447
124
from __future__ import print_function import atexit import errno import logging import os import select import signal import sys import time from process_tests import setup_coverage TIMEOUT = int(os.getenv('MANHOLE_TEST_TIMEOUT', 10)) SOCKET_PATH = '/tmp/manhole-socket' OUTPUT = sys.__stdout__ def handle_sigterm(s...
9,679
2,903
from django.contrib import admin from django.conf import settings from django.core.exceptions import ImproperlyConfigured from . import models if settings.HAS_ADDITIONAL_USER_DATA: try: class UserProfileInline(admin.TabularInline): model = models.UserProfile extra = 0 except (...
1,054
325
from client import exception, embed_creator, console_interface, discord_manager, file_manager, ini_manager, json_manager, origin, permissions, server_timer from client.config import config as c, language as l from discord.ext import commands, tasks from client.external.hiscores import hiscores_xp from PIL import Image,...
38,189
10,993
from __future__ import annotations import os import collections BASE_PATH = os.path.dirname(__file__) INPUT_PATH = os.path.join(BASE_PATH, "input.txt") OUTPUT_PATH = os.path.join(BASE_PATH, "output.txt") def proceed_buffer(buffer: str) -> list[int]: return [int(line) for line in buffer.splitlines()] def mai...
1,437
467
"""Agents for neural net bandit problems. We implement three main types of agent: - epsilon-greedy (fixed epsilon, annealing epsilon) - dropout (arXiv:1506.02142) - ensemble sampling All code is specialized to the setting of 2-layer fully connected MLPs. """ import numpy as np import numpy.random as rd from ba...
13,684
4,718
import io import os from django.core.management.base import BaseCommand from django.conf import settings from django.contrib.staticfiles import finders from django.template.loader import render_to_string from django.utils.translation import to_locale class Command(BaseCommand): def handle(self, *args, **options...
1,314
354
# Copyright © 2019. Allen Institute. All rights reserved. import numpy as np import pandas as pd from collections import OrderedDict import math import warnings from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA from sklearn.neighbors import NearestNeighbors from sklearn.metrics import silho...
37,910
11,591
import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec import copy from .pdp_calc_utils import _sample_data, _find_onehot_actual, _find_closest from sklearn.cluster import MiniBatchKMeans, KMeans def _pdp_plot_title(n_grids, feature_name, ax, multi_flag, whi...
23,746
8,201
import os import pytest from kodexa import Document, Pipeline, PipelineContext, TagsToKeyValuePairExtractor, RollupTransformer def get_test_directory(): return os.path.dirname(os.path.abspath(__file__)) + "/../test_documents/" @pytest.mark.skip def test_html_rollup(): document = Document.from_msgpack(open...
8,778
2,909
"""Make containers available here.""" from .report import Report from .threat_intelligence import ThreatIntelligence from .stackdriver import StackdriverLogs
158
40
#!/usr/bin/env python3 """Script for simulating IOT measurement stream to ModelConductor experiment.""" import pandas as pd import numpy as np import sqlalchemy as sqla from datetime import datetime as dt from time import sleep, time import logging import sys, os, asyncio from hbmqtt.client import MQTTClient, Connect...
2,327
809
import sys import math L = [] f = open(sys.argv[1],"r") for item in f: L.append(item.strip()) def find_id(sequence): rows = sequence[:7] seats = sequence[7:] upper = 127 lower = 0 for letter in rows: half = math.ceil((upper-lower)/2) if letter == "F": upper -= half if letter == "B": lower += half...
694
313
# -*- coding: utf-8 -*- """ Injector. A partir de um arquivo binario, de uma tabela binaria gerada com o Finder, e um arquivo de substituição, o Injector é capaz de injetar um texto no binario trocando o texto in-game O Injector faz automaticamente a adequação do tamanho do texto ao tamanho da caixa, truncan...
2,890
1,014
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os from spack import * class Cudnn(Package): """NVIDIA cuDNN is a GPU-accelerated library of primitives for d...
10,556
6,601
import numpy as np import argparse import os.path import plots as plot from sklearn.preprocessing import StandardScaler from sklearn.grid_search import GridSearchCV import time from sklearn import svm from sklearn.metrics import classification_report from sklearn.metrics import accuracy_score from sklearn.externals imp...
4,023
1,389
import abc import json import logging import socket import sys import time import aio_logstash import traceback from aio_logstash import constants from datetime import datetime, date class BaseFormatter(logging.Formatter): def __init__(self, message_type='aio_logstash', fqdn=False): super().__init__() ...
3,545
1,074
# -*- coding: utf-8 -*- """Graphical monitor of Celery events using curses.""" from __future__ import absolute_import, print_function, unicode_literals import curses import sys import threading from datetime import datetime from itertools import count from textwrap import wrap from time import time from math import c...
18,352
5,617
"""A feature extractor for patients' utilization.""" from __future__ import absolute_import import logging import pandas as pd from sutter.lib import postgres from sutter.lib.feature_extractor import FeatureExtractor log = logging.getLogger('feature_extraction') class UtilizationExtractor(FeatureExtractor): ...
1,705
534
"""Perform normalization on inputs or rewards. """ import numpy as np import torch from gym.spaces import Box def normalize_angle(x): """Wraps input angle to [-pi, pi]. """ return ((x + np.pi) % (2 * np.pi)) - np.pi class RunningMeanStd(): """Calulates the running mean and std of a data stream. ...
6,517
2,087
#!/usr/bin/python import socket import threading import sys # Support command line args import getopt # Support command line option parsing import os # Kill the application import signal # Catch an interrupt import time # Thread sleeping # Global variables definitions target = "" port = False listen = Fal...
5,125
1,715
import nest import pylab as pl import pickle from nest import voltage_trace from nest import raster_plot as rplt import numpy as np from params import * seed = [np.random.randint(0, 9999999)] * num_threads def calcFI(): #amplitudesList = np.arange(3.5,4.5,0.1) amplitudesList = np.arange(100, 500, 50.) ...
4,356
1,787
import os from fastf1.core import Session, Weekend from fastf1.livetiming.data import LiveTimingData def test_file_loading_w_errors(): # load file with many errors and invalid data without crashing livedata = LiveTimingData('fastf1/testing/reference_data/livedata/with_errors.txt') livedata.load() def t...
1,434
531
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Oct 21 20:09:08 2021 ###################### ##### read h5 ######## ###################### # 1.read h5-file h5_file = h5py.File(files[1],'r') # 2.show all keys in h5-file h5_file.keys() # 3.循环读取所有 keys in h5-file for key in h5_file.keys(): onekey =...
1,768
909
from distutils.core import setup setup( name = 'colormate', packages = ['colormate'], version = '0.2214', license='MIT', description = 'A package to theme terminal scripts with custom colors and text formatting', author = 'Rodrigo', author_email = 'roarba011@gmail.com', url = 'https://github.com/mrjakes...
872
297
import data_algebra import data_algebra.test_util from data_algebra.data_ops import * # https://github.com/WinVector/data_algebra import data_algebra.util import data_algebra.SQLite def test_compount_where_and(): d = data_algebra.default_data_model.pd.DataFrame( { "a": ["a", "b", None, None]...
1,620
616
from django.contrib import admin from .models import Student # Register your models here. class StudentAdmin(admin.ModelAdmin): list_display = ('first_name','middle_name', 'last_name','identification_number') search_fields = ('first_name','middle_name', 'last_name','ide...
385
103
"""Collection of functions to run Viterbi algorithms on dipoid genotype data, where the data is structured as variants x samples.""" import numba as nb import numpy as np # https://github.com/numba/numba/issues/1269 @nb.njit def np_apply_along_axis(func1d, axis, arr): """Create numpy-like functions for max, sum e...
18,819
8,066
from alembic_utils.pg_function import PGFunction from alembic_utils.replaceable_entity import register_entities from alembic_utils.testbase import TEST_VERSIONS_ROOT, run_alembic_command TO_UPPER = PGFunction( schema="public", signature="toUpper(some_text text default 'my text!')", definition=""" r...
6,704
2,030
import numpy as np np.random.seed(0) class Environment(object): def __init__(self, alpha, T, mining_cost=0.5): self.alpha = alpha self.T = T self.current_state = None self.mining_cost = mining_cost def reset(self): self.current_state = (0, 0) return self.current...
1,723
600
from setuptools import setup, find_packages setup( name='passgen-py', packages=find_packages(), version='1.1', description='Generate Passwords Deterministically based on a Master Password.', classifiers=[ 'Development Status :: 3 - Alpha', 'License :: OSI Approved :: MIT License', ...
549
174
# https://codegolf.stackexchange.com/a/11480 multiplication = [] for i in range(10): multiplication.append(i * (i + 1)) for x in multiplication: print(x)
163
61
#!/usr/bin/env python """ Requirements: * Python >= 3.7 * Pysam Copyright (c) 2021 Dietmar Rieder <dietmar.rieder@i-med.ac.at> MIT License <http://opensource.org/licenses/MIT> """ RELEASE = False __version_info__ = ( "0", "1", ) __version__ = ".".join(__version_info__) __version__ += "-dev" if not ...
4,762
1,780
#!/usr/bin/env python import sys import colorama from pick_db_file import pick_db_file import db_connection import card_repository from review_cards import review_cards from new_card import new_card from new_cards import new_cards import review from user_colors import print_info, print_instruction, print_error from usa...
3,115
1,040
# Copyright 2021 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
14,996
5,722
import numpy as np from scipy.special import factorial from pyapprox.indexing import hash_array from pyapprox.indexing import compute_hyperbolic_level_indices def multiply_multivariate_polynomials(indices1,coeffs1,indices2,coeffs2): """ TODO: instead of using dictionary to colect terms consider using uniqu...
12,621
4,343
# -------------------------------------------------------- # mcan-vqa (Deep Modular Co-Attention Networks) # Licensed under The MIT License [see LICENSE for details] # Written by Yuhao Cui https://github.com/cuiyuhao1996 # -------------------------------------------------------- import h5py import pickle import random ...
12,303
4,362
from .database import Db from .initiatives import InitiativeBase, Platform, ImportBatch, InitiativeImport, BatchImportState, InitiativeGroup
140
37
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ Widget that handles communications between a console in debugging mode and Spyder """ import ast from qtpy.QtCore import Qt from qtconsole.rich_jupyter_widget ...
3,987
1,119
from .string import <caret>
27
9
import numpy as np import sklearn.metrics from dataset_chunking_fxns import subsample_df_by_groups import sklearn import sklearn.linear_model from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScaler import time...
9,848
2,821
""" PSET-7 Part 2: Triggers (PhraseTriggers) At this point, you have no way of writing a trigger that matches on "New York City" -- the only triggers you know how to write would be a trigger that would fire on "New" AND "York" AND "City" -- which also fires on the phrase "New students at York University love the c...
6,206
1,699
# -*- coding: utf-8 -*- from unittest import TestCase from mock import Mock, patch from vault.tests.fakes import fake_request from vault.views import SetProjectView from django.utils.translation import ugettext as _ class SetProjectTest(TestCase): def setUp(self): self.view = SetProjectView.as_view() ...
1,522
483
from tasks.cephfs.cephfs_test_case import CephFSTestCase import random import os class TestDumpTree(CephFSTestCase): def get_paths_to_ino(self): inos = {} p = self.mount_a.run_shell(["find", "./"]) paths = p.stdout.getvalue().strip().split() for path in paths: inos[path]...
2,364
793
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) control_pins = [7,11,13,15] for pin in control_pins: GPIO.setup(pin, GPIO.OUT) GPIO.output(pin, 0) halfstep_seq = [ [1,0,0,0], [1,1,0,0], [0,1,0,0], [0,1,1,0], [0,0,1,0], [0,0,1,1], [0,0,0,1], [1,0,0,1] ] # speed from 0 to 1 (one bei...
966
478
import numpy as np import cv2 import os import math os.system("fswebcam -r 507x456 --no-banner image11.jpg") def showImage(capImg): cv2.imshow('img', capImg) cv2.waitKey(0) cv2.destroyAllWindows() img = cv2.imread('image11.jpg',-1) height, width, channel = img.shape topy= height topx = width hsv = cv2.cv...
2,924
1,544
from django.conf.urls import include from django.http import HttpResponseRedirect from django.urls import re_path from Poem.poem_super_admin.admin import mysuperadmin urlpatterns = [ re_path(r'^$', lambda x: HttpResponseRedirect('/poem/superadmin/')), re_path(r'^superadmin/', mysuperadmin.urls), re_path(r...
424
139
import json from optimism.JaxConfig import * from optimism import Mesh def read_json_mesh(meshFileName): with open(meshFileName, 'r', encoding='utf-8') as jsonFile: meshData = json.load(jsonFile) coordinates = np.array(meshData['coordinates']) connectivity = np.array(meshData['connectivi...
902
299
# -*- coding: utf-8 -*- """ Ramsey numbers. """ # Copyright (C) 2011 by # Nicholas Mancuso <nick.mancuso@gmail.com> # All rights reserved. # BSD license. import networkx as nx from ...utils import arbitrary_element __all__ = ["ramsey_R2"] __author__ = """Nicholas Mancuso (nick.mancuso@gmail.com)""" def ramse...
1,058
421
"""Linux-specific code""" from pysyte.types import paths def xdg_home(): """path to $XDG_CONFIG_HOME >>> assert xdg_home() == paths.path('~/.config').expand() """ return paths.environ_path("XDG_CONFIG_HOME", "~/.config") def xdg_home_config(filename): """path to that file in $XDG_CONFIG_HOME ...
677
252
import mpv import keyboard import time p = mpv.MPV() p.play("song_name.mp4") def play_pause(): p.pause = not p.pause keyboard.add_hotkey("e", play_pause) def full(): p.fullscreen = not p.fullscreen keyboard.add_hotkey("2", full) def go_to_start(): p.time_pos = 2 keyb...
387
186
# Copyright (c) 2010-2011 OpenStack, LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
91,989
29,911
import os import pytest from robocorp_ls_core.protocols import IConfigProvider from robocorp_ls_core.robotframework_log import get_logger from robocorp_ls_core.unittest_tools.cases_fixture import CasesFixture from robocorp_code.protocols import IRcc, ActionResult import sys from typing import Any from pathlib import ...
10,824
3,575
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
2,182
571
import os import re import string import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from GEN_Utils import FileHandling from loguru import logger logger.info("Import OK") # Set sample-specific variables input_path = 'examples/python/gauss_models/' output_path = 'examples/py...
1,373
508
# -------------------------------------------------------------------------------------------------- # Copyright (c) 2018 Microsoft Corporation # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and # associated documentation files (the "Software"), to deal in the Softw...
4,759
1,373
# Standard imports import sys # Project imports from icecreamscrape.cli import cli from icecreamscrape.webdriver import driver_factory from icecreamscrape import composites as comps from icecreamscrape.composites import create_timestamped_dir def main(args=sys.argv[1:]): """ Main function. :param: args is used for ...
765
265
# pylint: skip-file # type: ignore # -*- coding: utf-8 -*- # # tests.controllers.mission.mission_unit_test.py is part of The # RAMSTK Project # # All rights reserved. # Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com """Test class for testing Mission module algorithms ...
5,051
1,547
#!/usr/bin/env python from .error import FLVError from .compat import is_py2 from .tag import Header, Tag class FLV(object): def __init__(self, fd=None, strict=False): self.fd = fd self.header = Header.deserialize(self.fd) self.strict = strict def __iter__(self): return self ...
569
192
from pheasant.renderers.jupyter.jupyter import Jupyter jupyter = Jupyter() jupyter.findall("{{3}}3{{5}}") jupyter.page
120
51
#!/usr/bin/env python3 import json from http.server import HTTPServer, BaseHTTPRequestHandler num_requests = 0 class Handler(BaseHTTPRequestHandler): def _set_headers(self): self.send_response(200) self.send_header("Content-type", "application/json") self.end_headers() def do_GET(self...
687
234
from app.app import create_app from config import BaseConfig app = create_app(BaseConfig)
91
27
""" Create data for simulations (c) 2019 - EggdraSyl """ import json # from mockup import Blockchain, Block from minersimulator import MinerSimulator from math import sin, pi SPECIAL_MIN_TIME = 5 * 60 def init_stable( start, end, block_time=60, target="0000000000000028acfa28a803d200000000000000000...
3,896
1,799
# This file is part of Pynguin. # # Pynguin is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Pynguin is distributed in the ho...
13,473
4,233
from pathlib import Path from src import constants from src.data.download.utils.download_dataset_zip import download_dataset_zip def download_tencent_test( tmp_dir: Path = None, tqdm_name: str = None, tqdm_idx: int = None, ): """Download the test set of the Tencent Corpus and extract it to the ap...
725
262
import tensorflow as tf from ..fastspeech.model import ( TFFastSpeechEncoder, TFTacotronPostnet, TFFastSpeechLayer, ) from ..speechsplit.model import InterpLnr import numpy as np import copy class Encoder_6(tf.keras.layers.Layer): def __init__(self, config, hparams, **kwargs): super(Encoder_6,...
9,669
3,470
#!/usr/bin/env python # # $Id$ # """ Note: this is targeted for python 2.x. To run it under python 3.x you need to use 2to3 tool first: $ 2to3 -w test/test_memory_leaks.py """ import os import gc import sys import unittest import psutil from test_psutil import reap_children, skipUnless, skipIf, \ ...
4,766
1,622
# -*- coding: utf-8 -*- """Module compliance_suite.report_server.py This module contains class definition of small web server utility. Serves final report results as HTML. """ import datetime import time import http.server import socketserver import os import logging import inspect import socket import webbrowser imp...
8,516
2,385
import csv import pandas as pd import numpy as np import networkx as nx class RouteFinder(): def __init__(self): G = nx.Graph() with open('data/node_pairs.csv') as csvfile: readCSV = csv.reader(csvfile, delimiter=',') for row in readCSV: # add edges ...
2,146
658
#!/usr/bin/env python # Jérôme Carretero, 2013 (zougloub) """ reStructuredText support (experimental) Example:: def configure(conf): conf.load('rst') if not conf.env.RST2HTML: conf.fatal('The program rst2html is required') def build(bld): bld( features = 'rst', type = 'rst2html', # rst2html, rst...
8,084
2,712
import unittest import json import os from unittest.mock import MagicMock, patch from analytics.src.participationAnalytics import quizParticipation class TestQuizParticipation(unittest.TestCase): @patch("analytics.src.participationAnalytics.quizParticipation.runQuery") def test_generateData(self, lrs_mock):...
1,339
417
# from utils import Sample_main import gradcam_main import numpy as np import tensorflow as tf import argparse import os tf.logging.set_verbosity(tf.logging.ERROR) # disable to see tensorflow warnings def cam(in_path='sample.bmp', out_path = 'sample.png',): gradcam_main.cam_vis(in_path, out_path) def main(): ...
1,171
364
from ..utilities import ( has_same_structure, is_equivalent_molecule, is_equivalent_building_block, are_equivalent_functional_groups, ) def test_with_functional_groups(building_block, get_functional_groups): """ Test :meth:`.BuildingBlock.with_functional_groups`. Parameters ----------...
1,681
513
# The piwheels project # Copyright (c) 2017 Ben Nuttall <https://github.com/bennuttall> # Copyright (c) 2017 Dave Jones <dave@waveform.org.uk> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistribution...
9,512
3,072
''' Part of the dibase.rpi.gpio.test package. GPIO pin id support classes' platform tests. Underlying GPIO pin ids are those used by the Linux gpiolib and used to identify a device's GPIO pins in the Linux sys filesystem GPIO sub-tree. Developed by R.E. McArdell / Dibase Limited. ...
1,254
491
""" Analysis code for plotting vertical flux transport and/or a gif of temperature, velocity and KE from the merged output of a Dedalus Rayleigh-Bérnard code. Author: Tom Joshi-Cale """ # ==================== # IMPORTS # ==================== import numpy as np import h5py import argparse import matplotlib.pyplot as plt...
7,503
2,945
import sys import heapq import optparse from bitcount2 import bitcount hasher={} profile={} key_list=[] key_col=0 def usage(): print sys.argv[0]," [profile_file]" print " Load the profile lines from profile_file" print " Hash function uses the features listed in profile_file" print " and tests f...
2,104
778
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
3,804
1,011
#!/usr/bin/env python3 import logging, sys, argparse from collect import Collection if __name__ == '__main__': parser = argparse.ArgumentParser(description="test a project repo") parser.add_argument('--force-delete', help='instead of aborting on existing files, delete them', action='store_const', const=True) ...
5,037
1,441
from plumbum import local from benchbuild import project from benchbuild.utils import compiler, download, run, wrapping from benchbuild.utils.cmd import make, mkdir @download.with_git("https://github.com/bsc-pm/bots", limit=5) class BOTSGroup(project.Project): """ Barcelona OpenMP Task Suite. Barcelona ...
4,327
1,483
try: from setuptools import setup setup # quiet "redefinition of unused ..." warning from pyflakes # arguments that distutils doesn't understand setuptools_kwargs = { 'install_requires': [ ], 'provides': ['queued'], 'zip_safe': False } except ImportError: fro...
668
205
#!/usr/bin/python import angr,simuvex import sys,os import time from utils_sig import * from sym_tracer import Sym_Tracer from sig_recorder import Sig_Recorder #This class is responsible for performing symbolic execution. class Sym_Executor(object): def __init__(self,options=None,dbg_out=False): self.trace...
11,129
3,614
# flake8: noqa # errmsg.h CR_ERROR_FIRST = 2000 CR_UNKNOWN_ERROR = 2000 CR_SOCKET_CREATE_ERROR = 2001 CR_CONNECTION_ERROR = 2002 CR_CONN_HOST_ERROR = 2003 CR_IPSOCK_ERROR = 2004 CR_UNKNOWN_HOST = 2005 CR_SERVER_GONE_ERROR = 2006 CR_VERSION_ERROR = 2007 CR_OUT_OF_MEMORY = 2008 CR_WRONG_HOST_INFO = 2009 CR_LOCALHOST_...
2,228
1,206
import requests,smtplib,time from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart r =requests.get('https://www.codechef.com/JUNE19B/') while(1): if('(Challenge)' in r.text): s = smtplib.SMTP('smtp.gmail.com', 587) s.starttls() s.login("sender_gmail_id", "passwo...
992
335
# Copyright (c) 2020 Graphcore Ltd. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
2,840
1,036
# -*- coding: utf-8 -*- class HTTP: BAD_REQUEST = 400 UNAUTHORIZED = 401 FORBIDDEN = 403 NOT_FOUND = 404 METHOD_NOT_ALLOWED = 405 CONFLICT = 409 UNSUPPORTED_MEDIA_TYPE = 415
204
114