text string | size int64 | token_count int64 |
|---|---|---|
"""
restapi - base for calling rest resources
Stackdriver Public API, Copyright Stackdriver 2014
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 license... | 5,633 | 1,550 |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 11 15:05:41 2019
@author: jrodriguez119
"""
import tkinter as tk
from tkinter import ttk
import crearcapas
import perceptron_multicapa
from threading import Thread
import sys
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2... | 13,896 | 5,020 |
from tests.graph_case import GraphTestCase
class TestSearchOneDrive(GraphTestCase):
@classmethod
def setUpClass(cls):
super(TestSearchOneDrive, cls).setUpClass()
@classmethod
def tearDownClass(cls):
pass
def test1_search_files(self):
result = self.client.search.query("Gu... | 419 | 135 |
import requests
from ..base.test import BaseTestCase, AuthorizedTestCase
import uuid
import common
class T(AuthorizedTestCase):
@property
def path(self):
return '/service/secu/user'
def setUp(self):
super().setUp()
self.data = {
'username': 'myao',
... | 728 | 262 |
"""
Define a command that should be run from a crontab.
This one should check consistency of Meldungen:
at most one Meldung per Aufgabe, per User.
"""
from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
from django.utils import translation
from django.conf... | 2,204 | 615 |
# Generated by Django 2.1.15 on 2020-09-07 10:56
import app.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0012_user_id_ctfd'),
]
operations = [
migrations.CreateModel(
name='CTFd_configs',
fields=... | 1,215 | 370 |
# coding: utf-8
"""
API's OpenData do Open Banking Brasil
As API's descritas neste documento são referentes as API's da fase OpenData do Open Banking Brasil. # noqa: E501
OpenAPI spec version: 1.0.0-rc5.2
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.gi... | 6,404 | 1,999 |
import sqlalchemy as sa
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.sql.functions import GenericFunction
class current_locale(GenericFunction):
type = sa.types.String()
@compiles(current_locale)
def compile_current_locale(element, compiler, **kw):
# Lazy import get_locale so that it can be ... | 481 | 149 |
# 101050010
sm.warp(101050000, 7)
sm.dispose()
| 47 | 38 |
from suppy.utils.stats_constants import DIVERGENCE, TYPE
from typing import Any, Dict
from suppy.simulator.atomics.atomic import Atomic
class DivergenceAtomic(Atomic):
def __init__(self, uid: str, seh, name: str):
Atomic.__init__(self, uid, seh, name, 0, 0)
def get_stats(self) -> Dict[str, Any]:
... | 839 | 262 |
import logging
from .lib.init_helper import init_logging, load_modules
# Initialize logging format before loading all other modules
logger = init_logging(logging.INFO)
import argparse
from .lib import pytorch as lib_pytorch
from .lib.config import BenchmarkConfig
from .lib.pytorch.benchmark import (
make_defaul... | 2,673 | 836 |
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, Boolean, String, DateTime, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.orm import sessionmaker
from sqlalchemy.sql import func
import datetime
import os
im... | 5,180 | 1,639 |
# Need at least 20 # characters
"""
===============
Generate Images
===============
This ipython notebook demonstrates how to generate an image dataset with rich
ground truth from a virtual environment.
"""
####################
import time; print(time.strftime("The last update of this file: %Y-%m-%d %H:%M:%S", time.gm... | 6,767 | 2,190 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-10-06 08:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blogs', '0002_auto_20161006_1652'),
]
operations = [
migrations.AlterField(
... | 458 | 170 |
"""
Summary:
Example use of the fmp package to update file paths in an .ief file
and save the ief file under a new name.
Author:
Duncan Runnacles
Created:
01 Apr 2016
Copyright:
Duncan Runnacles 2016
TODO:
Updates:
"""
import os
from ship.... | 1,660 | 556 |
"""
HTTPRequest.py
Copyright 2010 Andres Riancho
This file is part of w3af, http://w3af.org/ .
w3af 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 version 2 of the License.
w3af is distributed in the hope that... | 8,387 | 2,402 |
#!/usr/bin/env python
from __future__ import print_function
import sys, os
from nbformat import v4
def parse_line(line):
if not line.startswith('#'):
return None
ilevel = 0
for char in line:
if char == '#': ilevel += 1
else: break
name = line[ilevel:].strip()
return ileve... | 817 | 278 |
from rest_framework import serializers
class ArticleSerializer(serializers.Serializer):
date = serializers.CharField(allow_blank=False)
sentiment = serializers.CharField(allow_blank=False)
title = serializers.CharField(allow_blank=False)
description = serializers.CharField(allow_blank=False)
articl... | 1,102 | 298 |
import numpy as np
def sum_pair_equals(values, val_eq):
values = np.array(values)
return np.where(values + values[:, None] == val_eq)[0]
def sum_triad_equals(values, val_eq):
values = np.array(values)
sum_ = values + values[:, None] + values[:, None, None]
return np.array(np.where(sum_ == val_eq... | 329 | 123 |
import pytest
from persine import Persona
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from unittest.mock import Mock
@pytest.fixture
def engine():
def launch_chrome(user_data_dir):
options = Options()
options.add_argument("--headless")
return webdr... | 2,306 | 724 |
import torch
import numpy as np
import cv2
import os
import h5py
from collections import defaultdict
from mvn.models.triangulation import RANSACTriangulationNet, AlgebraicTriangulationNet, VolumetricTriangulationNet
from mvn.models.loss import KeypointsMSELoss, KeypointsMSESmoothLoss, KeypointsMAELoss, KeypointsL2Loss... | 26,556 | 9,187 |
#!/usr/bin/env python
"""
TCP Linux sockets with netstat
"""
import re
import sys
import socket
import lib_util
import lib_common
from lib_properties import pc
from sources_types import addr as survol_addr
# Many advantages compared to psutil:
# The Python module psutil is not needed
# psutil gives only sockets ... | 4,846 | 1,967 |
# models.py
# created by Sylvestre-Alvise Rebuffi [srebuffi@robots.ox.ac.uk]
# Copyright © The University of Oxford, 2017-2020
# This code is made available under the Apache v2.0 licence, see LICENSE.txt for details
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable... | 5,832 | 2,176 |
#Condições Aninhadas
#if -> elif -> elif -> else # pode usar quantos elif quiser
#Aprovando Empréstimo
casa = float(input('Qual o valor da casa: R$ '))
salario = float(input('Qual o valor do salário: R$ '))
tempo = int(input('Quanto anos para pagar? '))
salario30 = salario * 0.30
prestacao = casa / (tempo * 12)
if sal... | 1,028 | 440 |
import discord
import os
import requests
import asyncio
import psycopg2
import logging
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from discord.ext import commands
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
datefmt=f"%m/%d... | 2,196 | 737 |
from gingerit.gingerit import GingerIt
def check_grammar(text):
parser = GingerIt()
correct_text = parser.parse(text)
return correct_text['result'] | 160 | 52 |
'''
Escreva um programa que leia dois números inteiros e compare- os, mostrando na tela uma mensagem:
- O primeiro valor é maior
- O segundo valor é maior
- não existe valor maior, os dois são iguais
'''
# Ler dois números inteiros
n1 = int(input('Informe o primeiro número: '))
n2 = int(input('In... | 619 | 228 |
def main():
# input
N, Y = map(int, input().split())
# compute
for i in range(N+1):
for j in range(N+1):
if 10000*i+5000*j+1000*(N-i-j)==Y and N-i-j>=0:
print(i, j, N-i-j)
exit()
# output
print(-1, -1, -1)
if __name__ == '__main__':
mai... | 324 | 143 |
# -*- coding: utf-8 -*-
{
'name': 'Open-Xchange Odoo',
'version': '1.0',
'category': 'Social Network',
'sequence': 2,
'summary': 'Discussions, Mailing Lists, News',
'description': """
Open-Xchange Integration
=========================
This module is designed to be a standard open-xchange inbox i... | 1,127 | 340 |
import sys
sys.path.append('src')
from functions import *
import numpy as np
from numpy.testing import assert_allclose
"-----------------------Full soliton--------------------------------------------"
def get_Qs(nm, gama,fv, a_vec, dnerr, index, master_index,lamda, n2):
if nm == 1:
D = loadmat('loading_dat... | 10,853 | 4,928 |
import os
import requests
def download(url):
download_path = '/root/AndroidHeatMap/download/'
if not os.path.exists(download_path):
os.mkdir(download_path)
all_content = requests.get(url).text
file_line = all_content.split("\n")
if file_line[0] != "#EXTM3U":
raise BaseExceptio... | 1,089 | 395 |
from collections import defaultdict
from time import sleep
from absl import app
from absl import flags
import erdos.graph
from erdos.op import Op
from erdos.utils import frequency
from erdos.message import Message
from erdos.data_stream import DataStream
from erdos.timestamp import Timestamp
from erdos.message import... | 4,945 | 1,400 |
from django.http import HttpResponse
from django_base_shop.models import ShippingTag
from .models import ConcreteCart, ConcreteProduct
def index(request):
return HttpResponse(b"Hello world")
def check_cart(request):
cart = request.cart
if not cart.is_persisted:
return HttpResponse(b"None")
... | 1,436 | 467 |
# PYQT
import sys
#from ...TabPanel import TabPanel
import sip
from q3.ui.engine import qtw,qtc,qtg
from ... import consts, prop, direction
from ...ui import orientation, colors
from ...moduletype import ModuleType
from ...nodeiotype import NodeIoType
from ...q3vector import Q3Vector
from ...EventSignal import E... | 11,600 | 3,780 |
# import pandas, matplotlib, and seaborn
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
pd.set_option('display.width', 53)
pd.set_option('display.max_columns', 5)
pd.set_option('display.max_rows', 200)
pd.options.display.float_format = '{:,.0f}'.format
covidtotals = pd.read... | 2,538 | 1,028 |
import unittest
import numpy as np
from reamber.base import Bpm, Hit, Hold, Map, MapSet
from reamber.base.lists import BpmList
from reamber.base.lists.notes import HitList, HoldList
# noinspection PyTypeChecker,DuplicatedCode
class TestMapSet(unittest.TestCase):
""" Not much to test here since Bpm is basically ... | 7,359 | 2,805 |
import re
from util import *
from operation import Operation, OperationResult
class Replacement:
def __init__(self, regex, substitution):
self.regex = regex
self.substitution = substitution
class MinifyOperation(Operation):
def __init__(self):
self.inMultilineComment = False
pass
def apply(self, line, sta... | 1,252 | 519 |
# -*- coding: utf-8 -*-
from index_matrix import Matrix
__author__ = 'Patricio Lopez Juri'
class Graph:
def __init__(self, V, E, K):
self.V = V
self.E = E
self.K = K
self.A = Matrix.square(items=V)
for a, b in self.E:
self.A[a, b] = 1
@property
def o... | 2,024 | 734 |
from urllib.parse import parse_qs
# 解析查询字符串 query string
my_values = parse_qs('red=5&blue=0&green=',
keep_blank_values=True)
# print(repr(my_values)) # 原书写法
print(my_values) # 返回的是字典,直接这样写就行了
# >>>
# {'red': ['5'], 'blue': ['0'], 'green': ['']}
# 查询字符串中的参数可能有:多个值和空白 blank 值。
# 有些参数则没有出现。
# 使用 g... | 1,302 | 704 |
from enum import Enum
import pygame
class Colour(Enum):
WHITE = 0
BLACK = 1
class Piece:
def __init__(self, column, row, model, colour):
self.row = row
self.column = column
self.model = model
self.colour = colour
# Load sprites into pygame
class Sprites:
board_image... | 2,643 | 1,229 |
from micropython import schedule
_subscribers = {}
def publisher(topic):
def _publish(func):
def _wrapper(*args, **kwargs):
value = func(*args, **kwargs)
publish(topic, value)
return value
return _wrapper
return _publish
def publish(topic, value) -> Non... | 656 | 193 |
import boto3
import logging
import os
from datetime import datetime
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
def get_ec2_client():
return boto3.client('ec2')
def get_ssm_client():
return boto3.client('ssm')
def get_ce_client():
return boto3.client('ce')
def get_meteringmarketplace_clien... | 5,808 | 1,903 |
# Library Imports
from itertools import islice
import csv
# Local Module Imports
import config
class Metadata(object):
"""
Base class for maintaining metadata (properties and their attributes) about
Node and Edge objects. This base class handles parsing and storing the CSV
data, and providing accessor method... | 8,000 | 2,402 |
"""
Class to control the execution of the optimization session
"""
import shutil
import configparser
import glob
import os
import subprocess
import sys
from pathlib import Path
from antares_xpansion.input_checker import check_candidates_file
from antares_xpansion.input_checker import check_settings_file
from ant... | 20,165 | 5,871 |
from tweepy import StreamListener
import json, time, sys
class SListener(StreamListener):
def __init__(self, api = None, fprefix = 'streamer'):
self.api = api or API()
self.filecounter = 1
self.fprefix = fprefix
def on_data(self, data):
if 'in_reply_to_status' in dat... | 1,186 | 357 |
'''
N = int(input('Digite um NÚMERO: '))
tot = 0
for c in range(1, n+1):
if n%c == 0:
print('\033[33m', end=' ')
tot+=1
else:
print('\033[31m', end=' ')
print('{}'.format(c), end=' ')
print('\n\033[mO numero {} foi divisivel {} vezes'.format(n, tot))
if tot == 2:
print('E POR ISS... | 379 | 172 |
from django.shortcuts import render
# Create your views here.
def home(request):
return render(request,'core/index.html')
def detail(request):
pass
| 158 | 47 |
# -*- coding: utf-8 -*-
import qclib.tag_times
def qc_by_tagging_times(path2data, path2database):
out = qclib.tag_times.Controller(path2data=path2data, path2database=path2database)
return out
| 206 | 80 |
import socket
address = ('127.0.0.1', 31500)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # s = socket.socket()
s.bind(address)
s.listen(5)
ss, addr = s.accept()
print 'got connected from',addr
ss.send('hihi')
ra = ss.recv(512)
print ra
ss.close()
s.close() | 317 | 153 |
# what is the first number to have 5000 different ways to sum with prime numbers?
import math
import timeit
start = timeit.default_timer()
def is_prime(x):
if x == 2:
return True
if x % 2 == 0 or x == 1:
return False
for i in range(3,int(math.sqrt(x))+1,2):
if x % i == 0:
... | 1,906 | 696 |
from package.query_db import query
from package.lambda_exception import LambdaException
def handler(event, context):
is_admin = event['is_admin']
is_supporter = event['is_supporter']
is_student = event['is_student']
if is_admin == "" and is_supporter == "" and is_student == "":
get_users_sql ... | 2,258 | 680 |
# Title: Swap Nodes in Pairs
# Link: https://leetcode.com/problems/swap-nodes-in-pairs
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Problem:
def swap_pairs(self, head: ListNode) -> ListNode:
pre, pre.next = self, head
while pre.nex... | 705 | 243 |
import numpy as np
import cv2
import imageio
import tensorflow as tf
import json
import csv
import os
import sys
sys.path.append("object_detection")
sys.path.append("object_detection/deep_sort")
sys.path.append("action_detection")
import argparse
import object_detection.object_detector as obj
import action_detection... | 16,967 | 5,747 |
import os
import unittest
from pathlib import Path
import pytest
from paramak import SweepMixedShape
class test_object_properties(unittest.TestCase):
def test_solid_construction(self):
"""checks that a SweepMixedShape solid can be created"""
test_shape = SweepMixedShape(
points=[
... | 5,556 | 1,837 |
from boto3.s3.transfer import S3Transfer
import boto3
import glob
import os
def upload_to_aws(local_file, bucket, s3_file):
client = boto3.client('s3', aws_access_key_id='###',aws_secret_access_key='###')
transfer = S3Transfer(client)
transfer.upload_file(local_file, bucket, local_file)
fi... | 458 | 168 |
import numpy as np
from deepnet.nnet import RNN
from deepnet.solver import sgd_rnn
def text_to_inputs(path):
"""
Converts the given text into X and y vectors
X : contains the index of all the characters in the text vocab
y : y[i] contains the index of next character for X[i] in the text vocab
"""
... | 996 | 399 |
from __future__ import print_function
from __future__ import division
from . import _C
import torch
from fuzzytorch.utils import TDictHolder, tensor_to_numpy, minibatch_dict_collate
import numpy as np
from fuzzytools.progress_bars import ProgressBar, ProgressBarMulti
import fuzzytools.files as files
import fuzzytools.... | 5,421 | 2,498 |
# 处理嵌套的根据键取值
def getItemByKey(obj, key, result=None):
if isinstance(obj, dict):
for k in obj:
if key == k:
if isinstance(result, list):
if isinstance(obj[k], list):
result.extend(obj[k])
else:
... | 1,473 | 467 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tacit import tac_slices
for chunk in tac_slices('data/ordered.list', 2):
print repr(chunk)
| 148 | 61 |
import numpy as np
import pandas as pd
import json
from datetime import datetime
import psycopg2
import functools
import requests
##############################################################
## https://www.exrx.net/Calculators/WalkRunMETs
## https://www.cdc.gov/growthcharts/clinical_charts.htm
## https://help.fitbit... | 7,166 | 2,836 |
from django.conf import settings
CONTENT_AREAS = getattr(settings, 'PAGELET_CONTENT_AREAS', (
('main', 'Main'),
))
CONTENT_AREA_DEFAULT = getattr(settings, 'PAGELET_CONTENT_AREA_DEFAULT', 'main')
CONTENT_TYPES = getattr(settings, 'PAGELET_CONTENT_TYPES', (
('html', 'HTML',
(),
{},),
('markdown'... | 1,651 | 655 |
import logging
import numpy as np
from scipy import stats
from collections import OrderedDict
from alphad3m.metalearning.resource_builder import load_metalearningdb
from alphad3m.metalearning.dataset_similarity import get_similar_datasets
from alphad3m.primitive_loader import load_primitives_by_name, load_primitives_by... | 14,744 | 4,219 |
from deap import base, creator, tools
import random
"""
每个individual是一个list,包含10个元素,需要演化到元素和最小
"""
# ****************************Types********************************
# def create(name, base, **kargs):
# Creates a new class named *name* inheriting from *base*
# A negative weight element corresponds to the minimization... | 4,512 | 1,593 |
from collections import deque
import random
import numpy as np
class ReplayBuffer:
'''
construct a buffer object that stores the past
moves and samples a set of subsamples
'''
def __init__(self, buffer_size):
self.buffer_size = buffer_size
self.count = 0
self.buffer = deque... | 1,674 | 518 |
# Standard library imports
from pprint import pprint
import unittest
# Local application imports
from context import entities
from entities import creatures
from entities import items
from entities import currency
from entities import slots
class TestCreature(unittest.TestCase):
def setUp(self):
self.d... | 9,126 | 2,811 |
import collections
import re
from typing import Iterator, TextIO
from .constants import TILE_END, TILE_START, TILE_WARNING
def from_file(file: TextIO) -> Iterator[str]:
with file as f:
yield from f
def to_file(file: TextIO, lines: Iterator[str]):
with file as f:
f.write("\n".join(lines))
... | 729 | 282 |
import binascii
from pwn import *
def send(r,num):
r.sendline(str(num))
port = 1234
server = '127.0.0.1'
sleep(1)
for i in range(10000):
r = remote(server, port)
send(r,i)
r.close()
| 199 | 95 |
from djoser.serializers import UserCreateSerializer
from .models import CustomUser
class CustomUserRegistrationSerializer(UserCreateSerializer):
class Meta(UserCreateSerializer.Meta):
model = CustomUser
fields = ('first_name', 'email', 'password')
| 271 | 67 |
name = "flask_slack_template"
| 30 | 13 |
from typing import Dict
from time import time_ns
from bus import Bus
from instructions.generic_instructions import Instruction
from rom import ROM
from status import Status
import instructions.instructions as i_file
import instructions.jump_instructions as j_file
import instructions.load_instructions as l_file
import ... | 6,704 | 2,110 |
class Solution():
def __init__(self):
self.pureNE = []
self.mixedNE = []
def appendPureNE(self, tup):
self.pureNE.append(tup)
def appendMixedNE(self, tup):
self.mixedNE.append(tup) | 227 | 85 |
#!/usr/bin/env python
import datetime
import os
import subprocess
import re
import urllib2
import math
####################################################################
## TODO: Replace this function by another one, which simply reads all lines from a file
#########################################################... | 2,622 | 855 |
import os
import sys
import hash_utils
def StartIndexPhp(outfile):
outfile.write( '<?php $rootdirectory = \'../../\' ?>\n\n' )
outfile.write( '<html>\n' )
outfile.write( '<head>\n' )
outfile.write( '\t<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n' )
outfile.write( '... | 1,786 | 702 |
#!/usr/bin/env python
# Programmer(s): Sopan Patil.
""" MAIN PROGRAM FILE
Run this file to optimise the model parameters of the spatially distributed
version of EXP-HYDRO model using Particle Swarm Optimisation (PSO) algorithm.
Type 1 Model:
- This type of distributed model is pixel based (i.e., all sub-components
h... | 2,857 | 887 |
import os
from multi_input_multi_output.models import MultiNet
from shared_weights.helpers import config, utils
from shared_weights.helpers.siamese_network import create_encoder
from data.data_tf import fat_dataset
import tensorflow as tf
from tensorflow import keras
# ----------------------
def flatten_model(mode... | 11,104 | 3,536 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import logging
from lookyloo.lookyloo import Indexing, Lookyloo
logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s:%(message)s',
level=logging.INFO)
def main():
parser = argparse.ArgumentParser(description='Rebuild t... | 856 | 299 |
import tensorflow as tf
sess=tf.Session()
#First let's load meta graph and restore weights
saver = tf.train.import_meta_graph('/Users/lipingzhang/Downloads/model/my_tf_model-1000.meta')
saver.restore(sess,tf.train.latest_checkpoint('/Users/lipingzhang/Downloads/model/'))
# Now, let's access and create placeholders v... | 740 | 294 |
from random import randrange
def main():
MIN = 1
MAX = 100
NUMBER = randrange(MIN, MAX + 1)
guesses = 9
print(f"Guess a number from {MIN} to {MAX}.\nYou have {guesses} chances. Start now!\n")
while guesses > 0:
guess = input(f"Guess ({guesses}): ")
guesses -= 1
try:
guess = int(guess)
if guess == ... | 633 | 274 |
# ARRAYS-DS HACKERANK SOLUTION:
# creating a function to reverse the array.
def reverseArray(arr):
# reversing the array.
reversed = arr[::-1]
# returning the reversed array.
return reversed
# receiving input.
arr_count = int(input().strip())
arr = list(map(int, input().rstrip().spl... | 378 | 130 |
from django.contrib import admin
from django.contrib.admin import SimpleListFilter
from django.db.models import TextChoices
from django.utils.html import format_html
from . import models
class CustomQuerysetsFilter(SimpleListFilter):
title = "custom"
parameter_name = "custom"
class CustomQuerysetChoices... | 1,456 | 466 |
/home/runner/.cache/pip/pool/34/e0/75/b2dceb8ef40c652edb20f4e059370015eddc8cdbde039f92ced519a83d | 96 | 70 |
#https://qiita.com/stkdev/items/a44976fb81ae90a66381
#import imaplib, re, email, six, dateutil.parser
import imaplib, re, email
email_default_encoding = 'iso-2022-jp'
def main():
gmail = imaplib.IMAP4_SSL("imap.gmail.com")
username = 'user'
password = 'pass'
gmail.login(username, password)#imaplib.erro... | 552 | 233 |
import binascii
import datetime
import hashlib
import mimetypes
import os
import re
import struct
import subprocess
import sys
import time
import urllib
import csv
from Queue import Queue
# 8 byte unique ID generator give a path.
# - first five bytes are first five from sha1 of path name
# - last 3 are the first t... | 5,468 | 1,770 |
import csv_loader
import moves_names
def getSingle(name, data, file, value):
return data.get_info(name,value, expected_file=file, use_names_map=True)[file][0]
def getExpYield(name, data):
return int(getSingle(name, data,"pokemon" ,"base_experience"))
def getHeight(name, data):
return int(getSingle(name, d... | 10,136 | 3,032 |
import datetime
import decimal
from unittest.mock import patch
import pytest
from click.testing import CliRunner
from psycopg2 import sql
from manage import SUMMARIES, cli, construct_where_fragment
from tests import assert_bad_argument, assert_log_records, assert_log_running, fixture, noop
command = 'add'
TABLES = ... | 25,539 | 7,545 |
import os
from docx import Document
from docx.shared import Inches
from docx import section
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.shared import Pt
from docx.shared import Cm
from docx.shared import RGBColor
import docx
class Print_document():
def start_doc(self):
self.docume... | 3,520 | 1,235 |
# Copying files
# Ask user for a list of 3 friends.
# for each friend, we'll tell user whether they're nearby.
# for each nearby friend, we'll save their name to `nearby_friends.txt`.
friends = input('Enter three friends name(separated by commas): ').split(',')
people = open('people.txt', 'r')
people_nearby = [line.s... | 764 | 269 |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n, m, x = map(int, input().split())
ca = [0] * n
ca_sum = [0] * (m+1)
for i in range(n):
ca[i] = list(map(int, input().split()))
for j in range(m+1):
ca_sum[j] += ca[i][j]
ans = 10 ** 10
for i in range(2 ** n):
tmp = 0
tmp_ca... | 722 | 307 |
from django import forms
from .models import Passwords
class PasswordsForm(forms.ModelForm):
username = forms.CharField(widget=forms.TextInput(
attrs={'class': 'uk-form-width-large uk-input uk-width-expand'}), required=False)
email = forms.EmailField(widget=forms.TextInput(
attrs={'class': 'uk... | 923 | 282 |
NAME = "Azure BLOB storage"
TYPE = "remote"
FILE = "AzureBlob.yaml"
VARS = [
"AZURE_BLOB_STORAGE_ACCOUNT",
"AZURE_BLOB_STORAGE_ACCOUNT_KEY",
"AZURE_BLOB_CONTAINER_NAME",
]
| 184 | 86 |
import unittest
from application import app
from application.helpers import(
requires_authentication,
requires_feature,
signed_in,
group_by_group,
signed_in_no_access,
no_access,
has_user_with_token,
view_helpers,
user_has_feature,
)
from hamcrest import assert_that, equal_to, is_
fr... | 8,965 | 2,782 |
from random import *
#STRATEGY SUMMARY: DON'T DUCK IF THE OPPONENT HAS NO SNOWBALLS. OTHERWISE, PICK RANDOMLY.
def getMove( myScore, mySnowballs, myDucksUsed, myMovesSoFar,
oppScore, oppSnowballs, oppDucksUsed, oppMovesSoFar ):
if mySnowballs == 10: #I have 10 snowballs, so I must throw
re... | 1,210 | 422 |
from rest_framework import viewsets
from customers.models import Customer
from customers.serializers.customers import CustomerSerializer
# Create your views here.
class CustomerList(viewsets.ReadOnlyModelViewSet):
queryset = Customer.objects.all()
serializer_class = CustomerSerializer
| 298 | 73 |
"""
Expect action directives
"""
from __future__ import (
absolute_import,
unicode_literals,
)
from pyparsing import (
CaselessLiteral,
LineEnd,
Literal,
Optional,
Suppress,
)
from pysoa.test.plan.grammar.assertions import (
assert_not_expected,
assert_not_present,
assert_subse... | 5,370 | 1,575 |
'''
Script to add uuid to existing records
Also shifts who_code values to original_who_code
'''
import uuid
import pandas as pd
manually_cleaned = pd.read_csv('data/cleansed/mistress_latest_old.csv', low_memory=False)
manually_cleaned['uuid'] = [str(uuid.uuid4()) for x in manually_cleaned.iloc[:, 1]]
manually_cle... | 454 | 164 |
"""Tests for `prettyqt` package."""
import pathlib
import pytest
from prettyqt import core, qml
from prettyqt.utils import InvalidParamError
# def test_jsvalue():
# val = qml.JSValue(2)
# val["test"] = 1
# assert val["test"].toInt() == 1
# assert "test" in val
# assert val.get_value() == 2
de... | 1,821 | 651 |
# Simple test for NeoPixels on Raspberry Pi
import time
import board
import neopixel
# Choose an open pin connected to the Data In of the NeoPixel strip, i.e. board.D18
# NeoPixels must be connected to D10, D12, D18 or D21 to work.
pixel_pin = board.D18
# The number of NeoPixels
num_pixels = 30
# The order of the p... | 2,550 | 969 |
from transitions.extensions import GraphMachine
class TocMachine(GraphMachine):
def __init__(self, **machine_configs):
self.machine = GraphMachine(
model = self,
**machine_configs
)
def is_going_to_state1(self, update):
text = update.message.text
return... | 1,774 | 582 |
# Copyright (c) 2018 Workonline Communications (Pty) Ltd. All rights reserved.
#
# The contents of this file are licensed under the Apache License version 2.0
# (the "License"); you may not use this file except in compliance with the
# License.
#
# Unless required by applicable law or agreed to in writing, software
# d... | 1,861 | 540 |
#!/usr/bin/env python
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2015-11-14 12:21:54 +0000 (Sat, 14 Nov 2015)
#
# https://github.com/HariSekhon/pylib
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn
# and optionally sen... | 1,697 | 604 |