text
string
size
int64
token_count
int64
import connexion import six import flask import copy import os import base64 import time from mcenter_server_api.models.inline_response200 import InlineResponse200 # noqa: E501 from mcenter_server_api.models.inline_response2001 import InlineResponse2001 # noqa: E501 from mcenter_server_api.models.user import User #...
3,336
1,197
from .DashReactJsonSchemaForm import DashReactJsonSchemaForm __all__ = [ "DashReactJsonSchemaForm" ]
105
38
from functools import reduce import numpy as np from sparse import SparseTensor def reduce_prod(seq): return reduce(lambda item_1, item_2: item_1 * item_2, seq) class Polynomial: def __init__(self, coeff, indices, merge=True): """\\sum_{i=0}^{N-1} coeff[i] \\Pi_{j=0}^{NV-1} x_j^{indices[i, j]}""" ...
19,471
7,142
"""The poll management text.""" from .poll import get_poll_text def get_poll_management_text(session, poll, show_warning=False): """Create the management interface for a poll.""" poll_text = get_poll_text(session, poll, show_warning) return poll_text
266
84
# Generated by Django 2.2.3 on 2020-04-16 12:13 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('programming', '0008_auto_20200415_1406'), ] operations = [ migrations.AlterModelOptions( name='badge', options={'ordering': ...
354
134
import csv a = [[1,2,3], [4,5,6]] with open('test.csv', 'w', newline='') as testfile: csvwriter = csv.writer(testfile) for row in a: csvwriter.writerow(row) with open('test.csv', 'r') as testfile: csvreader = csv.reader(testfile) for row in csvreader: print(row)
273
113
''' Faça um programa que leia o nome completo de uma pessoa, mostrando em seguida o primeiro e o último nome separadamente. Ex.: Ana Maria de Souza primeiro = Ana último = Souza ''' n = str(input('Digite seu nome completo: ')).strip() nome = n.split() # split particiona e cria uma lista começando no indice 0 p...
543
185
from django import forms from django.contrib.auth.forms import ( UserCreationForm, SetPasswordForm, ) from hknweb.models import User, Profile class SettingsForm(forms.ModelForm): class Meta: model = User fields = ("username", "email", "first_name", "last_name", "password") class Profile...
1,715
490
#!/usr/bin/env python # -*- coding: utf-8 -*- """Postfix mail log parser and filter. This script filters and parses Postfix logs based on provided filter parameters. Example: To use this script type 'python pfstats.py -h'. Below is an example that filteres postfix log file (even gziped) based on date, se...
18,184
5,352
__author__ = 'lichengwu' def get_groups(sharding): sc = (int(sharding) - 1) * 8 group_list = "" for s in xrange(sc, sc + 8): group_list += str(s) + "," return group_list[:-1] def get_note(host): v = host[3] if v == 'm': return 'message_' + host[17:] else: t = host...
1,524
749
class EventLogPermissionEntry(object): """ Defines the smallest unit of a code access security permission that is set for an System.Diagnostics.EventLog. EventLogPermissionEntry(permissionAccess: EventLogPermissionAccess,machineName: str) """ @staticmethod def __new__(self, permissionAcces...
992
286
from typing import List BoolList = List[bool] DictList = List[dict] FloatList = List[float] IntList = List[int] StrList = List[str]
133
47
# -*- coding: utf-8 -*- # Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1) # # (1) Kamaelia Contributors are listed in the AUTHORS file and at # http://www.kamaelia.org/AUTHORS - please extend this file, # not this notice. # # Licensed under the Apache License, Version 2.0 (the "Lic...
3,396
922
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright © 2020 UWATC. All rights reserved. # # Use of this source code is governed by an MIT license that can # be found in the LICENSE.txt file or at https://opensource.org/licenses/MIT from .AgentTemplate import AgentTemplate class SimpleAgent(AgentTemplate): def...
486
165
# Program that downloads all episodes of a podcast # Features # -- Functions: add, remove, update # - Run the file to update without having to use python interpreter # - Download all episodes of a podcast, put into the correct folder # - Tag each file with metadata from the feed and the stored config import os ...
8,349
2,455
import time import numpy as np import cv2 from mss import mss from threading_ext.GameRecorder import GameRecorder from threading_ext.PausableThread import PausableThread class RecordingThread(PausableThread): def __init__(self, training_data_path: str, session_number: int, recorder: GameRecorder): supe...
1,954
651
#! /usr/bin/python3 import threading import socket from test import create_upd_clients from client import multicast_receive def test_multicast_receive(): clients = create_upd_clients(3) def run(client: socket.socket) -> None: multicast_receive(client) threads = [threading.Thread(name=f'clien...
638
215
from tools import * from model import * import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F from torch.utils.data import Dataset, DataLoader class NamesDataset(Dataset): """Name Classification dataset""" def __init__(self, path): self.data = pd.read_c...
2,135
745
# Generated by Django 3.1 on 2021-05-04 03:47 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('automated_logging', '0018_decoratoroverrideexclusiontest_foreignkeytest_fullclassbasedexclusiontest_fulldecoratorbasedexclusio'), ] operations = [ ...
737
215
# -*- coding: utf-8 -*- # Copyright 2013 Sebastian Ramacher <sebastian+dev@ramacher.at> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation th...
2,037
891
# -*- coding: utf-8 -*- """Top-level package for Alexa Skill Boilerplate.""" __author__ = """James Lin""" __email__ = 'james@lin.net.nz' __version__ = '0.1.0'
161
71
#Author: Wallace He from __future__ import absolute_import from __future__ import division from __future__ import print_function import glob import keras from keras.models import Sequential from keras.models import model_from_json from keras.models import load_model import partition import train_CNN def train_teach...
1,881
584
import requests import shutil import pandas as pd from typing import Dict, List def fetch_descartes_human_tissue(out_file: str, verbose: bool = True) -> None: """Function to fetch Loom Single-Cell tissue data from Descartes human database. Args: out_file: Output file that is going to store .loom...
3,651
1,202
#!/usr/bin/env python3.6 import random #importing random module from user import User #importing class User from credential import Credential #importing class Credential def create_credential(username,accountname,password): """ create_credential function that creates an instance of the class credential ...
9,528
2,121
'''Line up operators...''' import cp_actions as cp import re def act(controller, bundle, options): ''' Required action method ''' context = cp.get_context(controller) line_ending = cp.get_line_ending(context) lines, range = cp.lines_and_range(context) newlines = line_ending.join(balance_...
1,173
416
import numpy as np import pandas as pd import itertools ''' Section below creates lists for your reaction parameters. Change names of lists where appropriate ''' #For bigger lists use np.arange(min_value, max_value, step) Pyridine = [0.1, 0.2, 0.3] # in mmol Aldehyde = [0.1, 0.2, 0.3] # in mmol Isocyanide = [0.1, 0....
1,333
529
import enum class ConnectionState(enum.Enum): PING = "ping" SEND_SYN = "syn" WAIT_FOR_SYN = "wait" OPEN = "open" RELAY = "relay" UNREACHABLE = "unreachable"
183
79
""" rpath task function """ from mechlib import filesys from mechlib.filesys import build_fs from mechlib.filesys import root_locs def rpath_fs(ts_dct, tsname, mod_ini_thy_info, es_keyword_dct, run_prefix, save_prefix): """ reaction path filesystem """ # Set up coo...
2,241
880
# -*- coding: utf-8 -*- """ Created on Tue Sep 29 14:38:54 2020 @author: https://stackoverflow.com/questions/18262293/how-to-open-every-file-in-a-folder """ import os #os module imported here location = os.getcwd() # get present working directory location here counter = 0 #keep a count of all files found csvf...
1,361
417
from urllib.parse import quote from social_core.utils import sanitize_redirect, user_is_authenticated, \ user_is_active, partial_pipeline_data, setting_url def do_auth(backend, redirect_name='next'): # Save any defined next value into session data = backend.strategy.request_data(merge=Fals...
5,317
1,533
#!/usr/bin/python # Oct 2019 JMA # make_samples.py Use the splits_aggregator module to create samples ''' Write a short description of what the program does here. Usage: $ ./make_samples.py [-v] [-d ROOT_DIR] [-c pair_cnt] -v verbose output -d data directory to read from -c number of randomly ...
1,667
589
# -*- coding: utf-8 -*- # Resource object code # # Created: Di. Feb 3 12:11:53 2015 # by: The Resource Compiler for PySide (Qt v4.8.4) # # WARNING! All changes made in this file will be lost! from PySide import QtCore qt_resource_data = b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x009QStatusBar::...
1,550
1,161
from unittest import TestCase from unittest.mock import patch, Mock import lineflow from lineflow import Dataset from lineflow.core import ConcatDataset, ZipDataset from lineflow.core import RandomAccessConcat, RandomAccessZip class RandomAccessConcatTestCase(TestCase): def setUp(self): self.n = 5 ...
12,081
3,895
import math import numpy as np def eng_string(x, format='%.3g', si=True): ''' Taken from: https://stackoverflow.com/questions/17973278/python-decimal-engineering-notation-for-mili-10e-3-and-micro-10e-6/40691220 Returns float/int value <x> formatted in a simplified engineering format - using an expone...
2,393
898
# Directory.py # Import from flask import Blueprint, render_template # Make Blueprint for __init__.py Directory = Blueprint("Directory", __name__) # App Welcome Page @Directory.route('/') def index(): return render_template("home.html", message = "DS Med Cabinet API using natural language processing to re...
595
173
# Generated by Django 3.1.1 on 2020-09-16 15:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("product", "0124_auto_20200909_0904"), ] operations = [ migrations.AlterModelOptions( name="productvariant", options=...
567
189
__author__ = 'yinjun' """ Definition of TreeNode: class TreeNode: def __init__(self, val): this.val = val this.left, this.right = None, None """ class Solution: """ @param root: The root of binary tree. @return: buttom-up level order in a list of lists of integers """ def leve...
943
279
# -*- coding: utf-8 -*- from setuptools import setup, find_packages with open('requirements.txt') as f: install_requires = f.read().strip().split('\n') # get version from __version__ variable in mtrh_dev/__init__.py from mtrh_dev import __version__ as version setup( name='mtrh_dev', version=version, description=...
530
194
#!/usr/bin/env python3 import subprocess as sub import time import simplejson as json import os from sys import stderr import subprocess import platform import sys import stat import pwd import grp import BrewPiUtil as util import brewpiVersion import expandLogMessage from packaging import version from MigrateSettings...
23,062
6,650
""" MassOpenCloud / Hardware Isolation Layer (MOC/HIL) Slurm and *NX Subprocess Command Helpers May 2017, Tim Donahue tpd001@gmail.com """ import os from pwd import getpwnam, getpwuid from subprocess import Popen, PIPE from time import time from hil_slurm_constants import (HIL_RESNAME_PREFIX, HIL_RESNAME_FIELD_SEPA...
10,086
3,273
# -*- coding: utf-8 -*- # PyContourlet # # A Python library for the Contourlet Transform. # # Copyright (C) 2011 Mazay Jiménez # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation ...
17,596
8,304
""" External libraries packaged with for version stability """ from .tabulate import tabulate
96
25
# -*- coding: utf-8 -*- from boltons.statsutils import Stats def test_stats_basic(): da = Stats(range(20)) assert da.mean == 9.5 assert round(da.std_dev, 2) == 5.77 assert da.variance == 33.25 assert da.skewness == 0 assert round(da.kurtosis, 1) == 1.9 assert da.median == 9.5 def _test_p...
1,112
442
import os import pprint import json import random accept = False colors = { "Vo": "#e05ab4", "Da": "#59afe1", "Vi": "#e0e05a" } with open('idols.json') as f: idols = (json.load(f))["idols"] # Insert 23 data def pick(msg): global accept if not accept: print("Not accept") retu...
1,018
385
class WorldState(object): def __init__(self): self.variables = {} def clone(self): temporary_world_state = WorldState() temporary_world_state.variables = self.variables return temporary_world_state
240
64
"""Plot Widgets for the UWB Simulation GUI This file contains several plot widgets that can be used to plot simulation data in real time and redraw the plots with matplotlib for better quality. Classes: QLivePlot: Base class for real time plots QLivePlot_Groundtrack: Real time plot for groundtrack QLiveP...
10,782
3,546
#!/usr/bin/env python from pda.dataset import init_aggregate_and_appliance_dataset_figure import matplotlib.pyplot as plt from scipy.stats import * import numpy as np subplots, chan = init_aggregate_and_appliance_dataset_figure( start_date='2013/6/4 10:00', end_date='2013/6/4 13:30', n_subplots=2, date_format...
1,018
397
import socket import json import struct from sciibo.core.helpers import Queue from .thread import SocketThread class ConnectionThread(SocketThread): def __init__(self, sock): super(ConnectionThread, self).__init__() self.sock = sock # The number of bytes we are expecting self.exp...
2,691
696
# Copyright (C) 2008 Jimmy Do <jimmydo@users.sourceforge.net> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This...
2,651
882
import arcade import timeit BALL_DRAG = 0.001 NO_FLIPPER = 0 FLIPPER_UP = 1 class MyApplication(arcade.Window): """ Main application class. """ def __init__(self, width, height, resizable): super().__init__(width, height, resizable=resizable) self.sprite_list = arcade.SpriteList() s...
6,192
2,251
import json from loguru import logger from .config import PERFORMATIVE, PERFORMATIVE_PACK, PERFORMATIVE_PACK_TAKEN, TEAM, X, Y, Z, NAME, ACTION, CREATE, \ TYPE from .agent import AbstractAgent, LONG_RECEIVE_WAIT from .vector import Vector3D from spade.message import Message from spade.behaviour import OneShotBehav...
2,350
809
import numpy as np import pybullet as p class Initializer(): def __init__(self,floor_known=None,floor_frame_path=None,): if floor_known: self.RT = np.load(floor_frame_path) else: self.RT =np.eye(4) self.rbdl2bullet = [0, 1, 2, 3, 4, 5, 6, 7, 8, ...
2,178
1,066
import tensorflow.keras as keras # pad_sequences from pad_sequences import pad_sequences_adjacency from pad_sequences import pad_sequences_sparse def pad_idseqs(func): def wrapper(*args, **kwargs): # read and remove padding settings maxlen = kwargs.pop('maxlen', None) padding = kwargs.pop...
3,220
991
import unittest import threading from g1.threads import locks class ReadWriteLockTest(unittest.TestCase): def setUp(self): super().setUp() self.rwlock = locks.ReadWriteLock() def assert_state(self, num_readers, num_writers): self.assertEqual(self.rwlock._num_readers, num_readers) ...
4,894
1,621
""" Here definitions and attributes of all statistical distributions that are used in the simulation are defined""" from abc import ABCMeta, abstractmethod import random #import np class StatDis(object): __metaclass__ = ABCMeta def __init__(self): pass @abstractmethod def generate(self): ...
1,104
337
#!/usr/bin/env python3 import csv import xml.etree.ElementTree as ET import sys import os.path class QuestionData: final_answer = "" final_answer_time = 0 first_answer = "" attempts = 0 first_answer_time = 0 def __init__(self,final_answer,final_answer_time,attempts,first_answer,first_answer_t...
6,594
1,753
import dash import dash_core_components as dcc import dash_html_components as html divider_text = ' • ' def get_navigation_header(page_nm): font_size_param = 16 dot_style = dict( color = 'gray', fontSize = '%spx' % (font_size_param), ) default_style = dict( position = 'relativ...
2,255
697
/home/runner/.cache/pip/pool/68/e2/05/188e3a14bbe42690f0cbce7c7c576b1dbc9d3d1bb571a2d3908f144cea
96
71
# -*- coding: utf-8 -*- """ Created on Tue May 24 11:14:03 2016 @author: Wajih-PC """ import numpy as np def normalize(x,mu,sigma): x = np.subtract(x,mu) x = np.true_divide(x,sigma) return x
217
108
class Solution: def searchRange(self, nums: List[int], target: int) -> List[int]: left, right = self.first(nums, target), self.last(nums, target) return [left, right] def last(self, nums, target) : if not nums : return -1 left, right = 0, len(nums) -1 whi...
1,070
314
import pandas as pd import numpy as np #定义资料集 df1 = pd.DataFrame(np.ones((3, 4)) * 0, columns=['a', 'b', 'c', 'd']) df2 = pd.DataFrame(np.ones((3, 4)) * 1, columns=['a', 'b', 'c', 'd']) df3 = pd.DataFrame(np.ones((3, 4)) * 2, columns=['a', 'b', 'c', 'd']) #concat纵向合并 axis=0纵向,axis=1横向 res = pd.concat([df1, df2, df3],...
1,526
844
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('core', '0050_customersetting_can_view_mail'), ] operations = [ migrations.AddField( model_name='customersetting'...
799
450
import urllib import sched import time from threading import Thread from token import Token from ..utils.http import do_basic_secure_post from ..exceptions.exceptions import BasicAuthenticationFailedException class DefaultSequencingOAuth2Client(object): # Attribute for value of redirect url ATTR_REDIRECT_UR...
4,128
1,236
from elasticsearch import Elasticsearch, RequestsHttpConnection from requests_aws4auth import AWS4Auth import boto3 def get_es_client(conn, silent=False): """ Returns the elasticsearch client connected through port forwarding settings """ elastic_url = "https://localhost:9222" protocol_config = { ...
1,019
302
from pprint import pprint import pytest from flask_taxonomies.proxies import current_flask_taxonomies from flask_taxonomies.term_identification import TermIdentification from invenio_records import Record from oarepo_taxonomies.exceptions import DeleteAbortedError from oarepo_taxonomies.signals import lock_term from ...
7,135
2,530
from django.core.mail import send_mail, BadHeaderError from django.http import HttpResponse from django.shortcuts import render, redirect from .forms import ContactForm from profiles.models import UserProfile def contactView(request): if request.user.is_authenticated: try: profile = UserProfil...
1,322
347
from tests.utils import _mock_gql create_deposit_response = dict( createDepositAccount=dict( accountNumber="123", accountName="john doe", accountType="deposit", bankName="Providus", accountReference="ref", ) ) def test_create_deposit(): from buycoins import accoun...
592
196
from fabric.decorators import task, roles from haus_vars import APP_INFO, parse_vars from fabric.api import run, execute from fabric.context_managers import cd from heroku import create_fixture_on_s3, grab_fixture_on_s3 import cStringIO def copyBucket(srcBucketName, dstBucketName, aws_key, aws_secret, folder_name...
3,755
1,325
from umysqldb import connections from umysqldb import cursors def connect(db, host="localhost", port=3306, user="root", passwd="root", charset="utf8", cursorclass=cursors.Cursor, autocommit=False): return connections.Connection(database=db, host=host, port=port, user=user, ...
505
133
import re import networkx import itertools import argparse import json def build_network(filename,outfile,mb_threshold): regex = re.compile('([0-9]+) kB: (.*)(?=\()') network_list = [] current_network = [] with open(filename, 'r') as memlog: ignore_line = True for line in memlog.r...
2,696
802
from sys import argv from random import randint from time import time import matplotlib.pyplot as plt def insertion_sort(arr): n = len(arr) for i in range(1, n): v = arr[i] j = i - 1 while j >= 0 and arr[j] > v: arr[j + 1] = arr[j] j -= 1 arr...
1,428
575
from invoke import Collection, task from opstrich.invoke import check, openssl @task def deploy(c): """ Build and run a Docker container to deploy. """ c.run("docker build -t zappa-lambda .") c.run("docker run -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY zappa-lambda") c.run( "DJANGO_...
638
212
import torch import numpy as np import copy def remove(path): data = torch.load(path) location_list, action_list = [np.reshape(st[0], (1, 8)) for st in data], [st[1] for st in data] location_list = np.concatenate(location_list, axis=0) action_list = np.asarray(action_list) action_0 = action_l...
2,490
997
def e(): print("This is function e in file d!") class E: def __init__(self): self.content = "This is class E in file d" def print(self): print(self.content)
188
63
""" Content negotiation deals with selecting an appropriate renderer given the incoming request. Typically this will be based on the request's Accept header. """ import flask as fl from . import exc class BaseContentNegotiator(object): def get_accept_mimetypes(self, request=None): """Given the incoming request...
2,435
942
# Generated by Django 3.0.8 on 2020-08-11 14:16 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('accounts', '0004_addtocart'), ] operations = [ migrations.AddField( model_name='addtocart', name='cart_useremail', ...
403
140
import pprint import sys import re FILE = sys.stdin #FILE = open('sample.in') def is_palindrome(n): k = str(n) return list(k) == list(reversed(k)) def reverse_add(n): return n + int(str(n)[::-1]) #import ipdb;ipdb.set_trace() test_cases = range(int(FILE.readline())) #import ipdb; ipdb.set_trace() for t...
539
216
from .baseprocessor import BaseProcessor class FB15K237Processor(BaseProcessor): def __init__(self, node_lut, relation_lut, reprocess): super().__init__("FB15K237", node_lut, relation_lut, reprocess)
214
75
import time import os import pathlib import sys from subprocess import call #TODO: Maybe make a pip_handler file idk def pip_install(packageName: str): try: call(f'py -m pip install {packageName}') except: call(f'pip install {packageName}') try: from pypresence import prese...
1,256
459
import bpy import subprocess REBUILD = 0 if REBUILD: subprocess.call([ "g++", bpy.path.abspath('//../main.cpp'), bpy.path.abspath('//../PtTree.cpp'), "-o", bpy.path.abspath('//PtTree') ]) # Collect the input data. verts = bpy.data.meshes['PointCloud'].vertices quer...
1,086
426
# zschema sub-schema for zgrab2's ssh module (modules/ssh.go) # Registers zgrab2-ssh globally, and ssh with the main zgrab2 schema. from zschema.leaves import * from zschema.compounds import * import zschema.registry import zcrypto_schemas.zcrypto as zcrypto from . import zgrab2 # NOTE: Despite the fact that we have...
10,274
3,485
from flask import render_template,request,redirect,url_for,abort from ..models import User,Post,Comment,Subscriber from ..requests import get_quotes from . import main from .forms import PostForm,CommentForm,DelForm,UpdateProfile from app.auth.forms import SubscriptionForm from .. import db,photos from flask_login impo...
5,123
1,671
# int, float, complex Numeric Types # Float are nothing but decimal values pi = 3.14 print(pi)
100
36
from django.conf import settings from django.contrib.auth.decorators import login_required from django.http import HttpResponse from uw_saml.utils import is_member_of_group # Create your views here. @login_required def index(request): if is_member_of_group(request, settings.UW_SAML_PERMISSIONS['perm2']): ...
452
136
#! /usr/bin/env python -u # coding=utf-8 from shutil import copyfile from genoml.steps import PhenoScale, StepBase from genoml.utils import DescriptionLoader __author__ = 'Sayed Hadi Hashemi' class ModelValidateStep(StepBase): """performs validation with existing data""" _valid_prefix = None def _reduc...
4,370
1,287
from typing import Tuple, List from resotocore.dependencies import parse_args from resotocore.types import JsonElement def test_parse_override() -> None: def parse(args: str) -> List[Tuple[str, JsonElement]]: return parse_args(args.split()).config_override # type: ignore assert parse(f"--override a...
721
263
############################################################################## # Copyright 2018 Rigetti Computing # # 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://ww...
7,374
2,045
n = input("Мы будем проверять теорию коллатца. Введите число") def collatz(num): num = int(num) if not num: return None while num != 1: num = num/2 if num % 2 == 0 else 3*num + 1 collatz(n)
212
91
class Solution: def findPair(self, arr, L,N): store = set() for num in arr : if num in store : return True store.add(num - N) store.add(num + N) return False if __name__ == '__main__': t = int(input()) for _ i...
554
181
from dataclasses import dataclass from tlh.const import RomVariant from intervaltree import IntervalTree, Interval @dataclass class Pointer: rom_variant: RomVariant = None address: int = 0 points_to: int = 0 certainty: int = 0 author: str = '' note: str = '' class PointerList: def __init_...
1,270
378
from django.db import models from djangoyearlessdate.models import YearlessDateField, YearField from djangoyearlessdate.helpers import YearlessDate class YearlessDateModel(models.Model): """Sample model for testing YearlessDateField. """ yearless_date = YearlessDateField() optional_yearless_date = Yea...
554
160
from ror.RORParameters import RORParameters from ror.RORResult import RORResult from ror.AbstractTieResolver import AbstractTieResolver from ror.result_aggregator_utils import Rank class NoTieResolver(AbstractTieResolver): def __init__(self) -> None: super().__init__('NoResolver') def resolve_rank(se...
597
166
""" util This package is for util modules """
47
16
# Time: O(n) # Space: O(1) class Solution(object): def numTimesAllBlue(self, light): """ :type light: List[int] :rtype: int """ result, right = 0, 0 for i, num in enumerate(light, 1): right = max(right, num) result += (right == i) ret...
331
108
def input_parse(): with open("day1.txt", r) as inputFile: input_list = inputFile.readline() return
119
39
import itertools import logging from typing import Dict, Tuple from tilapia.lib.basic import bip44 from tilapia.lib.basic.functional.require import require from tilapia.lib.hardware import interfaces as hardware_interfaces from tilapia.lib.provider import data from tilapia.lib.provider.chains import btc from tilapia.l...
3,472
1,090
""" DFA Automata Implementation """ class State: """ Nodes/States in an automaton """ def __init__(self, isAccept, arrows): # Boolean, wether or not this state is an accept state self.isAccept = isAccept # dictionary of keys/labels:Other states self.arrows = arrows class DFA: ...
1,747
546
# Generated by Django 2.2.3 on 2019-08-29 15:30 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('database', '0026_auto_20190829_1528'), ] operations = [ migrations.AddField( model_name='vendor', name='email', ...
568
193
import sys import os class PDF(object): def pdf(self, docx): sofficepath = 'soffice' convertcmd = '%s --headless --convert-to pdf %%s' % sofficepath os.popen(convertcmd % docx)
207
73
""" _ _ _ _ _ _ __ | |_| |_ __ ___ | (_) |__ | '_ \| __| | '_ ` _ \| | | '_ \ | | | | |_| | | | | | | | | |_) | |_| |_|\__|_|_| |_| |_|_|_|_.__/ A robust, fast and efficient 'first-class' Python Library for NTLM authentication, signing and encryption (c) 2015, Ian Clegg <ian.clegg@sour...
1,181
375