text
string
size
int64
token_count
int64
import sys import subprocess from tempfile import mkdtemp, TemporaryFile from path import Path from tests import TEST_DIR args = (sys.executable, '-m', 'scrapyu.cmdline') def test_genspider_list(): new_args = args + ('genspider', '-l') res = subprocess.check_output(new_args) assert res.split() == [b'A...
1,287
467
from datetime import datetime, timedelta from django.core.files.storage import default_storage as storage import olympia.core.logger from olympia import amo from olympia.activity.models import ActivityLog from olympia.addons.models import Addon from olympia.addons.tasks import delete_addons from olympia.amo.utils imp...
3,257
1,053
from day8.day8 import fix_code, parse_code, run SAMPLE_CODE_LOOP = """nop +0 acc +1 jmp +4 acc +3 jmp -3 acc -99 acc +1 jmp -4 acc +6 """ SAMPLE_CODE_HALT = """nop +0 acc +1 jmp +4 acc +3 jmp -3 acc -99 acc +1 nop -4 acc +6 """ def test_parse(): assert parse_code("nop +0\nacc +1\nacc -6") == [("nop", 0), ("acc"...
642
308
from django.shortcuts import reverse from django.test import TestCase from rest_framework import status from rest_framework.test import APIClient from main.models import Project from main.tests import factories from main.tests.api import helpers class TestWhoAmI(helpers.BaseUserTestCase): def setUp(self): ...
6,128
1,795
import asyncio import aiopg from . import nwdb from . import core @core.handler def register(client, path, event): """ Register an event occuring at path. Created time is automatically added. Useful for generic analytics type stuff. """ with (yield from nwdb.connection()) as conn: cursor =...
531
156
# -*- coding: utf-8 -*- """ Deterimines the reflectance based on r and mua. """ import math import helpers.analyticalvalues as av def reflectance(mua, r): """ mua: the absorption coefficient used. r: the radial distance used. """ values = av.analyticalValues(r, mua) # the value of th...
635
236
from faker import Faker """ More info: https://microservices-demo.github.io/docs/user-accounts.html """ # The demo app is shipped with the following account: username = 'user' password = 'password' # Fake data that is used for new registrations: faker = Faker() autogenerated_username = faker.user_name() autogenerate...
476
161
from io import StringIO from io import BytesIO import urllib from urllib import request import utils from pdf_processing import scrape_gazette_names, get_info_outline from data_parsing import save_to_dict if __name__ == '__main__': # not saving anything locally, just the names listed on the webpage to access th...
1,115
355
#!/usr/bin/env python3 import itertools def read_input(): with open('input.txt') as f: puzzle_input = f.read().splitlines() puzzle_input = [int(num) for num in puzzle_input] return puzzle_input def part1(puzzle_input): preamble = puzzle_input[:25] remaining = puzzle_input[25:] for ...
1,246
387
from contextlib import contextmanager from functools import partial from inspect import Parameter from random import choice, randint, uniform import string from typing import Any from i2 import Sig from numbers import Number from sys import platform from selenium.common.exceptions import NoSuchElementException from sel...
4,461
1,344
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from matplotlib import rcParams from sklearn.preprocessing import MinMaxScaler import warnings import scipy.stats as st import statsmodels as sm def analyse(df_input,df_all_input): df = df_input fig, ax = plt.subplo...
16,094
6,303
import unittest def number_of_digits(s): return sum(c.isdigit() for c in s) # Parašykite funkcijai X unittest'us class Test(unittest.TestCase): def test_only_digits(self): s = "123456789" self.assertEqual(number_of_digits(s), 9) def test_only_letters(self): s = "abcdef" s...
773
319
import requests, json, bs4, urllib.parse, math from . import Course, Platform class Edx(Platform): name = 'edX' def _urls(self): res = requests.get(make_url()) count = json.loads(res.text)['objects']['count'] num_pages = math.ceil(count / 20) urls = [make_url(pag...
3,971
1,792
#!/usr/local/bin/python2.7 #FREEBSD 2 Minutes ARP Expires - /bin/echo "net.link.ether.inet.max_age 300" >> /etc/sysctl.conf #Crontab -e "* * * * * /usr/local/bin/python2.7 /root/Security.py" import subprocess import ConfigParser import string, os, sys, httplib import xml.etree.ElementTree as ET from datetime import da...
8,409
2,836
# Generated by Django 2.2.5 on 2019-09-09 21:21 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('relations', '0001_initia...
1,538
436
from typing import Type from elliptic.Kernel.Context import ContextDelegate from .Selector import SelectorImplementation from .Manager import ManagerImplementation from .Computer import ComputerImplementation class MeshQLImplementation(ComputerImplementation, ManagerImplementation, SelectorImplementation): def ...
1,106
269
# Copyright 2016-2018, Rigetti Computing # # This source code is licensed under the Apache License, Version 2.0 found in # the LICENSE.txt file in the root directory of this source tree. import pytest import quantumflow as qf QUIL_FILES = [ 'hello_world.quil', 'empty.quil', 'classical_logic.quil', ...
1,229
471
import itertools import logging from git import Repo, InvalidGitRepositoryError from .repository import Repository logger = logging.getLogger("gitool") def _list_repositories(path): subdirectories = [p for p in path.iterdir() if p.is_dir()] names = [p.name for p in subdirectories] if '.git' not in nam...
1,254
374
# -*- coding: utf-8 -*- # Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz> # Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net> # This program is free software: you can r...
3,571
1,085
# # Copyright (c) 2020 Pangeanic SL. # # This file is part of NEC TM # (see https://github.com/shasha79/nectm). # # 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 owne...
2,178
677
#!/usr/bin/env python import pytest """ Test 268. Missing Number """ @pytest.fixture(scope="session") def init_variables_268(): from src.leetcode_268_missing_number import Solution solution = Solution() def _init_variables_268(): return solution yield _init_variables_268 class TestClass...
805
311
import unittest import os import json from functions.db.connector import * from functions.db.models import * from functions.authentication import * sample_search = { "search_groups": [ { "search_terms": ["blockchain", "distributed ledger"], "match": "OR" }, { ...
5,682
1,931
# Copyright (C) 2020 GrammaTech, Inc. # # This code is licensed under the MIT license. See the LICENSE file in # the project root for license terms. # # This project is sponsored by the Office of Naval Research, One Liberty # Center, 875 N. Randolph Street, Arlington, VA 22203 under contract # # N68335-17-C-0700. The ...
1,513
628
# Copyright (c) 2021 PaddlePaddle 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 app...
2,552
932
import aspose.email as ae import datetime def run(): # The path to the File directory. dataDir = "Data/" #ExStart: SetEmailHeaders # Create an instance of MailMessage class eml = ae.MailMessage() # Specify ReplyTo, From, To field, Cc and Bcc Addresses eml.reply_to_list.Add("reply@repl...
1,031
392
# classify.py # Alternative methods to clustering import sys, os from random import shuffle import cPickle from collections import Counter sys.path.append('../pybrain/') # add the pybrain module to the path... TODO: actually install it. from plagcomps.shared.util import IntrinsicUtility from ..dbconstants import user...
7,527
2,309
""" ========================================== Blend transparency with color in 2D images ========================================== Blend transparency with color to highlight parts of data with imshow. A common use for `matplotlib.pyplot.imshow` is to plot a 2D statistical map. The function makes it easy to visualiz...
4,316
1,449
from django.test import TestCase from django.core.urlresolvers import reverse try: from django.contrib.auth import get_user_model User = get_user_model() except ImportError: from django.contrib.auth.models import User class GlobalPermissionsAdminTest(TestCase): def setUp(self): User.objects.c...
634
190
import matplotlib.pyplot as plt import itertools import numpy as np from sklearn.metrics import confusion_matrix ## be used to evaluate the model def evaluate_model(history, X_test, y_test, model): scores = model.evaluate((X_test), y_test, verbose=0) print("Accuracy: %.2f%%" % (scores[1] *100)) print(hist...
2,307
773
import math import numpy as np import pandas as pd class PenmanMonteithDaily(object): r"""The class *PenmanMonteithDaily* calculates daily potential evapotranspiration according to the Penman-Monteith method as described in `FAO 56 <http://www.fao.org/tempref/SD/Reserved/Agromet/PET/FAO_Irrigation_Drainag...
44,206
16,372
# Copyright (c) 2018, Palo Alto Networks # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS...
5,123
1,467
import sys from time import sleep from random import randint from urllib.request import urlopen from urllib.parse import urlencode if len(sys.argv) != 2: print('Por favor, usar: ' + sys.argv[0] + ' {idSensor}') print('Exemplo: ' + sys.argv[0] + ' 8') else: sensorId = sys.argv[1] URL_SERVICO = 'http://1...
1,312
539
from pathlib import Path import logging from .logger import Logger from .log_formatter import LogFormatter class FileLogger(Logger): fmt = LogFormatter(use_colour=False, output_ts=False) logger = None def __init__(self, folder, format=None): if format is None: format = ("%(asctime)s|...
1,487
429
from pygsuite import DefaultFonts, TextStyle, Color from pygsuite.docs.doc_elements.paragraph import Paragraph BRIGHT_GREEN_HEX = "#72FF33" def test_text(test_document): document = test_document docbody = document.body docbody.delete() docbody.add_text( "TEST_CUSTOM\n", style=TextStyl...
1,514
556
# coding=utf-8 # Copyright 2019 The Google Research Authors. # # 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...
71,657
28,235
from flask import request, session, url_for from requests_oauthlib import OAuth2Session class OAuth2Login(object): def __init__(self, app=None): if app: self.init_app(app) self.app = app def get_config(self, app, name, default_value=None): return app.config.get(self.config_prefix + name, def...
2,034
692
# Mostly copied and modified from torch/vision/references/segmentation to support unlabeled data # Copied functions from fmassa/vision-1 to support multi-dimensional masks loaded from numpy ndarray import numpy as np from PIL import Image import random import torch import utils.functional as F # For 2/3 dimensional t...
7,530
2,449
# coding: utf-8 import socketserver import re import socket import datetime import os import mimetypes as MT import sys # Copyright 2013 Abram Hindle, Eddie Antonio Santos # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may o...
9,036
2,777
# -*- coding: utf-8 -*- # Copyright 2015 Objectif Libre # # 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 ...
1,788
511
import os, re, errno import markdown import cgi from cuddlefish import packaging from cuddlefish.docs import apirenderer from cuddlefish._version import get_versions INDEX_PAGE = '/doc/static-files/base.html' BASE_URL_INSERTION_POINT = '<base ' VERSION_INSERTION_POINT = '<div id="version">' THIRD_PARTY_PACKAGE_SUMMAR...
8,431
2,626
from django import template register = template.Library() @register.filter def negate(value): return -value @register.filter def subtract(value, arg): return value - arg
183
54
# ------------------------------------------------------------------------------------------------ # # MIT License # # # # Copyright (c) 2...
9,827
2,858
# coding=utf-8 from OTLMOW.OEFModel.EMObject import EMObject # Generated with OEFClassCreator. To modify: extend, do not edit class Wilddet(EMObject): """Een wilddetectiesysteem zal de weggebruikers waarschuwen bij de aanwezigheid van eventueel overstekend wild""" typeURI = 'https://lgc.data.wegenenverkeer.b...
433
157
""" Workflow module tests """ import contextlib import glob import io import os import tempfile import sys import unittest import numpy as np import torch from txtai.api import API from txtai.embeddings import Documents, Embeddings from txtai.pipeline import Nop, Segmentation, Summary, Translation, Textractor from t...
16,332
4,934
from django.conf.urls import url from .views import SummaryPDFCreateView urlpatterns = [ url(r'^(?P<id>[\d]+)/$', SummaryPDFCreateView.as_view(), name='questionnaire_summary'), ]
202
70
""" @author: ludvigolsen """ from typing import Union import numpy as np import pandas as pd from utipy.utils.check_instance import check_instance from utipy.utils.convert_to_type import convert_to_type def blend(x1: Union[list, np.ndarray, pd.Series], x2: Union[list, np.ndarray, pd.Series], amount: float = 0.5) -> ...
1,418
533
from output.models.ms_data.regex.hangul_compatibility_jamo_xsd.hangul_compatibility_jamo import Doc __all__ = [ "Doc", ]
126
48
resposta = 'Ss' numeros = 0 listaTODOS = [] listaPAR = [] listaIMPAR = [] while resposta != 'N': numeros = int(input('Digite um número: ')) resposta = str(input('Deseja continuar [S/N]? ')) if numeros % 2 == 0: listaPAR.append(numeros) elif numeros % 2 == 1: listaIMPAR.append(numeros) ...
519
205
""" 面试题 29:顺时针打印矩阵 题目:输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字。 """ def make_matrix(rows: int, cols: int) -> list: res = [] k = 0 for i in range(rows): tmp = [] for j in range(cols): k += 1 tmp.append(k) res.append(tmp) return res def print_matrix_clockwisely(m...
2,218
833
"""empty message Revision ID: ee5315dcf3e1 Revises: 9f5b73af01db Create Date: 2017-05-24 10:39:46.586986 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'ee5315dcf3e1' down_revision = '9f5b73af01db' branch_labels = None depends_on = None def upgrade(): # ...
1,170
439
print("Are you trying to find new videogames to play?") print("let me help you!") print("do you like shooting games, yes or no") shooting=input() if shooting = "yes" print("do you like battle royale games?") br=input() if br="yes" print("you should try out call of duty!") else if br="no" print("...
572
181
"""Implementation of the unary-operator-replacement operator. """ import ast from .operator import Operator from ..util import build_mutations # None indicates we want to delete the operator OPERATORS = (ast.UAdd, ast.USub, ast.Invert, ast.Not, None) def _to_ops(from_op): """ The sequence of operators ...
1,382
434
from typing import List from pydantic import BaseModel from icolos.core.containers.compound import Conformer, unroll_conformers from icolos.utils.enums.step_enums import StepRMSDEnum, StepDataManipulationEnum from icolos.core.workflow_steps.step import _LE from icolos.core.workflow_steps.calculation.base import StepCa...
2,069
656
# -*- coding: utf-8 -*- # Copyright (c) 2017, Dirk Chang and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document from frappe.website.utils import delete_page_cache class IOTHomepage(Document): def validate(sel...
468
148
"""EnvSpec class.""" class EnvSpec: """EnvSpec class. Args: observation_space (akro.Space): The observation space of the env. action_space (akro.Space): The action space of the env. """ def __init__(self, observation_space, action_space): self.observation_space = observation...
368
109
t = int(input('Digite um nº: ')) for t0 in range(1, 11): print('{} X {} = {}'.format(t, t0, t * t0))
105
51
# # PySNMP MIB module CISCO-DIAMETER-BASE-PROTOCOL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DIAMETER-BASE-PROTOCOL-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:54:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pyt...
98,484
38,499
from __future__ import annotations from typing import Callable, Sequence, TYPE_CHECKING import functools if TYPE_CHECKING: from .build import BuildStepCallable def split_step_name(name: str, new = ' ', old='_'): return name.replace(old, new).capitalize() def print_step_name(formatter=split_step_name, args: Se...
1,337
395
import datetime from django.db import models from django.db.models import signals from django.contrib.contenttypes.models import ContentType from django.utils.encoding import force_unicode from tagging.fields import TagField class ItemManager(models.Manager): def __init__(self): super(ItemManager, sel...
3,713
942
""" metrics application instance ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ import os from byceps.config import ConfigurationError from byceps.metrics.application import create_app ENV_VAR_NAME_DATABASE_URI = 'DATABASE_URI' d...
578
190
from enum import Enum import pytest import gino from gino.dialects.aiomysql import AsyncEnum pytestmark = pytest.mark.asyncio db = gino.Gino() class MyEnum(Enum): ONE = "one" TWO = "two" class Blog(db.Model): __tablename__ = "s_blog" id = db.Column(db.BigInteger(), primary_key=True) title = ...
1,927
697
# problem 29 # Distinct powers """ Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5: 2**2=4, 2**3=8, 2**4=16, 2**5=32 3**2=9, 3**3=27, 3**4=81, 3**5=243 4**2=16, 4**3=64, 4**4=256, 4**5=1024 5**2=25, 5**3=125, 5**4=625, 5**5=3125 If they are then placed in numerical order, with any repeats removed,...
903
513
from __future__ import unicode_literals, division, absolute_import from builtins import * # noqa pylint: disable=unused-import, redefined-builtin from future.utils import PY3 import logging import csv from requests import RequestException from flexget import plugin from flexget.entry import Entry from flexget.event...
2,633
728
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import re from gdcmdtools.base import BASE_INFO from gdcmdtools.base import DEBUG_LEVEL from gdcmdtools.get import GDGet from gdcmdtools.get import export_format import argparse from argparse import RawTextHelpFormatter from pprint import pprint import logg...
2,043
652
# -*- coding: utf-8 -*- from Lotus.app import app from flask import render_template @app.route('/') def index(): return 'welcome' @app.errorhandler(404) def page_not_found(error): return render_template('404.html') @app.errorhandler(405) def request_method_error(error): return render_template('405.htm...
325
122
"""Git interface.""" from __future__ import annotations import contextlib import functools import operator import re import subprocess # noqa: S404 from dataclasses import dataclass from dataclasses import field from pathlib import Path from typing import Any from typing import cast from typing import Iterator from t...
8,261
2,493
from django.shortcuts import redirect from django.contrib.auth import authenticate, login, logout from celery_tasks.tasks import celery_send_mail from apps.user.models import User import re from django.shortcuts import render from django.views import View from utils.security import get_user_token, get_activation_link, ...
5,630
1,727
from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate.const import (HVAC_MODE_AUTO, PRESET_AWAY, PRESET_COMFORT, PRESET_ECO, ...
2,666
916
#!/usr/bin/python # # Copyright: Ansible Project # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = ''' --- module: proxmox_template short_description: management of OS te...
8,315
2,569
import json from html import unescape import requests from django.apps import apps from django.contrib.gis.geos import GEOSGeometry, MultiPolygon, Polygon from django.conf import settings from django.core.management.base import BaseCommand from requests.exceptions import HTTPError from retry import retry from councils...
9,024
2,582
from datetime import datetime from enum import Enum from json.encoder import ESCAPE_ASCII, ESCAPE_DCT # type: ignore from typing import List, Optional, Tuple, TypedDict class JsonTruncText: def __init__(self, text="", truncated=False, added_bytes=0): self.text = text self.truncated = truncated ...
3,693
1,163
# (c) 2013 Chander Ganesan and contributors; written to work with Django and Paste (http://pythonpaste.org) # Paste CGI "middleware" for Django by Chander Ganesan <chander@otg-nc.com> # Open Technology Group, Inc <http://www.otg-nc.com> # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.ph...
4,537
1,259
cantidad= input("Cuantas personas van a cenar?") cant = int(cantidad) print(cant) if cant > 8: print("Lo siento, tendran que esperar") else: print("La mesa esta lista")
181
73
# # This file is part of pysnmp software. # # Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com> # License: http://snmplabs.com/pysnmp/license.html # import socket import errno import sys from pysnmp.carrier.asyncore.base import AbstractSocketTransport from pysnmp.carrier import sockfix, sockmsg, error from pysn...
7,424
2,257
#!/usr/bin/env python3 # # Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the MIT license. # ## # Title : superpmi_setup.py # # Notes: # # Script to run "superpmi replay" for various collections under various COMPlus_JitStressRegs value....
5,539
1,759
def parse_cookie(query: str) -> dict: res = {} if query: data = query.split(';') for i in data: if '=' in i: res[i.split('=')[0]] = '='.join(i.split('=')[1:]) return res if __name__ == '__main__': assert parse_cookie('name=Dima;') == {'name': 'Dima'} as...
514
195
"""model_saver""" import os from . import PeriodicCallback, CallbackLoc from ..utils.logger import callback_log class ModelSaver(PeriodicCallback): """Save model to file at every pstep step_start. Args: pstep (int): Save to model every pstep. saver: Tensorflow saver. dump_prefix (str...
2,234
786
from .time_series import TimeSeries class BoatModel: def __init__(self, workout): self.workout = workout self.position = TimeSeries() self.speed = TimeSeries() def update(self): """This function gets called on every flywheel encoder tick.""" pass class RotatingWheel...
1,352
425
dbConfig = { "user": "root", "password": "123567l098", "host": "localhost", "database": "trackMe_dev" }
121
53
from django.conf.urls import url from .views import serve_all urlpatterns = ( url(r'^.*$', serve_all, name="localsrv:serve_all"), )
136
50
""" netrd ----- netrd stands for Network Reconstruction and Distances. It is a repository of different algorithms for constructing a network from time series data, as well as for comparing two networks. It is the product of the Network Science Insitute 2019 Collabathon. """ from . import distance # noqa from . impo...
409
113
from transformer import Encoder from torch import nn,optim from torch.nn.functional import cross_entropy,softmax, relu from torch.utils.data import DataLoader from torch.utils.data.dataloader import default_collate import torch import utils import os import pickle class GPT(nn.Module): def __init__(self, model_d...
5,613
2,161
import numpy as np import pandas as pd from bokeh.core.json_encoder import serialize_json from bokeh.core.properties import List, String from bokeh.document import Document from bokeh.layouts import row, column from bokeh.models import CustomJS, HoverTool, Range1d, Slider, Button from bokeh.models.widgets import Check...
22,691
8,337
# coding:utf-8 import uuid import string import hashlib import logging from lib.errors import SessionExpiredError, SessionConsumedError from datetime import datetime as dt from random import SystemRandom LOG = logging.getLogger("errbot.plugin.st2.session") def generate_password(length=8): rnd = SystemRandom() ...
4,625
1,333
# -*- coding: utf-8 -*- from .lib import * class Bill(JunoEntity): def __init__(cls, **kw): cls.__route__ = '/bill-payments' cls.__metadata__ = {} # FIELDS cls.id = String(max=80) cls.digitalAccountId = String(max=100) cls.billType = ObjList(context=cls, key='status', name='str') cls.numericalBarCode...
700
293
from django.db.models.signals import post_save from django.contrib.auth.signals import user_logged_in, user_logged_out, user_login_failed from django.contrib.auth.models import User from django.contrib.auth.models import Group from django.dispatch import receiver from .models import Usuario, LoginLog def user_profil...
881
270
import mysql.connector from mysql.connector.errors import ProgrammingError from mysql.connector import Error from DvdOperations import DvdStore database = "db4" def CreateDatabase(database): mydb = mysql.connector.connect( host="localhost", user="Vaibhav", passwd="Vaibhav@007", ) m...
2,166
708
#!/usr/bin/python # -*- coding: utf-8 -*- import os import json try: import urllib2 except: import urllib.request as urllib2 from requests import delete, get, post, put from cloudshell.rest.exceptions import ShellNotFoundException, FeatureUnavailable class PackagingRestApiClient(object): def __init__(se...
8,689
2,509
from classes import oracles_headers class TeamRow: COLUMNS = oracles_headers.oracles_columns def __init__(self, row): self.ROW = row def GetCell(self, name): return self.ROW[self.COLUMNS[name]] def GetDatabaseObject(self): game = { "gameId": self.GameId(), ...
1,848
574
def pol_V(offset=None): yield from mv(m1_simple_fbk,0) cur_mono_e = pgm.en.user_readback.value yield from mv(epu1.table,6) # 4 = 3rd harmonic; 6 = "testing V" 1st harmonic if offset is not None: yield from mv(epu1.offset,offset) yield from mv(epu1.phase,28.5) yield from mv(pgm.en,cur_mon...
7,854
3,353
from __future__ import absolute_import # flake8: noqa # import apis into api package import speechpro.cloud.speech.synthesis.rest.cloud_client.api.session_api import speechpro.cloud.speech.synthesis.rest.cloud_client.api.synthesize_api
238
79
# _*_ coding:utf-8 _*_ # author:ls # time:2020/3/19 0019 import sys from PyQt5.QtWidgets import QApplication,QAction,QMainWindow from PyQt5.QtGui import QIcon class Example(QMainWindow): def __init__(self): super().__init__() self.setui() def setui(self): self.statusbar = self.statusB...
1,039
366
#!/usr/bin/env python import pika import time import json import StringIO #from fca.concept import Concept from casa import Casa #from fca.readwrite import cxt def read_cxt_string(data): input_file = StringIO.StringIO(data) assert input_file.readline().strip() == "B",\ "File is not valid cxt" inpu...
3,451
1,069
from .selection import Selection import numpy as np class Rank(Selection): @Selection.initializer def __init__(self, size=20): pass def select(self, population, fitness): indexes = fitness.argsort() return (population[indexes])[:self.size], (fitness[indexes])[:self.size]
310
92
# coding=utf-8 # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. # # 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/lice...
15,878
4,057
# Standard library imports import logging import os # Third party imports import dash import dash_bootstrap_components as dbc from flask_caching import Cache import plotly.io as pio # Local application imports from modules.gitlab import GitLab import settings # Initialize logging mechanism logging.bas...
1,322
444
# Copyright 2018 The Forseti Security 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 ap...
5,154
1,665
import socket import requests import json import xml.etree.ElementTree as ET class Camera(object): def __init__(self): """ create camera object """ self.xml_url = self.discover() self.name, self.api_version, self.services = self.connect(self.xml_url) self.camera_end...
4,298
1,301
#!/usr/bin/env python """ This module defines functions to facilitate operations with data specific to Flu trees and alignments. """ import numpy as np from Bio import AlignIO, Phylo from Bio.Align import MultipleSeqAlignment import random import subprocess import datetime import os, copy import matplotlib.pyplot as ...
11,961
3,942
class Solution: def smallestRange(self, nums: List[List[int]]) -> List[int]:
90
29