text string | size int64 | token_count int64 |
|---|---|---|
"""
Problem Statement
Numeros, The Artist, had two lists A and B, such that, B was a permutation of A. Numeros was very proud of these lists.
Unfortunately, while transporting them from one exhibition to another, some numbers from List A got left out. Can you
find out the numbers missing from A?
"""
__author__ = 'Dany... | 1,245 | 421 |
from jmap.account.imap.imap_utf7 import imap_utf7_decode, imap_utf7_encode
KNOWN_SPECIALS = set('\\HasChildren \\HasNoChildren \\NoSelect \\NoInferiors \\UnMarked \\Subscribed'.lower().split())
# special use or name magic
ROLE_MAP = {
'inbox': 'inbox',
'drafts': 'drafts',
'draft': 'drafts',
'draft messages':... | 3,187 | 1,087 |
from pyieee1905.ieee1905_tlv import IEEE1905_TLV
from scapy.packet import Packet, bind_layers
from scapy.fields import BitField, XByteField, XShortField, XShortEnumField
from scapy.layers.l2 import Ether
IEEE1905_MCAST = "01:80:c2:00:00:13"
ieee1905_msg_type = {
0x0000:"TOPOLOGY_DISCOVERY_MESSAGE",
0x0001:... | 2,987 | 1,555 |
# coding:utf8
'''
Created on 2016��8��30��
@author: zhangq
'''
from serial import Serial
import re
from threading import Thread
import time
import datetime
import pygal
import os
class FilterMem(object):
def __init__(self, port, baudrate):
self.serial_obj = Serial()
self.serial_obj.port = port-1
... | 2,719 | 897 |
"""
MIT License
Copyright (c) 2020 André Lousa Marques <andre.lousa.marques at gmail.com>
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 the rig... | 4,582 | 1,498 |
#files
import schedule
import test
import ATS
import editGameList
import getGames
import getData
#libs
import pathlib
import time
if __name__ == '__main__':
path = pathlib.Path(__file__).parent.absolute()
getData.getData()
print('1/6')
time.sleep(2)
getGames.start(path)
print('2/6')
time.sl... | 561 | 205 |
from __future__ import unicode_literals
import six
from django.core.management import call_command, CommandError
from django.contrib.auth.models import Group, User
from waffle import get_waffle_flag_model
from waffle.models import Sample, Switch
from waffle.tests.base import TestCase
class WaffleFlagManagementComma... | 12,689 | 3,779 |
"""
Implement of Circular Differential Microphone Arrays (CDMA)
Reference:
[1] Benesty, Jacob, Jingdong Chen, and Israel Cohen. Design of circular differential microphone arrays. Vol. 12. Berlin, Germany:: Springer, 2015.
"""
import numpy as np
c = 340
class circular_microphone_arrays():
def __init__(self,
... | 8,733 | 3,195 |
"""
Command line management utilities for ITEEBot. This module's command line
interface will act as the bot's entry point when installed.
"""
import click
from . import configurator as conf
from . import database as db
from .bot import ITEEBot
@click.group()
def cli():
pass
@click.command("init-config")
@click.a... | 2,083 | 656 |
import random
from django.core.exceptions import ValidationError
from django.db import models
from django.conf import settings
class AuthToggle(models.Model):
enable_protection = models.BooleanField(default=False)
def __str__(self):
return "Options"
class PassPhrase(models.Model):
passphrase = mod... | 439 | 126 |
import copy
import datetime
import tempfile
from collections import OrderedDict
from django.utils.functional import cached_property
from django.utils.translation import ugettext as _
import polib
from memoized import memoized
from corehq.apps.app_manager.dbaccessors import get_app
from corehq.apps.translations.integ... | 7,685 | 2,211 |
# Databricks notebook source
# MAGIC
# MAGIC %md
# MAGIC # Integration Tests
# MAGIC The purpose of this notebook is to faciliate testing of our systems.
# COMMAND ----------
import os
spark.conf.set("com.databricks.training.module-name", "common-notebooks")
currentVersion = os.environ["DATABRICKS_RUNTIME_VERSION"... | 515 | 185 |
"""Test runner runs a TfJob test."""
import argparse
import logging
import os
import time
import uuid
import jinja2
from kubernetes import client as k8s_client
from py import test_util
from py import util
from py import tf_job_client
from google.cloud import storage # pylint: disable=no-name-in-module
import yaml
... | 3,865 | 1,287 |
# 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 appli... | 2,848 | 869 |
#import subprocess
#
#subprocess.Popen(f'C:\Windows\system32\calc.exe')
#
#
#
#
#
#
#
#\ is a escape character. You have three options.
#
#1) use /. This, as a bonus works for linux as well:
# 'D:/xxx/xxxx/asd/asd.exe'
#
#2) escape the backslash
# 'D:\\xxx\\xxxx\\asd\\asd.exe'
#
#3) use raw strings:
#r'D:\xxx\xxxx\as... | 553 | 245 |
__all__ = ['data', 'noam_opt', 'protein_features', 'self_attention', 'struct2seq', 'seq_model']
| 96 | 37 |
# -*- coding: utf-8 -*-
import os
import sys
import re
from collections import namedtuple
import subprocess
from typing import NewType
class p1parser:
def __init__(self):
self.rule = namedtuple("Rule" , ["Text" , "SubExp"])
self.directive = namedtuple("Dire... | 20,258 | 6,625 |
import asyncio
import logging
import time
from functools import partial
from signal import SIGINT, SIGTERM
from panic import \
datatypes as panic_datatypes
logger = logging.getLogger(__name__)
current_time = None
def update_current_time(loop):
"""
Caches the current time, since it is needed
at the e... | 2,010 | 651 |
# this file contains _base.py and _gaussian_mixture.py
# @title sklearn/mixture/_base.py
"""Base class for mixture models."""
# sklearn/mixture/_base.py
# Author: Wei Xue <xuewei4d@gmail.com>
# Modified by Thierry Guillemot <thierry.guillemot.work@gmail.com>
# License: BSD 3 clause
import warnings
from abc import ... | 47,593 | 14,268 |
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.widget import Widget
from kivy.uix.button import Button, Label
from kivy.properties import ListProperty, ObjectProperty
from game import Game
from player import Player
from helpers import new_targe... | 4,548 | 1,451 |
# 16. Evalúe la siguiente función matemática: f(a,b,c,d,e) = ((a! + b! + c!) / d!) + e^c / e!
# Ejemplo: Si a = 5, b = 1, c= 4 , d = 3, e = 2 → despliega: 32,17
def factorial(numero):
fact = 1
for i in range (1, numero+1):
fact *= i
return (fact)
def formula(a, b, c, d, e):
termino1 ... | 609 | 296 |
from setuptools import setup, find_packages
setup(
name='brfinance',
version='0.1',
packages=find_packages(exclude=['tests*']),
license='MIT',
description='A Python package for webscraping financial data brazilian sources such as CVM, Banco Central, B3, ANBIMA, etc.',
long_description=open('REA... | 799 | 267 |
import jittor as jt
from jittor import nn
from jittor import Module
from jittor import init
from jittor.contrib import concat
from model.backbone import resnet50, resnet101
from model.backbone import res2net101
Backbone_List = ['resnet50', 'resnet101', 'res2net101']
class DeepLab(Module):
def __init__(self, outp... | 5,938 | 2,194 |
# Generated by Django 2.2 on 2020-03-30 15:03
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SeoUrl',
fields=[
('head_title', models.CharF... | 788 | 238 |
from __future__ import absolute_import
from appswag.primitives import MimeCodec
import unittest
class CodecTestCase(unittest.TestCase):
def test_register_unregister(self):
mime_codec = MimeCodec()
mime = 'test'
dummy_codec = {}
self.assertEqual(None, mime_codec.codec(mime... | 1,090 | 405 |
import os
from shutil import rmtree
from ..settings import DATA_PATH
class Thumbnail(object):
def __init__(self, model):
self.model = model
self.module = model.module
self.filename = os.path.join('thumbnails', model.__tablename__, self.module.id, model.id)
self.full_filename = os.... | 2,211 | 690 |
from hashlib import md5
from urllib.parse import urlencode
from .exceptions import AlipayExcepton,ParameterValueErrorException,MissingParameterException,TokenAuthorizationErrorException
class Alipay(object):
GATEWAY_URL = 'https://mapi.alipay.com/gateway.do'
NOTIFY_GATEWAY_URL = 'https://mapi.alipay.com/gatew... | 2,823 | 922 |
from ..discovery.top_service_resolver import TopServiceResolver
from ...core.playbooks.base_trigger import TriggerEvent
from ...integrations.kubernetes.autogenerated.triggers import EventAllChangesTrigger, EventChangeEvent
from ...integrations.kubernetes.base_triggers import K8sTriggerEvent
from ...utils.rate_limiter i... | 1,998 | 544 |
import logging
import exifread # type: ignore
from datetime import datetime
import pathlib
import os
import shutil
import filecmp
import subprocess
from typing import Tuple, List
exifread.logger.disabled = True
date_str_default = "1970:01:01 00:00:00"
class FileIsADuplicate(Exception):
pass
class FFMpegNotFou... | 6,483 | 2,164 |
'''
Converts ASKotec training module meta-data
(from module.yaml) into an RDF/Turtle.
'''
import glob
import os
from rdflib.namespace import DC, DCTERMS, DOAP, FOAF, SKOS, OWL, RDF, RDFS, VOID, XMLNS, XSD
import wget
from yaml2rdf_shared import *
from yaml2rdf import convert
KEY_RESOURCE_URL_YAML = 'yaml-url'
KEY_RES... | 3,536 | 1,380 |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 15 11:43:21 2021
@author: Sander
"""
import random
# TODO: '/poll vote 88' has no output
# : invalid poll id gives no output
# Poll datastructure
#
# {
# "number or name of person":
# {
# "__id" : unique id for every poll
# "__name... | 8,346 | 2,713 |
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %% [markdown]
# # Laboratorio #3 - Predicción de textos
#
# * Oscar Juárez - 17315
# * José Pablo Cifuentes - 17509
# * Paul Belches - 17088
# %%
from keras.layers import Embedding
from keras.layers import LSTM
from keras.layers im... | 7,689 | 2,599 |
import re
s = 'aaa-AAA-123'
print(re.search('aaa', s))
# <re.Match object; span=(0, 3), match='aaa'>
print(re.search('xxx', s))
# None
print(re.search('^aaa', s))
# <re.Match object; span=(0, 3), match='aaa'>
print(re.search('^123', s))
# None
print(re.search('aaa$', s))
# None
print(re.search('123$', s))
# <re.... | 976 | 523 |
# pylint: skip-file
__version__ = '2018.12.21'
| 47 | 27 |
store.set_global_value('hotkey', '<meta>+r')
if re.match('.*(Hyper)', window.get_active_class()):
logging.debug('terminal refresh buffer')
engine.set_return_value('<ctrl>+<shift>+r')
else:
logging.debug('normal')
engine.set_return_value('<ctrl>+r')
engine.run_script('combo') | 291 | 107 |
from mednickdb_pyapi.mednickdb_pyapi import MednickAPI
import pytest
import time
user = 'bdyetton@hotmail.com'
password = 'Pass1234'
server_address = 'http://saclab.ss.uci.edu:8000'
def test_login():
"""Test login, this will always pass until we deal with login"""
med_api = MednickAPI(server_address, user ,... | 13,722 | 4,481 |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# 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 applic... | 1,286 | 404 |
import hashlib
import json
import math
import os
import dill
import base64
from sys import exit
import requests
from bson import ObjectId
from Crypto.Cipher import PKCS1_OAEP
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
#from cryptography.hazmat.primitives.asymmetric import padding
#from cryptography... | 13,154 | 4,344 |
import math
print(int(math.ceil(math.sqrt(input()))))
| 54 | 20 |
# Generated by Django 2.0.7 on 2018-07-10 09:37
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('prod... | 1,326 | 428 |
from discord.ext import commands
import tasks
from datetime import datetime
import os
import traceback
bot = commands.Bot(command_prefix='/')
token = os.environ['DISCORD_BOT_TOKEN']
# 接続に必要なオブジェクトを生成
client = discord.Client()
#投稿する日時
dateTimeList = [
'2019/11/19 18:09',
'2019/11/19 18:15',
'2019/11/19 18:20',
]
#... | 935 | 478 |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import unittest
import numpy as np
from extensions.ops.sparse_reshape import SparseReshape
from mo.front.common.partial_infer.utils import int64_array
from mo.graph.graph import Node
from unit_tests.utils.graph import build_graph
node... | 2,431 | 817 |
# Copyright (c) Istituto Nazionale di Fisica Nucleare (INFN). 2020-2021
#
# 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 ... | 2,425 | 721 |
""" Code to implement ScaleFactor:: decorator supported
in gtlike.
The gtlike feature is documented here:
https://confluence.slac.stanford.edu/display/ST/Science+Tools+Development+Notes?focusedCommentId=103582318#comment-103582318
Author: Joshua Lande
"""
import operator
from copy import deep... | 6,955 | 2,229 |
from django.contrib.auth.models import User
from django import forms
import neighbour
from .models import Business, Profile , Neighbourhood , Posts
class ProfileForm(forms.ModelForm):
class Meta:
model = Profile
exclude = ['user']
class NeighbourhoodForm(forms.ModelForm):
class Meta:
model = Neighbou... | 581 | 169 |
"""
This module provides functionality for filtering out paths with nearly identical geometries.
"""
from typing import List, Tuple, Union
from gp_server.app.path import Path
from gp_server.app.logger import Logger
def __get_path_overlay_candidates_by_len(
param_path: Path,
all_paths: List[Path],
len_dif... | 3,956 | 1,239 |
# Defining the left function
def left(i):
return 2*i+1
# Defining the right function
def right(i):
return 2*i+2
# Defining the parent node function
def parent(i):
return (i-1)//2
# Max_Heapify
def max_heapify(arr,n,i):
l=left(i)
r=right(i)
largest=i
if n>l and arr[largest]<arr[l] :
... | 1,676 | 622 |
# -*- coding: utf-8 -*-
#
# Authors: Toni Ruottu, Finland 2014
# Tomi Jylhä-Ollila, Finland 2016-2019
#
# This file is part of Kunquat.
#
# CC0 1.0 Universal, http://creativecommons.org/publicdomain/zero/1.0/
#
# To the extent possible under law, Kunquat Affirmers have waived all
# copyright and related or ne... | 6,625 | 2,580 |
#!/usr/bin/env python3
import numpy as np
def make_instance():
# set the number of random numbers
num_rands = 2000
# set K
K = 5
# set random numbers
rands = np.random.rand(num_rands)
# optimal solution
rands_sort = sorted(rands)
optimal_obj = sum(rands_sort[0:5])
print('*****... | 453 | 171 |
from styx_msgs.msg import TrafficLight
import rospy
import tensorflow as tf
import numpy as np
import cv2
from PIL import Image
# for visualization
#import matplotlib.pyplot as plt
from PIL import ImageDraw
from PIL import ImageColor
import os
class TLClassifier(object):
def __init__(self):
#TODO load clas... | 7,175 | 2,275 |
#
# The Template-Python distribution is Copyright (C) Sean McAfee 2007-2008,
# derived from the Perl Template Toolkit Copyright (C) 1996-2007 Andy
# Wardley. All Rights Reserved.
#
# The file "LICENSE" at the top level of this source distribution describes
# the terms under which this file may be distributed.
#
... | 3,279 | 1,037 |
import RPi.GPIO as GPIO
import time
s2 = 26
s3 = 27
signal = 17
NUM_CYCLES = 10
def setup():
GPIO.setmode(GPIO.BCM)
GPIO.setup(signal,GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(s2,GPIO.OUT)
GPIO.setup(s3,GPIO.OUT)
print("\n")
def loop():
temp = 1
while(1):
GPIO.output(s2,GPIO.LOW)
... | 1,544 | 680 |
import datetime
import peewee as p
from breeze import App, Resource, Serializable
db = p.SqliteDatabase('users.db')
class UserModel(p.Model):
username = p.CharField(unique=True)
password = p.CharField()
email = p.CharField()
join_date = p.DateTimeField(default=datetime.datetime.now)
class Met... | 1,045 | 318 |
"""
SQLAlchemy-JSONAPI
Constants
Colton J. Provias
MIT License
"""
try:
from enum import Enum
except ImportError:
from enum34 import Enum
class Method(Enum):
""" HTTP Methods used by JSON API """
GET = 'GET'
POST = 'POST'
PATCH = 'PATCH'
DELETE = 'DELETE'
class Endpoint(Enum):
"""... | 551 | 206 |
# coding=utf-8
# Este fichero generado para la asignatura SGDI
# Practica 1 MapReduce Y Spark, Ejercicio B.3
# Autores: Antonio Calvo Morata y Carlos Congosto Sandoval
# Antonio Calvo Morata y Carlos Congosto Sandoval declaramos que esta solución es fruto exclusivamente de nuestro
# trabajo personal. No hemos sido ay... | 2,617 | 841 |
from django.contrib import admin
from .models import DeploymentDefinition, DeploymentInstance, HelmResource
admin.site.register(HelmResource)
admin.site.register(DeploymentDefinition)
admin.site.register(DeploymentInstance)
| 226 | 59 |
#This is a class because it stores its model parameters and has a 'prediction' function which returns predictions for input data
import numpy as np
from baseModel import baseModel, ModellingError as me
from datetime import datetime
import pandas as pd
class ModellingError(me): pass
class ConstantMonthlyModel(baseMode... | 1,576 | 498 |
import argparse
import copy
import json
import logging
import math
import sys
RADIUS = 6378137
def rewind(geojson, rfc7946=True):
gj = copy.deepcopy(geojson)
_check_crs(geojson)
if isinstance(gj, str):
return json.dumps(_rewind(json.loads(gj), rfc7946))
else:
return _rewind(gj, rfc794... | 3,746 | 1,289 |
from __future__ import absolute_import
from __future__ import unicode_literals
from datetime import datetime, timedelta
from django.utils.deprecation import MiddlewareMixin
from corehq.apps.domain.project_access.models import SuperuserProjectEntryRecord, ENTRY_RECORD_FREQUENCY
from corehq.util.quickcache import quickc... | 1,591 | 469 |
# DEPRECATED - THERE IS A PARSER FOR THE CLASS LANGUAGE IN JAVA NOW
# TODO -delete
# processing Class tag - class propagation language
import processTags
import sys
# definition of the class propagation language - in a dictionary
# helper method - converts numbers to a MatlabClassVar
def convertNum(a): retu... | 9,288 | 3,016 |
import numpy as np
import pinocchio
class PinocchioUtils:
"""
Consists of kinematic methods for the finger platform.
"""
def __init__(self, finger_urdf_path, tip_link_names):
"""
Initializes the finger model on which control's to be performed.
Args:
finger (SimFi... | 2,392 | 741 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import Category, Expense
# Register your models here.
admin.site.register(Category)
admin.site.register(Expense)
| 226 | 70 |
import setuptools
import re
requirements = []
with open('requirements.txt') as f:
requirements = f.read().splitlines()
version = ''
with open('dbots/__init__.py') as f:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)
if not version:
raise RuntimeError('vers... | 1,383 | 438 |
# linear regression feature importance
from sklearn.datasets import make_regression
from sklearn.linear_model import LinearRegression
from matplotlib import pyplot
# define dataset
X, y = make_regression(n_samples=1000, n_features=10, n_informative=5, random_state=1)
# define the model
model = LinearRegression()
# fit ... | 597 | 191 |
# Copyright (c) 2018 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... | 4,483 | 1,481 |
from django.conf import settings
NANO_BLOG_TAGS = None
# Optional support for django-taggit
try:
if ('taggit' in settings.INSTALLED_APPS
and getattr(settings, 'NANO_BLOG_USE_TAGS', False)):
import taggit as NANO_BLOG_TAGS
except ImportError:
pass
NANO_BLOG_SPECIAL_TAGS = getattr(settings, 'N... | 357 | 140 |
import os
from newspaper import Article
url = 'http://fox13now.com/2013/12/30/new-year-new-laws-obamacare-pot-guns-and-drones/'
article = Article(url)
article.download()
article.parse()
with open(os.path.join('testdata', 'article.txt'), 'w') as f:
f.write(article.text)
| 278 | 113 |
#!/usr/bin/env python
"""
juc2/examples/example_02.py
Move a rectangle across the terminal. <3
"""
from juc2 import art, Stage
stage = Stage(height=40, width=80, frame=True)
rectangle = art.Shapes.Rectangle(width=10, height=5, x=5, y=5)
while True:
stage.draw(rectangle, FPS=4)
if rectangle.x < 60:
... | 337 | 137 |
import theano
import theano.tensor as tensor
import numpy
from att_reader.utils import prfx, norm_weight, ortho_weight
from core.utils import dot, sharedX
from core.commons import Sigmoid, Tanh, Rect, global_trng, Linear, ELU
"""
We have functions to create the layers and initialize them.
"""
profile = False
la... | 18,784 | 6,095 |
r"""
This module is a ITK Web server application.
The following command line illustrates how to use it::
$ python .../server/itk-tube.py --data /.../path-to-your-data-file
--data
Path to file to load.
Any WSLink executable script comes with a set of standard arguments that ca... | 10,687 | 3,374 |
import torch
from tqdm import tqdm
from dataset import Dataset
import numpy as np
from measure import Measure
from os import listdir
from os.path import isfile, join
class Tester:
def __init__(self, dataset, model_path, valid_or_test):
self.device = torch.device("cuda:0" if torch.cuda.is_available() else... | 3,388 | 1,151 |
# file eulxml/xmlmap/cerp.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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
#
... | 14,319 | 4,537 |
#!/usr/bin/env python3
import warnings
from pathlib import Path
from spectral_cube import SpectralCube
from astropy.wcs import FITSFixedWarning
DATA_PATH = Path(__file__).parent / "data"
NH3_RMS_K = 0.35
def get_ammonia_cube(trans_id=1):
assert trans_id in (1, 2)
transition = f"{trans_id}" * 2
fpath ... | 706 | 258 |
from django.core.management.base import NoArgsCommand
from ... import clustering
class Command(NoArgsCommand):
help = "Re-runs the server-side clustering"
def handle_noargs(self, **options):
clustering.run()
| 228 | 68 |
"""Parse the UJS court portal."""
from .core import UJSPortalScraper # noqa: F401
from .schema import PortalResult, PortalResults # noqa: F401
__all__ = ["UJSPortalScraper", "PortalResult", "PortalResults"]
| 211 | 77 |
import os
import sys
import argparse
################################################################################
# Print Debug
################################################################################
#def printWarning(message):
# print "Tensile::WARNING: %s" % message
# sys.stdout.flush()
def print... | 3,671 | 1,020 |
#num1=int(raw_input("Enter num #1:"))
#num2=int(raw_input("Enter num #2:"))
#total= num1 + num2
#print("The sum is: "+ str(total))
# need to be a string so computer can read it
# all strings can be integers but not all integers can be strings
# num = int(raw_input("Enter a number:"))
# if num>0:
# print("That's a p... | 1,557 | 612 |
from typing import cast, List, Optional, Tuple
import h11
import pytest
from wsproto import WSConnection
from wsproto.connection import SERVER
from wsproto.events import (
AcceptConnection,
Event,
RejectConnection,
RejectData,
Request,
)
from wsproto.extensions import Extension
from wsproto.typing... | 11,541 | 3,578 |
import pymysql
print("Connect to mysql...")
mysql_db = "report_system"
m_conn = pymysql.connect(host='192.168.20.20', port=3306, user='admin', passwd='1qaz@WSX', db=mysql_db, charset='utf8')
m_cursor = m_conn.cursor()
# sql = "select row_key,account_id,cell_no,is_id_match,product_id,response_ref_id,query_time from t... | 1,499 | 546 |
import sys, os, time, traceback
from pdfrw import PdfReader, PdfWriter, PageMerge
def processFile(file):
inpfn = file
outfn = 'out\\' + os.path.basename(inpfn)
reader = PdfReader(inpfn)
writer = PdfWriter(outfn)
pagesNum = len(reader.pages)
print(os.path.basename(inpfn) + ": page 1 -... | 993 | 357 |
import matplotlib.pyplot as plt
import librosa.display
plt.rcParams.update({'font.size': 16})
y, sr = librosa.load(librosa.util.example_audio_file())
plt.figure(figsize=(18, 7))
librosa.display.waveplot(y, sr=sr, x_axis='s')
print(sr)
plt.ylabel('Sampling Rate',fontsize=32)
plt.xlabel('Time (s)',fontsize=32)
plt.show(... | 321 | 141 |
# -*- coding: utf-8 -*-
'''
Autor: Joshua Prim, Philipp Krenitz, Bartos Mosch, Sophie Hagemann
Version: 1.3
Server fuer das hosten des FaSta-Dashboards
Copyright 2018 The Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance... | 49,928 | 14,513 |
# Trinket IO demo
# Welcome to CircuitPython 2.0.0 :)
import board
from digitalio import DigitalInOut, Direction, Pull
from analogio import AnalogOut, AnalogIn
import touchio
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
import adafruit_dotstar as dotstar
import time
import neop... | 1,753 | 653 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the storage media RAW image support helper functions."""
import unittest
from dfvfs.lib import raw
from dfvfs.lib import definitions
from dfvfs.path import fake_path_spec
from dfvfs.path import raw_path_spec
from dfvfs.resolver import context
from dfvfs.vfs impor... | 20,681 | 7,432 |
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import numpy as np
import sys
import time
def get_train_loss(line):
splitted_line = line.split(" ")
return float(splitted_line[2]), float(splitted_line[4])
def get_val_loss(line):
splitted_line = line.split(" ")
if len(spli... | 2,062 | 739 |
# Copyright 2009, Peter A. Bigot
#
# 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 ... | 50,220 | 13,321 |
#!/usr/bin/env python
#
# Code to query the VETO mask of objects/randoms
# It takes the NOISES extension as an input
# It writers a VETO extension.
# Usage, see python query_veto.py -h
#
from __future__ import print_function
__author__ = "Yu Feng and Martin White"
__version__ = "1.0"
__email__ = "yfeng1@berkeley.ed... | 2,447 | 867 |
import csv
import cv2
import numpy as np
from sklearn.utils import shuffle
class DrivingLogReader:
def __init__(self, driving_data):
self.driving_data = driving_data
self.driving_log = self.read_all(self.driving_data)
self.record_count = len(self.driving_log)
... | 5,573 | 1,808 |
from __future__ import annotations
import logging
import pathlib
from logging.handlers import TimedRotatingFileHandler
from os import getenv
from typing import Union, List, Mapping
from bundle.utils.recorder import Recorder
from bundle.utils.cache_file_helpers import CacheFolder, USER_DOCS_PATH
from bundle.seeker imp... | 3,078 | 993 |
# Copyright 2018 Dong-Hyun Lee, Kakao Brain.
# (Strongly inspired by original Google BERT code and Hugging Face's code)
""" Fine-tuning on A Classification Task with pretrained Transformer """
import itertools
import csv
import fire
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
... | 9,773 | 3,298 |
import pytest
from teos.extended_appointment import ExtendedAppointment
@pytest.fixture
def ext_appointment_data(generate_dummy_appointment):
return generate_dummy_appointment().to_dict()
# Parent methods are not tested.
def test_init_ext_appointment(ext_appointment_data):
# The appointment has no checks... | 2,069 | 673 |
# -*- encoding: utf-8 -*-
# This is a package that contains a number of modules that are used to
# test import from the source files that have different encodings.
# This file (the __init__ module of the package), is encoded in utf-8
# and contains a list of strings from various unicode planes that are
# encoded... | 1,246 | 368 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 expandtab number
"""
使用参考文件,对 csv/tsv 文件进行修补
e.g.
<reference.txt>内容如下:
jiaose 角色 juese
xxx 色情词 <DEL>
<file_to_patch>内容如下:
field1 field2 角色 jiaose field4
field1 field2 色情词 xxx field4
<result直接写到stdout>,内容如下:
field1 field2 角色 juese field4
命令行... | 2,554 | 1,051 |
#!/usr/bin/python
#
# Copyright 2014 Google Inc. 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 b... | 3,078 | 957 |
class SinavroObject: pass
def init(self, val): self.value = val
gencls = lambda n: type(f'Sinavro{n.title()}', (SinavroObject,), {'__init__': init, 'type': n})
SinavroInt = gencls('int')
SinavroFloat = gencls('float')
SinavroString = gencls('string')
SinavroBool = gencls('bool')
SinavroArray = gencls('array'... | 323 | 135 |
import tempfile
from pathlib import Path
import ipywidgets as widgets
from HUGS.Client import Process
from HUGS.Interface import Credentials
class Upload:
def __init__(self):
self._credentials = Credentials()
self._user = None
def login(self):
return self._credentials.login()
d... | 2,824 | 773 |
# Copyright 2022 The gRPC 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 applicable law or agreed to in writ... | 10,987 | 3,254 |
#!/bin/env python
# coding=UTF-8
'''
DESCRIPTION
tmpFile
A module for creating temporary files and folders.
VERSION
1.4.0
LATEST UPDATE
2019.3.4
'''
# Import Python Lib
from os import remove, mkdir
from os.path import join, exists, abspath
from uuid import uuid4
from shutil import rmtree
#####... | 2,268 | 611 |
from hw_asr.augmentations.wave_augmentations.Gain import Gain
from hw_asr.augmentations.wave_augmentations.ImpulseResponse import ImpulseResponse
from hw_asr.augmentations.wave_augmentations.Noise import GaussianNoise
from hw_asr.augmentations.wave_augmentations.TimeStretch import TimeStretch
__all__ = [
"Gain",
... | 364 | 128 |
# Copyright 2020 Datawire. 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 law or agr... | 2,408 | 759 |