text
string
size
int64
token_count
int64
from crossingClass import * from joinClass import * from strandClass import * from componentClass import * class Kirby: def __init__(self,crossings,joins): self.crossings=crossings self.joins=joins strands=[] #makes list of strands for c in crossings: for i in range(4): ...
21,926
8,604
# Generated by Django 2.0.3 on 2018-03-26 01:17 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('projects', '0016_auto_20180325_2116'), ] operations = [ migrations.AddField( model_name='project_status', name='isVa...
401
142
# PROBLEM # # Assume s is a string of lower case characters. # # Write a program that prints the longest substring of s in which the letters # occur in alphabetical order. For example, if s = 'azcbobobegghakl', then your # program should print: # # 'Longest substring in alphabetical order is: beggh' # # In case of ti...
1,177
348
mandatory = \ { 'article' : ['ENTRYTYPE', 'ID', 'author', 'title', 'journal', 'year', 'volume'], 'book' : ['ENTRYTYPE', 'ID', 'title', 'publisher', 'year'], 'booklet' : ['ENTRYTYPE', 'ID', 'title', 'year'], 'conference' : ['ENTRYTYPE', 'ID', 'author', 'title', 'booktitle', 'publisher', 'year'], 'inbook' : ['...
992
400
from __future__ import print_function import itertools import sys, os import inspect import numpy as np from joblib import load as joblib_load from .resultsManager import ResultsManager #from .classifiers.randomForest import trainMethod, predictMethod from .classifiers.xgBoost import trainMethod, predictMethod def ...
6,809
2,041
# Copyright (c) 2017 Hitachi Data Systems, 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 # # U...
7,289
2,491
"""Author: Trinity Core Team MIT License Copyright (c) 2018 Trinity 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,...
6,614
2,185
from .startpos import StartPos, StartPosCumWeightOnly
54
16
# # Copyright 2016 The BigDL 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 ...
8,342
2,537
# --------------------------------------------------------------------------------- # QKeithleySweep -> QVisaApplication # Copyright (C) 2019 Michael Winters # github: https://github.com/mesoic # email: mesoic@protonmail.com # --------------------------------------------------------------------------------- # # Per...
42,076
18,074
import proper_forms.fields as f def test_render_attrs(): field = f.Text() attrs = { "id": "text1", "classes": "myclass", "data_id": 1, "checked": True, "ignore": False, } assert ( str(field.render_attrs(**attrs)) == 'class="myclass" data-id="1" i...
1,620
567
#!/usr/bin/python3 # RS-274X per standard Revision 2021.02 import re import copy import numpy as np import vertices # TODO replace all vertices with outline class # Meant for extracting substrings only # Cast to int or float will catch invalid strings RE_INT = r'[+-]?[0-9]+' RE_DEC = r'[+-]?[0-9\.]+?' EXPOSURE_ON...
30,832
9,559
from functools import partial from typing import Callable from typing import TYPE_CHECKING from ...config import Conf from .menu import Menu, MenuEntry, MenuSeparator if TYPE_CHECKING: from ...ui.views.disassembly_view import DisassemblyView class DisasmInsnContextMenu(Menu): """ Dissembly Instruction's ...
3,558
1,092
from requests.exceptions import ConnectionError from panoptes.pocs import __version__ from panoptes.utils.database import PanDB from panoptes.utils.config import client from panoptes.pocs.utils.logger import get_logger from panoptes.pocs import hardware # Global database. PAN_DB_OBJ = None class PanBase(object): ...
2,787
844
"""A wrapper env that handles multiple tasks from different envs. Useful while training multi-task reinforcement learning algorithms. It provides observations augmented with one-hot representation of tasks. """ import random import akro import gym import numpy as np def round_robin_strategy(num_tasks, last_task=No...
12,455
3,761
import cv2 import mediapipe as mp import time import HandTracking_module as htm # initiate time pTime = 0 cTime = 0 cap = cv2.VideoCapture(0) # 0 is internal camera, while 1 is external camera detector = htm.handDetector() while True: success, img = cap.read() img = detector.findHands(img) # get ...
773
312
import numpy as np import pandas as pd import warnings warnings.simplefilter(action='ignore', category=FutureWarning) from sklearn.model_selection import train_test_split, cross_validate from sklearn.preprocessing import OneHotEncoder, StandardScaler, OrdinalEncoder from sklearn.impute import SimpleImputer from sklearn...
2,113
594
from .sac import SAC from .eval import EvalAlgorithm
53
18
import numpy as np np.random.seed(10) import matplotlib.pyplot as plt from mpi4py import MPI # For shared memory deployment: `export OPENBLAS_NUM_THREADS=1` # Method of snapshots def generate_right_vectors(A): ''' A - Snapshot matrix - shape: NxS returns V - truncated right singular vectors ''' ne...
8,110
2,844
import html import json import re from datetime import date from autoslug import AutoSlugField from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.core.validators import MinLengthValidator from django.db.models.aggregates import Count from django.db import models fr...
12,887
4,020
# -------------------------------------------------------- # Tensorflow VCL # Licensed under The MIT License [see LICENSE for details] # Written by Zhi Hou, based on code from Transferable-Interactiveness-Network, Chen Gao, Zheqi he and Xinlei Chen # -------------------------------------------------------- from __futu...
32,670
15,406
# Copyright 2015, 2017 IBM Corp. # # 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 require...
7,738
2,626
# -*- coding: utf-8 -*- import sys, os from time import time def create_dir(folder): ''' creates a folder, if necessary ''' if not os.path.exists(folder): os.makedirs(folder) class TimePrint(object): ''' Simple convenience class to print who long it takes between successive calls to ...
960
299
from dataclasses import dataclass from .t_catch_event import TCatchEvent __NAMESPACE__ = "http://www.omg.org/spec/BPMN/20100524/MODEL" @dataclass class CatchEvent(TCatchEvent): class Meta: name = "catchEvent" namespace = "http://www.omg.org/spec/BPMN/20100524/MODEL"
290
118
import random from plugin import plugin ANSWERS = [ "No", "Yes", "You Can Do It!", "I Cant Help You", "Sorry To hear That, But You Must Forget :(", "Keep It Up!", "Nice", "Dont Do It Ever Again", "I Like It, Good Job", "I Am Not Certain", "Too Bad For You, Try To Find Something Else To Do And Enj...
1,305
420
# Copyright (c) 2016 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 applic...
3,204
983
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals import json import uuid import sys # import plugins PLUGIN_PATHS = ['plugins'] PLUGINS = ['assets'] AUTHOR = 'MITRE' SITENAME = 'ATT&CK' SITEURL = '' PATH = 'content' TIMEZONE = 'America/New_York' DEFAULT_LANG = 'en' THEME = '...
1,342
490
import argparse from ucsmsdk.ucshandle import UcsHandle from ucsmsdk.mometa.vnic.VnicEtherIf import VnicEtherIf from ucsmsdk.mometa.fabric.FabricVlan import FabricVlan parser = argparse.ArgumentParser() parser.add_argument('ucsm_ip') parser.add_argument('username') parser.add_argument('password') parser.add_argument('...
1,810
654
# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT # All rights reserved. This work is under a BSD license, see LICENSE.TXT. from pytest import raises from jenkinsflow.flow import serial, parallel, FailedChildJobException, FailedChildJobsException, Propagation, BuildResult from .framework import api_selec...
9,529
3,652
# Copyright 1997 - 2018 by IXIA Keysight # # 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, p...
3,458
1,228
# This file is part of Radicale Server - Calendar Server # Copyright © 2008-2017 Guillaume Ayoub # Copyright © 2008 Nicolas Kandel # Copyright © 2008 Pascal Halter # Copyright © 2017-2019 Unrud <unrud@outlook.com> # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU G...
17,678
4,454
class ParkingLot: def __init__(self, username, latitude, longitude, totalSpace, costHour): self.username = username self.latitude = latitude self.longitude = longitude self.totalSpace = totalSpace self.availableSpace = totalSpace self.costHour = costHour def getS...
574
156
class AnalyticalModelStick(AnalyticalModel,IDisposable): """ An element that represents a stick in the structural analytical model. Could be one of beam,brace or column type. """ def Dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def GetAlignmentMethod(self,selector): """ GetA...
10,105
3,242
import torch from torch import nn from net.init_net import xavier_init from net.basic_cnn import DWConvBnReluPool """ DW-DW-PW """ class Head(nn.Module): def __init__(self,reg_max = 8, #defalut =8个bbox,用于分布, general focal loss format inChannels = 96, # clsOutChannels = 7): ...
1,773
648
#!/usr/bin/env python import urllib import sys import json from mwlib import parser from mwlib.refine import compat if __name__ == "__main__": params = urllib.urlencode({ "format": "json", "action": "query", "prop": "revisions", "rvprop": "content", "titles": "ISO_3166-1", "rvsection": "4", }) wc = urll...
1,115
465
from .platformBase import PlatformBase from django.http import HttpResponse, JsonResponse from ECC_main.baseRequest import BaseRequest import ECC_main.settings import threading import requests class Slack(PlatformBase): def slash_command(request, func): token = request.POST['token'] if ECC_m...
3,058
866
"""" Crie uma Fazenda de Bichinhos instanciando vários objetos bichinho e mantendo o controle deles através de uma lista. Imite o funcionamento do programa básico, mas ao invés de exigis que o usuário tome conta de um único bichinho, exija que ele tome conta da fazenda inteira. Cada opção do menu deveria permitir que o...
598
195
''' THis is the main training code. ''' import os os.environ["CUDA_VISIBLE_DEVICES"] = "0" # set GPU id at the very begining import argparse import random import math import numpy as np import torch import torch.nn.parallel import torch.optim as optim import torch.utils.data import torch.nn.functional as F from torch.m...
10,468
3,197
import math, gzip peakfile = "{{peakfile}}" genefile = "{{genefile}}" arg_inst = {{args.signal | repr}} arg_gf = "{{args.genefmt}}" arg_pf = "{{args.peakfmt}}" arg_wd = int({{args.window | repr}}) d0 = arg_wd / 2 assert (isinstance(arg_inst, bool)) assert (arg_gf in ['ucsc', 'bed', 'ucsc+gz', 'bed+gz']) as...
3,070
1,376
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('library', '0011_auto_20150706_0957'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ...
1,549
468
# Copyright 2011 Gregory Szorc # # 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 w...
58,968
19,312
import os import numpy as np import scipy.io import tensorflow as tf from sklearn.metrics import mean_absolute_error, mean_squared_error os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' def autoimpute(data: str, debug: bool = True, debug_display_step: int = 1, hidden_units: int = 2000, lambda_val: int = 1, initial_learning...
6,303
2,463
""" """ import began import glob import os import tensorflow as tf FLAGS = tf.app.flags.FLAGS def sanity_check(): """ """ if not os.path.isdir(FLAGS.portraits_dir_path): raise Exception('invalid portraits directory') def build_dataset_reader(): """ """ paths_png_wildcards = os.path...
6,358
2,189
import doctest from nose.tools import assert_equal, assert_true from corehq.apps.fixtures.models import ( FieldList, FixtureDataItem, FixtureItemField, ) from custom.abt.reports import fixture_utils from custom.abt.reports.fixture_utils import ( dict_values_in, fixture_data_item_to_dict, ) def t...
2,771
828
from model.contact import Contact import random def test_edit_contact(app, db, check_ui): app.open_home_page() if app.contact.count() == 0: app.contact.create(Contact(firstname="Contact", lastname="", nickname="", address="", company="", home="", ...
1,223
383
lst1=list() lst1.append('K') lst1.append('A') lst2=['U', 'S', 'H', 'I', 'K'] print(lst1+lst2) print(lst2[0] +lst2[1]+lst1[1]) for i in lst1+lst2: print(i)
159
89
import os, sys sys.path.append(os.getcwd()) import time import numpy as np import tensorflow as tf import tflib as lib import tflib.ops.linear import tflib.ops.conv2d import tflib.ops.batchnorm import tflib.ops.deconv2d import tflib.save_images import tflib.plot import tflib.flow_handler as fh import tflib.SINTELdata...
17,825
7,229
import cv2 # Read the original image img = cv2.imread('../input/LennaGrey.png', 1) # Display original image cv2.imshow('Original', img) cv2.waitKey(0) # Convert to graycsale img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # Blur the image for better edge detection img_blur = cv2.GaussianBlur(img_gray, (3,3), 0) # S...
872
394
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations from dataclasses import dataclass from pants.engine.rules import collect_rules from pants.engine.target import ( COMMON_TARGET_FIELDS, Dependen...
1,389
434
import struct import uasyncio from mdns_client.constants import REPEAT_TYPE_FLAG, TYPE_CNAME, TYPE_MX, TYPE_NS, TYPE_PTR, TYPE_SOA, TYPE_SRV def dotted_ip_to_bytes(ip: str) -> bytes: """ Convert a dotted IPv4 address string into four bytes, with some sanity checks """ ip_ints = [int(i) for i in ...
4,462
1,524
""" @author: Maneesh D @date: 11-Jul-17 @intepreter: Python 3.6 Worst Case Analysis: Selection Sort -> O(n^2) """ from timeit import Timer, default_timer from random import shuffle ARR = list() def selection_sort(data): """Selection sort implementation""" for i in range(len(data)): min_pos = i ...
1,029
375
# Generated by Django 3.2 on 2021-05-05 12:48 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('image_repo', '0001_initial'), ] operations = [ migrations.AlterField( model_name='image', name='colors', f...
917
274
""" Ising model one-shot dynamics simulation. From C. Daniel Freeman (2016 http://arxiv.org/abs/1603.05005) """ import logging import math import gym from gym import spaces from gym.utils import seeding import numpy as np #import isingutils.py import random from random import choice import copy import sys from compil...
21,375
8,992
# -*- coding: utf-8 -*- """ Created on Sat Jul 20 12:07:57 2019 @author: johnmount """ from abc import ABC import math import pprint import warnings import numpy import pandas import vtreat.util import vtreat.transform def ready_data_frame(d): orig_type = type(d) if orig_type == numpy.ndarray: d =...
41,940
13,687
from __future__ import unicode_literals from .responses import MotoAPIResponse url_bases = ["https?://motoapi.amazonaws.com"] response_instance = MotoAPIResponse() url_paths = { "{0}/resqs-api/$": response_instance.dashboard, "{0}/resqs-api/data.json": response_instance.model_data, "{0}/resqs-api/reset":...
428
150
import anydbm, os.path, time, bsddb, sys class MessageTracker: def __init__(self, tracker_file): flag = (os.path.exists(tracker_file) and "w") or "c" #self.tracker = anydbm.open(tracker_file, flag) self.tracker = bsddb.hashopen(tracker_file, flag) def close(self): self....
1,305
453
import random import torch import pandas as pd import numpy as np from glove_model import get_model from intent_initializer import read_all_intents, read_all_responses from GloVe_helper import GloVeLoader PATH = './config/' BOT_NAME = 'Bavardez' def load_bot(): model_details = torch.load(PATH+'model_details_GloVe.pt...
1,353
517
import pytest import requests from tests.coworks.biz.biz_ms import BizMS from tests.coworks.tech.test_ms import SimpleMS class TestClass: def atest_ms(self, local_server_factory): tech = SimpleMS() with pytest.raises(Exception) as pytest_wrapped_e: @tech.schedule('rate(1 hour)', nam...
984
324
from typing import List, cast import numpy as np from ..dataset import Episode, Transition from .base import TransitionIterator class RandomIterator(TransitionIterator): _n_samples_per_epoch: int _index: int def __init__( self, episodes: List[Episode], batch_size: int, ...
1,030
336
import logging import os def initLogger() -> object: """ Initialize the logger. """ logger_level = logging.INFO if 'APP_ENV' in os.environ: if os.environ['APP_ENV'] == 'dev': logger_level = logging.DEBUG logging.basicConfig(level=logger_level, form...
420
128
class Photo(object): def __init__(self, photo_id: int, orientation: str, number_of_tags: int, tags: set): self.id = photo_id self.orientation = orientation self.number_of_tags = number_of_tags self.tags = tags self.is_vertical = orientation == 'V' self.is_horizontal =...
392
120
# -*- coding: utf-8 -*- from s3pathlib import S3Path class Config: aws_profile = "aws_data_lab_sanhe" aws_region = "us-east-2" # where you store data, artifacts bucket = "aws-data-lab-sanhe-for-everything-us-east-2" # s3 folder for data lake dataset_prefix = "poc/2022-02-26-learn_big_data_on_...
713
263
""" This file contains tests for plotter_utils.py. @author: Nathanael Jöhrmann """ import matplotlib.pyplot as plt import numpy as np import pytest from matplotlib.figure import Figure from gdef_reporter.plotter_styles import get_plotter_style_histogram from gdef_reporter.plotter_utils import plot_to_ax, create_plot,...
15,091
5,252
from typing import Tuple from rest_framework.test import APITestCase from eahub.profiles.models import Profile, ProfileTag, ProfileTagTypeEnum from eahub.tests.cases import EAHubTestCase class TagsApiTestCase(EAHubTestCase, APITestCase): def test_creation(self): profile, _, _, _ = self._generate_tags() ...
3,590
1,172
# addition will takes place after multiplication and addition num1 = 1 + 4 * 3 / 2; # same as 5 * 3 /2 num2 = (1 + 4) * 3 / 2; # same as 1+12/2 num3 = 1 + (4 * 3) / 2; print("python follow precedence rules"); # this should produce 7.5 print(num1); print(num2); print(num3);
279
124
from .body import Body from .camera import Camera from .base_scene import BaseScene from .caching import BodyCache, TextureCache from .textures import apply_random_textures
173
46
import os import sys import configparser class Config: def __init__(self): pass # # a simple function to read an array of configuration files into a config object # def read_config(self, cfg_files): if(cfg_files != None): config = configparser.RawConfigParser() #...
2,186
564
from torch import nn loss_functions = { "MSE": nn.MSELoss, "MSEPenalty": nn.MSELoss, "L1": nn.L1Loss, "CrossEntropy": nn.CrossEntropyLoss, "CTC": nn.CTCLoss, "NLL": nn.NLLLoss, "PoissonNLL": nn.PoissonNLLLoss, "KLDiv": nn.KLDivLoss, "BCE": nn.BCELoss, "BCEWithLogits": nn.BCEWith...
726
350
from sys import argv script, filename=argv txt = open(filename) print(f"Here's your file {filename}:") print(txt.read()) print("Type the filename again:") file_again = input("> ") txt_again = open (file_again) print(txt_again.read())
234
83
""" * ******************************************************* * Copyright (c) VMware, Inc. 2016-2018. All Rights Reserved. * SPDX-License-Identifier: MIT * ******************************************************* * * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, WHET...
4,042
1,298
# chessboard.py # Copyright 2008 Roger Marsh # Licence: See LICENCE (BSD licence) """Demonstrate chess board class and methods to draw position on board.""" if __name__ == "__main__": import tkinter from pgn_read.core.piece import Piece from pgn_read.core.constants import ( FEN_WHITE_KING, ...
2,622
1,149
class Fruit: def __init__(self,name,parents): self.name = name self.parents = parents self.children = [] self.family = [] self.siblings = [] self.node = None ## Link to node object in graph def find_children(self,basket): # basket is a list of Fruit objects for fruit in basket: if ...
731
231
# %% """ Let's get familiar with Grouping and Aggregating. Aggregating means combining multiple pieces of data into a single result. Mean, median or the mod are aggregating functions. """ import pandas as pd # %% df = pd.read_csv( "developer_survey_2019/survey_results_public.csv", index_col="Respondent")...
3,694
1,383
import numpy as np import pandas as pd import re import warnings import copy import cantera as ct def run_simulation(solution, times, conditions=None, condition_type = 'adiabatic-constant-volume', output_species = True, output_reactions = True, ...
13,077
3,490
import json from collections import defaultdict SEGMENTS = ['workings', 'shinies', 'controls', 'fun'] REVIEWERS = ['venn', 'jordan', 'pedro'] def iter_charis(): with open('charis.json') as charis_file: charis = json.load(charis_file) for chari in charis: if not chari['name']: co...
4,495
1,480
import numpy as np from sklearn.model_selection import train_test_split from sklearn.preprocessing import minmax_scale import matplotlib.pyplot as plt from model.loss import CategoricalCrossEntropy from model.layers.dense import Dense from model.layers.relu import LeakyReLU from model.layers.softmax import Softmax fro...
2,970
1,114
# Copyright (C) 2019 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
3,156
1,074
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-09-10 16:15 from __future__ import unicode_literals from django.db import migrations, models import django_extensions.db.fields import items.models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ ...
1,164
333
from PyQt5.QtCore import Qt from PyQt5.QtCore import QSettings from PyQt5.QtCore import QPoint, QSize from PyQt5.QtWidgets import QGraphicsScene from PyQt5.QtWidgets import QMainWindow from PyQt5.QtWidgets import QGraphicsItem from PyQt5.QtWidgets import QAction, QApplication, QWidget from cadnano import app from cad...
11,380
3,352
# MIT LICENSE # # Copyright 1997 - 2020 by IXIA Keysight # # 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,...
42,245
12,206
""" Implementation of Multi-Scale Spectral Loss as described in DDSP, which is originally suggested in NSF (Wang et al., 2019) """ import torch import torch.nn as nn import torchaudio import torch.nn.functional as F class SSSLoss(nn.Module): """ Single-scale Spectral Loss. """ def __init__(self, n...
1,970
773
# Copyright (c) 2020-2021, NVIDIA CORPORATION. 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 a...
8,889
2,631
# Copyright 2015 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 by applicable law or ...
5,490
1,662
# -*- coding: utf-8 -*- """ Non-collapsed samplers. """ import numpy as np from .generic import (GenericGibbsSampler, GenericRGMSSampler, GenericSAMSSampler, GenericSliceSampler) from ..models import (CollapsedConjugateGaussianMixture, ConjugateGaussianMixture, NonconjugateGaussianMixture) from ..mod...
4,584
1,304
from django.contrib import admin from django.urls import path, include urlpatterns = [ path('accounts/', include('django.contrib.auth.urls')), path('', include('home.urls')), path('admin/', admin.site.urls), path('registration/medic', include('medic.urls')), path('registration/patient', include('pa...
393
124
''' EvolvePy's integrations with other modules. '''
55
18
import requests import re url=input("Enter Url [ex: example.com]: ") def getSubDomain(url): url=url.replace("www.","").replace("https://","").replace("http://","") pattern = "[\w]{1,256}\.[a-zA-Z0-9()]{1,6}" _l = re.compile(pattern) if _l.match(url): response = requests.get(f"https://sonar.omn...
587
208
file = open("text.txt", "r") file2 = open("text2.txt", "w") for data in file: file2.write(data) file.close() file2.close()
129
55
from .torch2trt import * from .converters import * import tensorrt as trt def load_plugins(): import os import ctypes ctypes.CDLL(os.path.join(os.path.dirname(__file__), 'libtorch2trt.so')) registry = trt.get_plugin_registry() torch2trt_creators = [c for c in registry.plugin_creator_list if c...
532
204
import os from lib.EDICommunicator import EDICommunicator from lib.EDIParser import EDIParser import lib.cli.tools as tools from types import SimpleNamespace def set_args(subparsers): parser = subparsers.add_parser('com', description='communication between EDI systems') parser.add_argument('--send-to') par...
4,614
1,479
animals = ['cat', 'dog', 'pig'] for animal in animals : print (animal + 'would make a great pet.') print ('All of those animals would makea great pet')
154
50
from django.urls import path from .views import start_bot, end_bot urlpatterns = [ path('startbot/', start_bot), path('endbot/', end_bot), ]
145
52
import performance import dislib as ds from dislib.classification import CascadeSVM def main(): x_ij, y_ij = ds.load_svmlight_file( "/fefs/scratch/bsc19/bsc19029/PERFORMANCE/datasets/train", block_size=(5000, 22), n_features=22, store_sparse=True) csvm = CascadeSVM(c=10000, gamma=0.01) ...
420
185
"""Exceptions of the library""" class PyConnectError(Exception): """Base class for all exceptions in py_connect.""" class InvalidPowerCombination(PyConnectError): """Connection of different power pins.""" class MaxConnectionsError(PyConnectError): """Interface has exceeded it's max connections limit."...
1,115
302
# Generated by Django 3.1.7 on 2021-03-15 22:07 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('homepage', '0006_carbohydrate_glucose_insulin_recordingcategory'), ] operations = [ migrations.RenameField( model_name='carbohyd...
1,151
346
# -*- coding: utf-8 -*- """ Created on Mar 11, 2012 @author: moloch Copyright 2012 Root the Box 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/licen...
1,826
545
import json import numpy as np import torch import torch.nn as nn from torch.utils.data import Dataset, DataLoader from model import NeuralNetwork from nltk_utils import stem, tokenize, bag_of_words with open('./data/data.json', 'r') as f: data = json.load(f) all_words = [] tags = [] xy = [] for intent...
2,544
956
def voto(num): from datetime import date anoatual = date.today().year idade = anoatual - num if idade < 16: return f"Com {idade} anos: NÃO VOTA" elif 16 <= idade < 18 or idade > 65: return f'Com {idade} anos: VOTO OPCIONAL' else: return f"Com {idade} anos: VOTO OBRIGATORI...
411
167
import random import libtcodpy as libtcod GRAY_PALETTE = [ # libtcod.Color(242, 242, 242), libtcod.Color(204, 204, 204), libtcod.Color(165, 165, 165), libtcod.Color(127, 127, 127), libtcod.Color(89, 89, 89), ] class Tile: """ A tile on a map. It may or may not be blocked, and may or may ...
4,289
1,529
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. from collections import defaultdict from typing import Dict, List, Optional, Tuple, Union import numpy as np from mip import BINARY, CBC, MINIMIZE, Model, xsum from mrnet.core.mol_entry import MoleculeEntry _...
16,717
5,229