text string | size int64 | token_count int64 |
|---|---|---|
"""
File for classes that handles the actual business logic of
the application. Here is the the place where the actual reading,
parsing and validation of the files happens.
"""
import re
import click
from .MethodInterface import MethodInterface
from ..utils import (
get_leading_whitespace,
get_indent_forward,
... | 9,184 | 2,367 |
# 2019-11-22 16:25:33(JST)
import sys
def main():
s = sys.stdin.readline().rstrip()
n = len(s)
take_times = [[None for _ in range(n)] for _ in range(n)]
for i in range(n):
for j in range(n):
if i == j:
take_times[i][j] = 0
elif s[i] == 'U':... | 746 | 294 |
from conans import ConanFile, tools, CMake
import os
class KangaruConan(ConanFile):
name = "kangaru"
description = "A dependency injection container for C++11, C++14 and later"
license = "MIT"
topics = ("conan", "gracicot", "kangaru", "DI", "IoC", "inversion of control")
homepage = "https:/... | 1,539 | 520 |
from player import Player
import copy
from random import randint
# This AI class uses MiniMax Alpha-Beta Pruning in order to find the best possible move(s) each turn.
class MiniMax(Player):
def __init__(self, pid, board, logic):
super().__init__(pid, board)
self._logic = logic
# Board ev... | 8,989 | 2,805 |
#!/usr/bin/env python
from boxes.scrapers import DATA_PATH
from pybox.task import Task
from pybox.scraper.news_reader import NewsReader
from datetime import date, timedelta, datetime
def update_reader_settings(iteration, reader_settings):
"""Auxiliar function, returns the settings passed to the reader
with u... | 2,971 | 846 |
from django.db import models
class TwitterApp(models.Model):
name = models.CharField(max_length=500)
consumer_key = models.CharField(max_length=1000)
consumer_secret = models.CharField(max_length=1000)
access_token = models.CharField(max_length=1000)
access_token_secret = models.CharField(max_leng... | 841 | 280 |
class ConstantWarmupScheduler:
def __init__(self, warmup_steps, warmup_value, ultimate_value, per_iteration):
self.warmup_steps = warmup_steps
self.warmup_value = warmup_value
self.ultimate_value = ultimate_value
self.per_iteration = per_iteration
self.position = 0
def s... | 842 | 260 |
class Thing(object):
"""A thing, does stuff."""
def __init__(self):
self.special = "My special value!"
def process(self, default=True):
"""Accept any argument with no special processing (except True)."""
if default is True: # Notice I'm checking identity, not truth or equality
... | 677 | 183 |
from get_users_channels import getUsers
from user_association import userAssociation
from mmimo_mrt import computeBitrates
from dpb import Dpb
import numpy as np
def singleUESetSimulation(no_ue, scenario, dpb_algorithm, dpb, assignment_method):
pathloss, position, corr_data = getUsers(scenario,no_ue)
pathl... | 1,233 | 418 |
#!/usr/bin/python
import sys
import requests
reload(sys)
sys.setdefaultencoding('utf-8')
from bs4 import BeautifulSoup
link = sys.argv[1] + "/_api/web/lists(guid'" + sys.argv[2] + "')/Items"
ids = []
try:
r = requests.get(link)
bs = BeautifulSoup(r.text, features="xml")
for i in bs.findAll('entry'):
... | 687 | 243 |
# coding: utf-8
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from anchore_engine.services.policy_engine.api.models.base_model_ import Model
from anchore_engine.services.policy_engine.api.models.trigger_spec import TriggerSpec # noqa: F401,E501
from anchore_engine.se... | 5,362 | 1,596 |
from typing import List
def sum_numbers(numbers: List[float]) -> float:
"Calculate the total from a list of numbers."
total = 0.0
for number in numbers:
total += number
return total
def sum_all(*numbers_to_sum: List[float]) -> List[float]:
"Calculate the respective sums of every list p... | 395 | 118 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 31 16:29:33 2019
@author: jlee
"""
import time
start_time = time.time()
import numpy as np
import glob, os
import g0_init_cfg as ic
from astropy.io import fits
# ----- Importing IRAF from the root directory ----- #
current_dir = os.getcwd()
os.... | 3,576 | 1,428 |
import subprocess
def test_list_logical_types():
subprocess.check_output(['python', '-m', 'woodwork', 'list-logical-types'])
def test_list_semantic_tags():
subprocess.check_output(['python', '-m', 'woodwork', 'list-semantic-tags'])
| 244 | 83 |
#-*- coding: utf-8 -*-
#!/usr/bin/env python
''' '''
from usaio import PCFileOperatons
import unittest
''' Dropbox '''
class TestDropboxFileOperatons(unittest.TestCase):
pass
''' PC '''
class TestPCFileOperatons(unittest.TestCase):
''' '''
def testOpenClose(self):
pcfile = PCFileOperatons()
# должно выкидыва... | 770 | 304 |
from protocol import Protocol
from typing import Optional
import logging
import struct
from dataclasses import dataclass
from usb.core import USBTimeoutError
from Crypto.Cipher import AES
from Crypto.Hash import HMAC, SHA256
from Crypto.Random import get_random_bytes
from crccheck.crc import Crc32Mpeg2
USB_CHUNK_SIZE... | 19,279 | 6,279 |
# Copyright 2012 Rackspace Hosting, Inc.
#
# 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 ... | 10,293 | 2,778 |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from multiselectfield import MultiSelectField
from django.dispatch import receiver
def user_directory_path(instance, filename):
# file will be uploaded to MEDIA_ROOT/user_<id>/<filename>
# re... | 1,491 | 411 |
import logging
module_logger = logging.getLogger("hypercane.actions.sample")
def discover_timemaps(args):
from hypercane.utils import get_web_session, save_resource_data
from hypercane.identify import discover_resource_data_by_input_type, \
discover_timemaps_by_input_type, generate_faux_urits, \
... | 3,416 | 1,064 |
from collections import defaultdict
from parser import PARSER
from syntax_tree import build_ast
from type_objects import BuiltinType
def check_types(syntax_tree):
all_types = defaultdict(dict)
# Define builtin primitive types.
for t in ('int', 'float', 'string', 'void'):
all_types[t][None] = BuiltinType(t... | 1,459 | 464 |
import oneflow as flow
import oneflow.nn as nn
class SEModule(nn.Module):
def __init__(
self,
channels,
reduction=16,
rd_channels=None,
act_layer=nn.ReLU,
gate_layer=nn.Sigmoid,
mlp_bias=False,
):
super(SEModule, self).__init__()
rd_chann... | 766 | 297 |
import sys
import shutil
import getpass
import lib.krb5 as krb5
import lib.krb5_ctypes as krb5_ctypes
import ctypes
import binascii
import ctypes
import pdb
import json
import gc
#import IPython
from kerberos_serializer import *
import os
gc.disable()
CC_PATH = '/tmp/krb5cc_1000'
# Delete the default cache
def clear_... | 5,253 | 1,876 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from freedscovery_s3_connector._version import __version__
setup(name='freedscovery_s3_connector',
version=__version__,
description='',
author='FreeDiscovery Developpers',
packages=find_packages(),
inc... | 344 | 113 |
import pandas as pd
from django.core.management.base import BaseCommand
from library.log_utils import console_logger
from seqauto.models import Sequencer, SequencingInfo, EnrichmentKit
from snpdb.models import Lab, LabProject
LAB_NAME = "lab name"
INSTITUTION = "institution"
DOI = "doi"
PAPER_NAME = "paper name"
YEAR... | 2,669 | 758 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020~2999 - Cologler <skyoflw@gmail.com>
# ----------
#
# ----------
import pytest
from pytest import raises
from anyioc import ServiceProvider, LifeTime
from anyioc.utils_conf import BadConfError, load_conf
def from_conf(conf: dict):
provider = ServiceProvider()
loa... | 8,746 | 2,803 |
import unittest
from datetime import datetime
from hashlib import sha256
from bson import ObjectId
from six import string_types
from eduid_userdb import LockedIdentityNin, OidcAuthorization, OidcIdToken, Orcid
from eduid_userdb.credentials import METHOD_SWAMID_AL2_MFA, U2F, CredentialList, Password
from eduid_userdb.... | 34,195 | 11,369 |
"""Collection of Quantization Functions"""
# global
import ivy as _ivy
# local
from ivy_vision import single_view_geometry as _ivy_svg
MIN_DENOMINATOR = 1e-12
MIN_DEPTH_DIFF = 1e-2
def quantize_to_image(pixel_coords, final_image_dims, feat=None, feat_prior=None, with_db=False,
pixel_coords_va... | 13,515 | 5,318 |
from django.contrib import admin
from .models import Verification
class VerificationAdmin(admin.ModelAdmin):
list_display = ('ox_accounts_id', 'salesforce_id', 'status')
list_filter = ('status', )
admin.site.register(Verification, VerificationAdmin)
| 260 | 76 |
from .act_name_to_f import activation_name_to_function
from .multiopt_proxy import MultiOptProxy
from .running_stat import RunningStat
from .save_load_net import save_network, load_network, save_optimizer, load_optimizer
from .create_net import create_network
| 260 | 76 |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import six
from os import path, walk
import traceback
import re
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.module_utils._text import to_native
from ansible.plugins.action import ActionBase
from mc_sta... | 12,396 | 3,409 |
#
# Copyright 2019 Xilinx Inc.
#
# 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 writing... | 952 | 317 |
'''
Created on 14-Jul-2021
@author: Abhishek Prajapati
'''
execution_details = []
razor_status = "In Progress" | 111 | 46 |
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist, Point, PoseStamped
from nav_msgs.msg import Path
from std_msgs.msg import Float32MultiArray, Float64
from path_nav.msg import points, mylist
import math
import random
global obs_in_path
obs_in_path = []
global rate
def get_obs(request): ... | 6,760 | 2,352 |
from future import standard_library
standard_library.install_aliases()
from builtins import object
import operator
import array
import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
import json
import uservoice
from requests_oauthlib import OAuth1
from urllib.parse import p... | 6,808 | 1,936 |
# Our next aim is to build a simple app that will
# accept user input and show useful output.
# Our app will be a penguin classifier: input some
# measurements of a penguin, and the classifier will
# make an educated guess about the penguin's species.
# This means that we'll need to find a way to bring in
# our mac... | 4,754 | 1,474 |
import os
import base64
import requests
import time
import zlib
from . import version
from compat import bytes_, text_
from errors import APIException
from weak_ciphers import WeakCiphersAdapter
try:
from urllib.parse import urlparse, urlunparse, parse_qsl
except ImportError: # pragma: no cover
from urlparse ... | 13,417 | 3,933 |
###################################
#
# Point
#
###################################
class Point(object):
'''
A point.
'''
def __init__(self, x=0.0, y=0.0, z=None):
if hasattr(x, 'x'): # is this an objext containing x,y,z objects? If so, then transfer those.
tx = x.x
... | 4,160 | 1,399 |
#!/usr/bin/env python3
"""
The Ramer-Douglas-Peucker algorithm roughly ported from the pseudo-code provided
by http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
The code is taken from
https://github.com/mitroadmaps/roadtracer/blob/master/lib/discoverlib/rdp.py
"""
from math import sqrt
def distance(a, ... | 1,658 | 559 |
# Generated from StlParser.g4 by ANTLR 4.5.1
# encoding: utf-8
from __future__ import print_function
from antlr4 import *
from io import StringIO
def serializedATN():
with StringIO() as buf:
buf.write(u"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3")
buf.write(u"H\u010c\4\2\t\2\4\3\t\3\4\4\t... | 101,305 | 33,712 |
__version__ = "0.42.0"
| 23 | 14 |
# coding=utf-8
# Copyright 2022 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... | 8,337 | 2,776 |
from tflens.model.tfstate_resource import TfStateResource
class TfState():
def __init__(self, content: dict):
super().__init__()
self.__content = content
self.__version = self.__content['version']
self.__tf_version = self.__content['terraform_version']
self.__serial = self.__content['serial']
... | 832 | 240 |
import os
#
# Collective Knowledge ()
#
#
#
#
# Developer:
#
cfg={} # Will be updated by CK (meta description of this module)
work={} # Will be updated by CK (temporal data)
ck=None # Will be updated by CK (initialized CK kernel)
# Local settings
#################################################################... | 13,140 | 4,543 |
"""
Class for Data Extraction from CloudFront
"""
import boto3
from deplugins.base import AWSFact
class CloudFront (AWSFact):
NAME = "CloudFront-SSL"
OPTION = 'cfront_ssl'
ORDERED_HEADINGS = ['Id', 'SSLSupportMethod', 'MinimumProtocolVersion', 'IAMCertificateId']
def get_all_regions(self):
... | 1,087 | 310 |
#
# @lc app=leetcode id=733 lang=python3
#
# [733] Flood Fill
#
# https://leetcode.com/problems/flood-fill/description/
#
# algorithms
# Easy (52.32%)
# Likes: 745
# Dislikes: 146
# Total Accepted: 86.6K
# Total Submissions: 163.5K
# Testcase Example: '[[1,1,1],[1,1,0],[1,0,1]]\n1\n1\n2'
#
#
# An image is repre... | 2,348 | 863 |
from typing import List
from webdnn.backend.code_generator.allocator import MemoryLayout
from webdnn.backend.code_generator.injectors.buffer_injector import BufferInjector
from webdnn.backend.code_generator.injectors.kernel_name_injector import KernelNameInjector
from webdnn.backend.webgpu.generator import WebGPUDescr... | 2,205 | 732 |
from pygame import *
from random import randint
#фоновая музыка
mixer.init()
mixer.music.load('music.mp3')
mixer.music.play()
#подключение звуков
GOAL_sound = mixer.Sound('GOAL.wav')
hit_sound = mixer.Sound('HIT.wav')
#шрифты и надписи
font.init()
font1 = font.SysFont("Arial", 73)
win_left_text = fo... | 6,624 | 2,661 |
#!/usr/bin/env python
#author mark_purcell@ie.ibm.com
import json
import os
import requests
import csv
from db2 import DB2
SQL_TEMPLATE = ''
SQL_TEMPLATE += 'CALL {database}(); '
def build_query(database):
sql_template = SQL_TEMPLATE.format(database=database)
return sql_template, True
def process_response... | 1,277 | 440 |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from faq.views import TopicListView, TopicDetailView, question_detail
# Include these patterns if you want URLs like:
#
# /faq/
# /faq/topic/
# /faq/topic/#question
#
urlpatterns = [
url(r'^$', TopicListView.as_view(), name='faq-topic-list'),
u... | 554 | 214 |
# -*- coding: utf-8 -*-
import time
import subprocess
import digitalio
import board
from PIL import Image, ImageDraw, ImageFont
import adafruit_rgb_display.st7789 as st7789
import requests
#####################################################################################################
# You can disable panels th... | 22,599 | 8,304 |
#!/usr/bin/python
import itertools
import fnmatch
import json
import os
import pwd
import redis
import prettytable
import datetime
from sys import path, argv, stdout
from time import sleep, time
from optparse import OptionParser
from common import *
class ExpRunner:
# ##########################################... | 15,341 | 4,899 |
# Copyright 2015 Brocade Communications System, 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
#
#... | 24,612 | 9,632 |
#Python program to check whether the year is leap or not using inbuilt function
import calendar
def main():
x=int(input("Enter the year"))
if calendar.isleap(x):
print(x,"is leap year")
else:
print(x,"is not a leap year")
if __name__=='__main__':
main()
| 264 | 96 |
""" maguro """
version = "0.0.9" | 32 | 15 |
from git import *
import re
r = re.compile("v(\d+\.\d+).*")
git=Repo(search_parent_directories=True).git
version = git.describe(tags=True,always=True,dirty=True,long=True)
print(r.search(version).group(1))
| 208 | 82 |
# 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 writing, software
# distributed under t... | 7,022 | 1,804 |
# Copyright 2013 Evan Hazlett and contributors
#
# 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... | 2,658 | 797 |
from builtins import getattr
from warnings import warn
try:
from mpi4py.MPI import DOUBLE as MPI_DOUBLE, COMM_WORLD as MPI_COMM_WORLD
import matplotlib.pyplot as plt
import numpy as np
except:
warn('Ensure that all required packages are installed.')
exit()
from PCE_Codes._helpers import _warn
from... | 4,482 | 1,325 |
"""This file contains code for use with "Think Bayes",
by Allen B. Downey, available from greenteapress.com
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function, division
import math
import numpy
import random
import sys
import correlation
... | 21,121 | 7,295 |
from .models import Message
from .serializers import MessageSerializer
from rest_framework import viewsets
class MessageViewSet(viewsets.ModelViewSet):
queryset = Message.objects.all().order_by("created_at")
serializer_class = MessageSerializer
| 256 | 67 |
from .spacenet_loader import SpaceNetDataLoader
from .spacenet_road_loader import SpaceNetRoadDataLoader
from .cyclegan_data import CustomDatasetDataLoader
| 157 | 48 |
import asyncio
from fbrp.process import ProcDef
import a0
import argparse
import asyncio
import contextlib
import enum
import psutil
import json
class BaseLauncher:
def __init__(self):
pass
async def run(self, name: str, proc_def: ProcDef, args: argparse.Namespace):
raise NotImplementedError(... | 2,608 | 799 |
# Convenience imports.
# flake8: noqa
from .trap import trap
from .raises import raises
| 88 | 31 |
from django.views.generic import TemplateView, RedirectView
from django.contrib.auth import login, logout, authenticate
from django.shortcuts import render
from main.permissions import *
class IndexView(TemplateView):
template_name = "home.html"
def login_resident(request):
if request.method == 'POST':
... | 1,375 | 352 |
import config, lang
import pb
import urllib2
import urlnorm
import os
import time
def parse(pages):
spelings = []
speling_dirpath = "data/speling/%s/%s/" % (config.wiki_lang, config.start_cat)
pages_dirpath = "data/pages/%s/%s/" % (config.wiki_lang, config.start_cat)
counter = 0
for page in pages:
counter +=... | 1,072 | 440 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | 8,087 | 2,437 |
import os
img_path = '/home/deep/datasets/hmdb/'
clip_length = 16
f = open('ucfTrainTestlist/hmdb.txt', 'w')
actions = os.listdir(img_path)
actions.sort(key=str.lower)
label = 0
for action in actions:
print(action)
samples = os.listdir(img_path + action)
samples.sort(key=str.lower)
for sample in sam... | 416 | 161 |
import ik
import unittest
class TestSolver(unittest.TestCase):
pass
| 73 | 24 |
# Generated by Django 3.1.14 on 2022-03-24 11:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('feedback', '0030_auto_20220324_0947'),
]
operations = [
migrations.AddField(
model_name='report',
name='eid',
... | 437 | 159 |
import json
import pytest
from handler import detect_language, translate_message, handler
@pytest.mark.skip
@pytest.mark.parametrize("test_input, expected", [
('This text is written in English', 'en'),
('Этот текст написан mostly по-русски', 'ru'),
('Ten tekst jest napisany w jezyku polskim, ale bez znako... | 1,232 | 412 |
#!/usr/bin/env python3
#
# Copyright (C) 2018 Alpha Griffin
# @%@~LICENSE~@%@
from ag.orbit.command import main
from ag.orbit.node.config import get_webapi_interface, set_webapi_interface
def run(args):
if args and len(args) != 1:
raise ValueError("Expecting exactly 1 argument")
if args:
ip ... | 715 | 246 |
import ocr_space_api_engine as ocr_eng
import licensePlate_string_parser as license_parser
import DB_Utils
import os
import datetime
def run():
dataset_rel_path = 'images/'
files = os.listdir(dataset_rel_path)
vehicles = {license_parser.tables_names[0]: {},
license_parser.tables... | 849 | 270 |
'''These tests are for utilities to call paragraph helpers that instansiate the
common classes. I am using '''
# pylint: disable=missing-function-docstring
import testing.constants.common as common
def test_display_para_from_json_returns_dictionary(display_text_from_json):
'''This is an integration test, testi... | 1,420 | 414 |
# -*- encoding: utf-8 -*-
"""
@Author : zYx.Tom
@Contact : 526614962@qq.com
@site : https://zhuyuanxiang.github.io
---------------------------
@Software : PyCharm
@Project : Hanlp-Books-Examples
@File : demo_corpus_loader.py
@Version : v0.1
@Time : 2020-12-21 16:27
@... | 1,290 | 523 |
"""
Create a label file and a pickled subset file of the recount3 dataset containing only samples
with manually annotated tissue labels
"""
import argparse
import pickle
from typing import Dict
import pandas as pd
def map_samples_to_labels(file_path: str) -> Dict[str, str]:
metadata_df = pd.read_csv(file_path, ... | 1,895 | 615 |
"""
This module contains testing classes for the leaks test.
"""
class A(object):
def __init__(self, c):
print "A.__init__() was called"
self._c = c
def __del__(self):
print "A.__del__() was called"
self._c.event("__del__ was called")
| 278 | 90 |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2016 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... | 4,136 | 1,248 |
import unittest
import json
from tests.dummy_flask_app import app
class JsonTypeContentValidatorTests(unittest.TestCase):
def setUp(self):
app.testing = True
self.app = app.test_client()
def test_dummy_resource_should_return_data_given_json_content_header(self):
# given
url = ... | 1,210 | 377 |
from .StorePage import StorePage
class BrowseObject(StorePage):
def writeContent(self):
req = self.request()
className = req.field('class')
serialNum = int(req.field('serialNum'))
obj = self.store().fetchObject(className, serialNum, None)
if obj is None:
self.w... | 582 | 171 |
# Import SQLAlchemy
from flask.ext.sqlalchemy import SQLAlchemy
# Import Flask
from .app import app
# Define the database object which is imported
# by modules and controllers
db = SQLAlchemy(app)
| 199 | 61 |
from delphifmx import *
from parent_window import Parent_Form
def main():
Application.Initialize()
Application.Title = 'Exporter Demo'
Application.MainForm = Parent_Form(Application)
Application.MainForm.Show()
Application.Run()
Application.MainForm.Destroy()
if __name__ == '__main__':
mai... | 324 | 95 |
#!/usr/bin/python
'''
Read results from visual inspection, create new target lists.
'''
import os, sys
import json
import glob, shutil
from collections import OrderedDict
if __name__ == '__main__':
# read candidate events.
with open('candidate-events.json', 'r') as fp:
cand_events = json.load(fp... | 2,867 | 945 |
#!/usr/bin/env python
from setuptools import find_packages, setup
long_description = """Basic regular expression lexer implementation.
"""
appname = "rexlex"
version = "0.02"
setup(**{
"name": appname,
"version": version,
"packages": [
'tater',
],
"author": "Thom Neale",
"package... | 736 | 251 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class EduWorkAddress(object):
def __init__(self):
self._address = None
self._city = None
self._district_name = None
self._province = None
self._street_name = Non... | 2,776 | 847 |
class Solution:
def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:
if not intervals:
return 0
count = 0
intervals.sort()
left, right = intervals[0]
for start, end in intervals[1:]:
if start < right:
count += 1
... | 450 | 116 |
import sys
sys.path.append('/home/sriteja/PycharmProjects/My_Mario/mymario')
import objects as o
import config as c
ob = o.Obj(10, 10, 5,6, 'a')
def test_init():
assert (ob.max_x, ob.max_y, ob.min_x, ob.min_y, ob.string, ob.check_ends) == (10, 10, 5, 6, 'a', False)
def test_update():
ob.min_x = 4
ob.mi... | 585 | 285 |
import collections
from enum import Enum, auto
class Duplicates(Enum):
ALLOW = auto()
IGNORE = auto()
ERROR = auto()
class HTDM:
def __init__(self, address_sep=".", duplicates=Duplicates.ALLOW):
self.counters = []
self.address_sep = address_sep
self.duplicates = duplicates
... | 3,479 | 951 |
# SPDX-FileCopyrightText: 2017 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT
from adafruit_circuitplayground.express import cpx
cpx.play_tone(262, 1)
cpx.play_tone(294, 1)
| 199 | 94 |
# 这个文件包含3个类
# Transaction
# Top
# Block
# 用来实例化后实行解析操作
class Transaction:
txID = ''
ret = []
signature = []
raw_data = {}
txdata = {}
type = ''
def __init__(self, tx):
self.txID = tx['txID']
self.ret = tx['ret']
self.signature = tx['signature']
self.raw_dat... | 4,375 | 1,435 |
"""
Você deve criar uma classe carro que vai possuir dois atributos compostos por outras duas
classes:
1)Motor
2)Direção
O Motor terá a responsabilidade de controlar a velocidade.
Ele oferece os seguintes atributos:
1)Atributo de dado velocidade
2)Método acelerar, que deverá incrementar a velocidade de uma unidade
... | 2,432 | 965 |
# Copyright 2017 Joachim van der Herten
#
# 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 wr... | 2,482 | 754 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import logging
from django.template.loader import render_to_string
from django.utils.translation import ugettext as _
from django.utils.functional import cached_property
from django.core.exceptions import ImproperlyConfigured
try:
f... | 3,160 | 957 |
from networkx import Graph, complement
from networkx.algorithms.clique import find_cliques
def maximal_independent_sets(mat):
g = Graph(mat)
for u in g.nodes():
if g.has_edge(u, u):
g.remove_edge(u, u)
cg = complement(g)
isets = list(find_cliques(cg))
return isets
| 307 | 108 |
"""Autogenerated 2021-11-16T11:37:36.551949 by redcap_classfiles.py
"""
from ....pgrest import *
from ...constants import Constants
from ..rcconstants import REDCapConstants
from ..rcaptable import RcapTable
__all__ = ["RcapQstMcc1V03"]
class RcapQstMcc1V03(RcapTable):
"""Qst Mcc1 V03"""
__redcap_form_nam... | 47,930 | 29,589 |
# -*- coding: iso-8859-15 -*-
import unicodedata
import nltk
from nltk.stem.porter import PorterStemmer
import itertools
from nltk.tokenize import RegexpTokenizer
import pandas as pd
import numpy as np
import re
from nltk.corpus import stopwords
from tqdm import tqdm
import glob
import multiprocessing
from functools im... | 4,241 | 1,421 |
from typing import Any
import math
import types
from rx.core.notification import OnNext, OnError, OnCompleted
from .recorded import Recorded
from .subscription import Subscription
def is_prime(i: int) -> bool:
"""Tests if number is prime or not"""
if i <= 1:
return False
_max = int(math.floor(... | 1,902 | 560 |
from model.sentclassifier import SentClassifier
from model.seqlabel import SeqLabel
from utils.data import Data
import torch
import os
import sys
from utils.functions import normalize_word
import time
from main import recover_nbest_label, get_ner_fmeasure, recover_label, batchify_with_label
def label_input(input_line... | 12,296 | 3,813 |
from .move_joint import move_joint, print_err, print_ok | 55 | 18 |
#!/usr/bin/python
import binascii
import dpkt
import struct
import sys
# Start the pcap file parsing
f = open("usbtraffic.pcap", 'rb')
pcap = dpkt.pcap.Reader(f)
#print(pcap)
lba = 0
packets = []
for ts, buf in pcap:
#print(ts)
if buf[64:68] == b'USBC':
#lba = int( buf[], 16)
a = buf[0x51:0x55]... | 694 | 305 |
from django.shortcuts import render
from . utils import get_html_content
from store.utils import cartData
# Create your views here.
def weather(request):
weather_data = {}
unknown_location = {}
try:
if 'city' in request.GET:
# Fetch weather data
city = request.GET.get('c... | 2,586 | 861 |