text
string
size
int64
token_count
int64
from .utils import vc, load_config, tensors_close, tensors_close_sum, rand_true, freivalds_rounds, submul_ratio from .partial_class import partial_class from .validation_set import ValidationSet from .validation_buffer import ValidationBuffer from .register_hooks import register_activation_hooks, register_gradient_hook...
459
130
from .alerts import AlertStubMixin from .analysis import AnalysisStubMixin from .identities import IdentityStubMixin from .capsules import CapsuleStubMixin from .streams import StreamStubMixin from .zone_statuses import ZoneStatusStubMixin from .zones import ZoneStubMixin from .storage import StorageStubMixin from .ala...
712
237
from shgo.shgo_m.triangulation import * from ._shgo import shgo __all__ = [s for s in dir() if not s.startswith('_')]
118
47
"""Corpus filtering""" import difflib import itertools import logging import math import os import string from typing import Iterator, List, Tuple import rapidfuzz import regex from langid.langid import LanguageIdentifier, model import pycld2 from bs4 import BeautifulSoup as bs import fasttext from . import FilterAB...
20,482
5,884
s=0 c=0 for n in range(6): num=int(input('digite o {}º número:'.format(n+1))) if num%2==0: s+=num c+=1 print('a soma dos {} números pares é {}'.format(c,s))
180
78
# coding: utf-8 # In[1]: ##Includes from flask import request, url_for from flask_api import FlaskAPI, status, exceptions from flask_cors import CORS, cross_origin from flask import Blueprint, render_template, abort import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.rea...
3,736
1,402
#py_numpy_1.py """a snake-charming application""" from PIL import Image import numpy as np import os idir =os.getcwd() iname= 'im3.png'# 'white_snake.PNG' saveas='new_snake.PNG' #sets up an array for pixel processing white=np.array([255,255,255,0]) #r, g, b, a transparent = np.array([0, 0, 0, 0]) background = whit...
2,119
802
class Container: def __init__(self): self.data = {} index = -1 # compound "container" entries def parseContainer(container, data, size): global index mode = 0 # 0 = var names, 1 = var values buffer = "" while index + 1 < size: index += 1 char = data[index] ...
2,958
838
""" Copyright 2018 EPAM Systems, 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...
3,017
820
import time b = time.time() import torch import torch.nn as nn import torch.nn.functional as F from torchsummary import summary from math import log2, exp a = time.time() print('Imports complete in %.3f seconds' % (a-b)) class Generator(nn.Module): def __init__(self,latent_dims=128,n_channels=3,max_resolution=64,...
3,324
1,276
from __future__ import print_function from __future__ import absolute_import from __future__ import division import scriptcontext as sc try: import compas # noqa: F401 import compas_rhino # noqa: F401 import compas_ags # noqa: F401 import compas_tna # noqa: F401 import compas_cloud ...
2,607
995
#!/usr/bin/env python # vim: set sw=4 ts=4 softtabstop=4 expandtab: """ Read invocation info file for smt-runner and report which benchmarks are supported by the CoralPrinter. """ # HACK: put smt2coral in search path import os import sys _repo_root = os.path.dirname(os.path.dirname(__file__)) sys.path.insert(0, ...
3,783
1,165
def closestNumbers(numbers): numbers.sort() mindiff = sys.maxint n = len(numbers) for k in range(n-1): absdiff = abs(numbers[k] - numbers[k+1]) if absdiff < mindiff: mindiff = absdiff for k in range(n-1): absdiff = abs(numbers[k] - numbers[k+1]) if absdiff...
393
141
""" The filterer object. @author: Chris Scott """ from __future__ import absolute_import from __future__ import unicode_literals import copy import time import logging import numpy as np import six from six.moves import zip from .filters import _filtering as filtering_c from ..system.atoms import elements from . i...
18,810
5,029
import sqlite3 connection = sqlite3.connect("Project.db") cursor = connection.cursor() S_user = cursor.execute(f"SELECT * FROM Current_login WHERE No = '{1}'") record = S_user.fetchone() user = record[0] print(user) try: Spl_user = cursor.execute(f"SELECT * FROM Col_Pref_list where Username = '{user}'") recor...
475
164
@resumable # For PyJL def generator_func(): num = 1 yield num num = 5 yield num num = 10 yield num @resumable def generator_func_loop(): num = 0 for n in range(0, 3): yield num + n @resumable def generator_func_loop_using_var(): num = 0 end = 2 end = 3 # should get ...
2,766
1,012
from fastapi import ( Depends, FastAPI, ) from fastapi.middleware.cors import CORSMiddleware from sqlalchemy.orm import Session from quipper import ( models, schemas, services, ) from quipper.database import ( SessionLocal, engine, ) # Create the tables models.Base.metadata.create_all(bin...
1,252
416
"""Adjacency list is a graph representation using array or a hash map""" from collections import deque class AdjacencyListGraph: """Graph representation using dictionary""" def __init__(self): self.__nodes = {} def __str__(self): return str(self.__nodes) def insert_vertex(self, data...
3,611
1,018
#!/usr/bin/python import json import subprocess import logging from pyroute2 import IPDB import sys logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger("runme") def add_dns(interface): str = "" try: with open('/dns') as dnsfile: dnsdata = dnsfile.readlines() dn...
4,515
1,339
#!/usr/bin/env python3 import sys import os import argparse import subprocess import textwrap import helpers class Summarise(): def __init__(self, file, term_cols): self.term_cols = term_cols self.cols_width = [21, 22, 11, 15, 22] self.in_lnv = False self.lnv_iteration = 0 ...
9,725
2,964
#!/usr/bin/python # -*- coding: utf-8 -*- # Import required libraries import time import random import datetime import RPi.GPIO as GPIO # Use BCM GPIO references instead of physical pin numbers GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP) # 1 step = 1/4 of full def rotate(movesteps, rotat...
3,202
1,196
import spotipy import argparse sp = spotipy.Spotify() parser = argparse.ArgumentParser() parser.add_argument("term", help="The artist that you want to search for") parser.add_argument("-c", "--count", help="The amount of results that you want, capped at 20", type=int) args = parser.parse_args() def spoprint(): re...
604
206
""" ##Big Data Transfer Protocol ###What does it do This protocol sends big data on a address (IPv4,port) without worrying about pipe errors. """ __author__ = "Xcodz" __version__ = "2021.2.24" import abc import socket import time import typing from . import thread_control default_buffer_size = 100000 class _Base...
13,484
4,175
# Copyright 2017 SrMouraSilva # # 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,...
1,431
437
from geo import * from geo.routines import * from matplotlib import * from sys import * from pylab import * import os import time import pylab size = (166, 141, 20) print "loading image..." data_3D = load_ind_property("BIG_SOFT_DATA_160_141_20.INC", -99, [0,1], size) data = data_3D[0][:,:,0] mask =...
1,203
598
# faça um programa q leia o ano de nascimento de um jovem e informe de # acordo com sua idade se ele ainda vai se alistar ao serviço miliar, # se é a hora de se alistar ou se ja passsou do tempo do alistamento from datetime import date hoje = date.today().year print(hoje) nascimento = int(input("Diga o ano que voce na...
533
189
import os import sys import json import time import base64 import subprocess DEBUG = 0 def json_paser(injson): injson = str.encode(injson) injson = base64.b64decode(injson) jsonin = json.loads(injson) if jsonin["language"] == "dmsl": code = jsonin["code"] code = bytes.decode(base64.b...
1,250
471
import chess from chess import Board from chess.engine import Score def sign(a): return (a > 0) - (a < 0) def material_value(board): return sum(v * (len(board.pieces(pt, True)) + len(board.pieces(pt, False))) for v, pt in zip([0, 3, 3, 5.5, 9], chess.PIECE_TYPES)) def material_count(board):...
1,313
478
from typing import List def create_new_endtype(endtype_name: str, endtype_id: int, folder_name: str) -> int: """Create a new endtype Args: endtype_name (str): name endtype_id (int): endtype id folder_name (str): folder name Returns: int: endtype id """ def get_en...
3,212
1,055
from floodsystem.flood import highest_risk from floodsystem.stationdata import build_station_list def run(): """Requirements for Task 2G""" stations= build_station_list() for s in highest_risk(stations,dt=3,N=10,y=3): print(s) #works with whole list but takes v. long time if __name__ == "__mai...
399
139
class CompareUtility(object): """Compares the text with the passed argument""" def compare_text(self, *args): return self.get_text() == args[0] def check_element(self, *args): """Check for an element by it's class name""" try: element = self.find_element_by_xpath(args[0]...
621
171
from molsysmt._private_tools.exceptions import * from molsysmt.forms.common_gets import * import numpy as np from nglview import widget as _nglview_widget import importlib import sys from molsysmt.molecular_system import molecular_system_components form_name='nglview.NGLWidget' is_form = { _nglview_widget.NGLWidg...
10,867
3,793
"""Hotkeys plugin example this module contains the general, non gui-toolkit specific part of the code """ # uncomment these where appropriate # import collections # from example_app_keys_gui import layout_extra_fields_* # om dit beschikbaar te maken voor import # uncomment this to define a routine to (re)build the c...
1,435
382
# Copyright (c) 2016-2017, Neil Booth # # All rights reserved. # # The MIT License (MIT) # # 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 ...
8,525
3,619
import pygame import tensorflow as tf import sys import settings as stg import matplotlib.pyplot as plt from board import Grid import gui import numpy as np class Game(): def __init__(self): pygame.init() self.game_display = pygame.display.set_mode( (stg.display_x, stg.display_y)) ...
3,854
1,299
from mantisshrimp import * from mantisshrimp.hub.pennfundan import * from mantisshrimp.engines.fastai import * import albumentations as A source = get_pennfundan_data() parser = PennFundanParser(source) splitter = RandomSplitter([0.8, 0.2]) train_records, valid_records = parser.parse(splitter) train_transforms = Alb...
825
320
from os.path import basename, dirname, join, abspath from setuptools import setup, Extension from distutils.command.build import build as dBuild from setuptools.command.install import install as dInstall from setuptools.command.build_ext import build_ext as dBuildExt from setuptools.command.bdist_egg import bdist_egg a...
10,649
3,265
# ----------------------------------------------------------------------- # Copyright (c) 2020, NVIDIA Corporation. All rights reserved. # # This work is made available # under the Nvidia Source Code License (1-way Commercial). # # Official Implementation of the CVPR2020 Paper # Two-shot Spatially-varying BRDF and Shap...
677
200
import pdb import logging import os import sys import time import subprocess import xlrd import win32gui import win32api import win32con #import comtypes from configparser import ConfigParser from comtypes.client import * from ctypes import * def logTreeItem(node): logging.info('--------------------------------------...
26,765
10,962
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-03 17:48 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('eregs_core', '0005_appendix_definition_paragraph_reference_...
1,052
307
# The Expat License # # Copyright (c) 2017, Shlomi Fish # # 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 rights # to use, copy, modify, ...
2,592
973
#!/usr/bin/env python3 # coding=utf-8 # -*- utf8 -*- # author=dave.fang@outlook.com # create=20170330 import math from lib.log import LOGGER class NaiveBayes: def __init__(self): # 元数据 self.data_set = [] # 分类后的数据 self.separate_set = {} # 分类后, 性别的先验概率 self.separate_p...
4,331
1,741
from views.sprite_views.attack_sprite import AttackSprite, AttackState from views.sprite_views.movement_sprite import Direction, State class ComboAttackSprite(AttackSprite): def __init__(self, player_data, combo_attack, on_finish): self.combo_attack = combo_attack self.combo_images = player_data....
1,004
352
# Generated by Django 2.2.3 on 2019-08-01 18:13 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app', '0023_auto_20190801_2011'), ] operations = [ migrations.RenameModel( old_name='MotVoice', new_name='ExpressionVoice', ...
337
133
from flask import Blueprint from flask_security import SQLAlchemyUserDatastore from app import db from app.users.models import User, Role bp = Blueprint('users', __name__, template_folder='templates') user_datastore = SQLAlchemyUserDatastore(db, User, Role) # Create a user to test with @bp.before_app_first_request...
548
178
from substrateinterface import SubstrateInterface, Keypair from substrateinterface.utils.ss58 import ss58_encode, ss58_decode # # get_config - Get a default and validator specific config elements from args and config. # def get_config(args, config, key, section='Defaults'): if vars(args)[key] is not None: ...
6,457
1,931
# -*- coding: utf-8 -*- """ LogfileLexer - Demo Highlights whole lines which matches the regex. Usage: Load a logfile, modify error and warning regex and run script to see how it works Note: By commenting or deleting everything, including, the <comment_or_delete> tags it is ready to be us...
7,279
1,984
from .logger import LOG from .funs import * # 函数容器 class PyFunction(object): def __init__(self): self.function_map = dict() def register_func(self, function_name: str, func): if function_name in self.function_map: LOG.warning("function {} exist".format(function_name)) ...
913
310
from ipython_kernel_plugin import IPythonKernelPlugin, IPYTHON_KERNEL_PROTOCOL # noqa
87
33
import torch import numpy as np import os from ..utils import load_params, get_scaler, get_rescaler class ForwardModel(): def __init__(self, robot_type=None): try: filename = f'.../maenv/mpe/_mpe_utils/{robot_type}_config.yaml' params = load_params(filename).get('forward_model') ...
3,283
1,142
from django.shortcuts import render from blog.models import BlogPost from operator import attrgetter from blog.views import get_blog_queryset from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator # Create your views here. BLOG_POSTS_PER_PAGE = 1 def home_screen_view(request): context = {} que...
948
351
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Function: Create a plugin project based on example project. This script has been tested with ActivePython 2.7/3.2. Usage: python makeplugin.py [prjname [pkgname [srcprj [srcpkg [useswig]]]]] or double click the file 'makeplugin.py'. ...
5,771
1,940
from PIL import Image import os import numpy as np import pandas as pd from random import seed from random import randint dirname = os.path.dirname('') dimensions = 600, 600 def make_armors(ma, ma2, ma3): count_doojunggap = 0 count_gyungbyungap = 0 count_chalgap = 0 ...
146,532
98,932
from collections import namedtuple class _Entry(namedtuple('_Entry', 'value next')): def _repr_assist(self, postfix): r = repr(self.value) + postfix if self.next is not None: return self.next._repr_assist(', ' + r) return r class Stack(object): def __init__(self): s...
700
222
import sys import pytest from polynomials_on_simplices.calculus.real_interval import equivalent_periodic_element def test_equivalent_element(): b = equivalent_periodic_element(1.0, 2.0) assert 1.0 == b b = equivalent_periodic_element(3.0, 2.0) assert 1.0 == b b = equivalent_periodic_element(-3.0...
468
183
from client_database_connection import mycursor from ftp import * from config import free config = json.loads(open('config.json').read()) node_id = config['node id'] local_path = config['local path'] while free: sql = "SELECT code_id FROM code_node where node_id = " + node_id mycursor.execute(...
761
261
import os from flask import Flask, flash, request, redirect, url_for, jsonify from flask_cors import CORS from werkzeug.utils import secure_filename import subprocess # set up text to speech map from nltk.stem import PorterStemmer from nltk.tokenize import word_tokenize # speech recognition import speech_recognition ...
5,862
1,862
from cc3d.core.PySteppables import * class MomentOfInertiaPrinter3D(SteppableBasePy): def __init__(self, frequency=10): SteppableBasePy.__init__(self, frequency) self.semi_minor_axis = 15 self.semi_median_axis = 8 self.semi_major_axis = 5 def start(self): self.generate...
1,128
414
import data_module import email_module import db_module from jinja2 import Environment, FileSystemLoader from os import path import time from datetime import datetime DIR_PATH = path.dirname(path.realpath(__file__)) NEW_SKIRT_SUBJECT = r"Novinka! - {0}" NEW_PRINT_SUBJECT = r"NOVÉ TISKY! - {0}" DAY_INIT_SUBJECT = r"Ke...
4,003
1,326
# -*- coding: utf-8 -*- from gos.configuration import Configuration from gos.exceptions import GOSTaskException, GOSExecutableContainerException from gos.executable_containers import ExecutableContainer from gos.tasks import TaskLoader class Manager(object): def __init__(self, config): self.configuration ...
3,661
917
import requests import json class CRDT(object): """ A base class CRDT. This only takes care of getting the value and putting the local state of the CRDT from/to the database. What those things mean is up to specific implementations. """ def __init__(self, name, url, db, auth=(), params={}, alw...
2,608
730
from enum import Enum class RealType(Enum): FixedPoint = 'FIXED_POINT' FloatReal = 'FLOAT_REAL' HardFloat = 'HARD_FLOAT'
134
55
# -*- coding: utf-8 -*- from zvt.recorders.joinquant.overall.cross_market_recorder import * from zvt.recorders.joinquant.overall.margin_trading_recorder import * from zvt.recorders.joinquant.overall.stock_summary_recorder import *
231
81
import unittest from simulator_diagnoser.graph import InmemoryGraph from simulator_diagnoser.diagnosis import APTDiagnoser from simulator_diagnoser.matcher import Terminal, \ Sequence, \ StatelessMatcher class APTDiagnoserTest(unittest.Tes...
1,708
601
#!/usr/bin/env python3 """Roll up the geo6 json to produce a tree suitable for sub9 query""" __author__ = "H. Martin" __version__ = "0.1.0" import json import math from random import randint data = {} transformed = {} with open('geohash_counter_6.json', encoding='utf-8') as data_file: data = json.loads(data_...
888
332
import pytest from models.notes import NotesModel from schemas.notes import NotesSchema from tests.attributes import note_attrs @pytest.fixture def note_attributes(faker): def _note_attributes(text, user, ticket): return {**note_attrs(faker, text), "user_id": user.id, "ticket_id": ticket.id} yield _n...
716
222
""" MIT License Copyright 2021-Present kal-byte 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 rights to use, copy, modify, merge, publish, ...
2,220
747
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from tav.tmux import hook def test_hook_suppression(): hook.disable('testing') assert not hook.isEnabled() hook.enable('testing') assert hook.isEnabled()
213
78
class BaseHandler(object): def boot(self): pass def handle(self, cpu, data, size): raise NotImplementedError def shutdown(self): pass
172
52
# Generated by Django 2.1.7 on 2019-03-23 17:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('accounts', '0002_auto_20190113_1602'), ] operations = [ migrations.AlterField( model_name='user', name='created_at',...
445
158
import dash from dash import dcc from dash import html,Input, Output import dash_bootstrap_components as dbc from ..app import app from .sidebar_function_tab1 import TAB1_DROPDOWN,time_scale,date_slider,choose_fun_tab1 SIDEBAR1 = [dbc.Row("Energy Dashboard",class_name="title",style={"font-size":"30px","padding-left":...
979
329
#!/usr/bin/env python from __future__ import print_function from moveit_python_interface import MoveGroupPythonInteface from geometry_msgs.msg import Pose import rospy from interbotix_moveit_interface.srv import GetTrajectory, GetTrajectoryResponse # flags GO_TO_START_JOINT_VALUES = False # whether to use ...
4,176
1,352
""" This module contains the BaseImporter Abstract class which all other importers are inherited from. """ from abc import ABC, abstractmethod from utilities.constants import ImportModes class BaseImporter(ABC): def __init__(self, link, loaded_json_data): self.link = link self.json_data = loaded...
573
161
from worldbankstext import *
28
8
# Imports import requests import os import sys import lcddriver import time import datetime import RPi.GPIO as GPIO import dht11 thingspeak_key = 'ZHAO5MQEKA0B93P7' temperature = 23 humidity = 35 # Send the data to Thingspeak r = requests.post('https://api.thingspeak.com/update.json', data = {'api_key':thingspeak...
367
148
from ._storage_entry_model import StorageEntryModel
51
13
import os import json import fire def main(meme_dir): print("meme_dir: ", meme_dir) print("-" * 100) meme_val_anno_1 = [] with open(os.path.join(meme_dir, "dev_seen.jsonl")) as f: for line in f: meme_val_anno_1.append(json.loads(line)) meme_val_anno_2 = [] with open(os.pa...
857
349
#!/usr/bin/env python """Generate go-pylons.py""" import sys import textwrap import virtualenv filename = 'go-pylons.py' after_install = """\ import os, subprocess def after_install(options, home_dir): etc = join(home_dir, 'etc') ## TODO: this should all come from distutils ## like distutils.sysconfig.get...
1,324
480
import os import pkg_resources import shutil from ..equations import equations from ..definitions import EQN_DEFINITIONS def generate_equations_doc(docfile): """ Helper function to automatically generate a documentation page containing all the available equations within cweqgen. Parameters -----...
3,173
975
import os; import sys; FileName='FileIO.txt' def fileInput(fw,numOfEmployees): #Getting the value of counter frc = open(os.path.dirname(os.path.realpath(__file__))+"/counter.txt","r"); counter = int(frc.read()); frc.close(); #Taking input and writing to the file for i in range(counter,numOfE...
3,624
1,256
import time from print_running_function import print_running_function # Hackish method to import from another directory # Useful while xendit-python isn't released yet to the public import importlib.machinery loader = importlib.machinery.SourceFileLoader("xendit", "../xendit/__init__.py") xendit = loader.lo...
4,442
1,382
import unittest from textwrap import dedent import trafaret as T from .util import get_err class TestSMTP(unittest.TestCase): TRAFARET = T.Dict({ T.Key('port'): T.Int(), T.Key('smtp'): T.Dict({ 'server': T.String(), 'port': T.Int(), 'ssl_port': T.Int(), ...
2,220
701
B_5801_9 = {0: {'A': -0.3411047643185575, 'C': 0.003633483019123024, 'E': -0.4818751780000427, 'D': -0.48635888961606405, 'G': -0.2552323225624609, 'F': -0.18023397304713804, 'I': 0.3607439895775445, 'H': 0.020686177466924322, 'K': 0.8273437122618179, 'M': 0.47430136579724197, 'L': 0.17966127012728303, 'N': -0.32919669...
4,856
4,354
from django.contrib import admin from django.utils.translation import gettext_lazy as _ from django_requests_logger.models import RequestLog class RequestLogAdmin(admin.ModelAdmin): list_display = ( 'url', 'method', 'response_status_code', 'created' ) list_filter = ('method', 'response_status_code...
919
258
# Copyright 2017 Francesco Ceccon # # 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...
4,006
1,216
import requests import bs4 import re import random import codecs import os from discord.ext import commands from discord.ext.commands import BucketType from cogs.utils import checks path_qaz = os.path.join(os.getcwd(), 'files', 'qaz.txt') path_riko = os.path.join(os.getcwd(), 'files', 'riko_meme') nsfw...
5,662
1,982
# keys file is not included in repository import keys ROOT = "http://api.cubesensors.com" AUTH = "%s/auth" % ROOT RES = "%s/v1" % ROOT logger_name = "cubesensors_parser" # Define if should use event hub or insert data straight to db use_event_hub = False # CubeSensors config consumer_key = keys.cube_consumer_key co...
803
289
bug = r"""\ =, .= =.| ,---. |.= =.| "-(:::::)-" |.= \\__/`-.|.-'\__// `-| .::| .::|-' Pillendreher _|`-._|_.-'|_ (Scarabaeus sacer) /.-| | .::|-.\ // ,| .::|::::|. \\ || //\::::|::' /\\ || /'\|| `.__|__.' ||/'\ ^ \\ //...
375
165
""" <Program Name> tooldb.py <Author> Lukas Puehringer <lukas.puehringer@nyu.edu> <Started> June 12, 2017 <Copyright> See LICENSE for licensing information. <Purpose> A basic collection of software supply chain tools in four categories - vcs (version control systems) - building - qa (quality assu...
11,092
4,670
from operations.operation import Operation class Constant(Operation): """ Class to represent a constant """ TAG = 'default' __slots__ = 'value' def __init__(self, value = None): self.value = value def __hash__(self): return hash(self.value) def __call__(self): ...
811
222
# coding=utf-8 """ @author: magician @date: 2018/9/13 """ import datetime as dt from marshmallow import Schema, fields, pprint class User(object): """ User """ def __init__(self, name, email): self.name = name self.email = email self.created_at = dt.datetime.now() sel...
3,587
1,224
import random import click import numpy as np import rasterio from rasterio.transform import from_origin from rastervision.core.box import Box from rastervision.data import (RasterioCRSTransformer, ObjectDetectionLabels, ObjectDetectionGeoJSONStore) from rastervision.core.class_map impo...
3,906
1,269
from lightdict import HanziDict hanzi_dic = HanziDict(r'D:\Data\NLP\corpus\words\hanzi.csv') print('和' in hanzi_dic) x = hanzi_dic['哈'] print(x)
148
69
from bs4 import Tag __all__ = ["CustomHtmlTag", "Attrs", "PartialAttrs"] ######## General utility classes for tags and attrs class CustomHtmlTag(Tag): "Base class defining as_str for a bs4.Tag (may be overridden)" def as_str(self): return str(self)#.prettify() class Attrs(dict): "For pas...
883
283
""" WSGI config for pycess project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pycess.settings") from django.core.wsg...
573
197
from functools import reduce games = int(input()) for game in range(games): number_of_piles = int(input()) pile = list(map(int, input().rstrip().split())) result = reduce((lambda x, y: x ^ y), pile) # result = len(pile) % 2 [wont work on test case 2] print('Second' if result == 0 else 'First')...
321
118
def print_name(): print("My name is Gunarakulan")
54
23
import unittest from flows.statestore.django_store import StateStore from flows.statestore.tests.utils import store_state_works class DjangoStateStoreTest(unittest.TestCase): def test_django_store_state(self): store = StateStore() store_state_works(self, store)
294
86
import numpy as np import torch.nn as nn from torch import Tensor, from_numpy from unittest import TestCase from ezyrb import ANN np.random.seed(17) def get_xy(): npts = 20 dinput = 4 inp = np.random.uniform(-1, 1, size=(npts, dinput)) out = np.array([ np.sin(inp[:, 0]) + np.sin(inp[:, 1]**2...
4,238
1,719
import os.path _PATH_PREFIX = os.path.dirname(os.path.realpath(__file__)) _TEMPLATE_PATH = os.path.join(_PATH_PREFIX, 'tmpl') _TEMPLATE_EXT = '.jinja' _EPUB_SKELETON_PATH = os.path.join(_PATH_PREFIX, 'epub') _BASIC_CH_PAR_STYLE = 'par-indent' _FIRST_CH_PAR_STYLE = 'texttop' _DROP_CAP_STYLE = 'dropcap' _CLEAR_STYLE...
380
193