text
string
size
int64
token_count
int64
from datetime import datetime from django.db import models from django.db.models import permalink from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site from django.test import TestCase as DjangoTestCase from django_comments_xtd.models import (XtdComment, ...
20,515
6,124
""" This file contains all the version one routes """ # Third party imports from flask import Blueprint, request from flask_restplus import Api, Resource, fields # Local application imports from .views.products_views import v1 as pro_routes from .views.sales_views import v1 as sales_routes from .views.stores_views i...
900
285
from pathlib import Path import jsonschema import pydantic import pytest from nomenclature.processor.region import ( ModelMappingCollisionError, RegionAggregationMapping, RegionProcessor, ) from conftest import TEST_DATA_DIR TEST_FOLDER_REGION_MAPPING = TEST_DATA_DIR / "region_aggregation" def test_map...
5,605
1,687
#!/usr/bin/env python # #3> <> prov:specializationOf <https://github.com/timrdf/csv2rdf4lod-automation/blob/master/bin/util/ckan-datasets-in-group.py>; #3> prov:wasDerivedFrom <https://raw.github.com/timrdf/DataFAQs/master/packages/faqt.python/faqt/faqt.py>, #3> <https://github.com/timrdf/...
828
328
import FWCore.ParameterSet.Config as cms ecalExclusiveTrigFilter = cms.EDFilter("EcalExclusiveTrigFilter", # Global trigger tag l1GlobalReadoutRecord = cms.string("gtDigis") )
191
68
import bpy import os import json import numpy as np from decimal import Decimal from mathutils import Vector, Matrix import argparse import numpy as np import sys sys.path.append(os.path.dirname(__file__)) sys.path.append(os.path.dirname(__file__)+'/tools') from tools.utils import * from tools.blender_interface import...
2,300
877
#!/usr/bin/python import unittest import json import base64 from mock import patch import api class UserTests(unittest.TestCase): def setUp(self): api.app.testing = True self.app = api.app.test_client() def test_user_creation(self): with patch('models.db.session'): respons...
1,281
360
import numpy as np def clustering_v1(experiment, num_clusters=20): from scipy.cluster.hierarchy import dendrogram, linkage, fcluster import scipy.spatial.distance as ssd # skip the paths SKIP = ['UNID', 'ANID', 'STID', 'ANUN', 'STUN', 'STAN', 'Mallows', 'Urn', 'I...
2,717
1,010
import math grid = [] with open('input-day15.txt') as file: for line in file: line = line.rstrip() grid.append([int(s) for s in line]) n = len(grid) costs = [[math.inf] * n for _ in range(n)] costs[0][0] = 0 queue = [(0, 0)] while len(queue) > 0: x1, y1 = queue.pop(0) for dx, dy in [(1, 0), (0, 1), (-1,...
561
259
# -*- coding: utf-8 -*- ''' Created on 16.11.2014 @author: Simon Gwerder ''' from utilities.configloader import ConfigLoader from rdfgraph import RDFGraph class RelatedTerm: rdfGraph = RDFGraph() cl = ConfigLoader() termSchemeName = cl.getThesaurusString('TERM_SCHEME_NAME') termSchemeTitle = cl.g...
2,930
1,009
arr: list = [54,26,93,17,77,31,44,55,20] def merge_sort(arr: list): result: list = helper(arr, 0, len(arr) - 1) for i in range(len(arr)): arr[i] = result[i] def helper(arr: list, start: int, end: int) -> list: if start > end: return [] elif start == end: return [arr[start...
1,217
429
#!/usr/bin/python3 # ****************************************************************************** # Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. # licensed under the Mulan PSL v2. # You can use this software according to the terms and conditions of the Mulan PSL v2. # You may obtain a c...
3,406
1,167
from mean_var_std import * calculate([0,1,2,3,4,5,6,7,8])
58
32
from datetime import datetime from decimal import Decimal from perfsize.perfsize import ( lt, lte, gt, gte, eq, neq, Condition, Result, Run, Config, Plan, StepManager, EnvironmentManager, LoadManager, ResultManager, Reporter, Workflow, ) from perfsize....
2,416
713
from src import dmf,mzs,utils,sfx from pathlib import Path import argparse def print_info(mlm_sdata): if len(mlm_sdata.songs) <= 0: return for i in range(len(mlm_sdata.songs[0].channels)): channel = mlm_sdata.songs[0].channels[i] print("\n================[ {0:01X} ]================".format(i)) if channel == N...
3,904
1,743
# Using the Requests library, you can make a POST request by using the requests.post() method. You aren't just GETting data with a POST - you can pass your own data into the request as well, like so: # # requests.post("http://placekitten.com/", data="myDataToPost") # We're going to make the same request as the one show...
1,169
339
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import time from functools import partial from .linear import MLP, LogReg from .pointnet import PointNet from .pointnet2 import PointNet2SSG from .pointnet3 import PointNet3SSG from .dgcnn import DGCNN # from .masked_co...
2,630
882
import golpy.controller.controller as controller import golpy.view.view as view import golpy.model.gamemodel as model import golpy.eventmanager.eventmanager as eventm import golpy.config as config import log.log as log import argparse def pass_args(): """ Takes Argument from the command line and returns an Argum...
1,938
542
import unittest import orca from setup.settings import * from pandas.util.testing import * class SeriesStrTest(unittest.TestCase): def setUp(self): self.PRECISION = 5 @classmethod def setUpClass(cls): # connect to a DolphinDB server orca.connect(HOST, PORT, "admin", "123456") @p...
2,899
1,079
ITERATION_NUM = 10 MAX_POPULATION = 500 CROSSOVER_RATE = 1 MUTATION_RATE = 1 supplies = { 'S1': 20, 'S2': 15, 'S3': 40 } demands = { 'D1': 20, 'D2': 30, 'D3': 25 } cost = [[2, 3, 1], [5, 4, 8], [5, 6, 8] ]
278
170
from django.apps import AppConfig class ConnectConfig(AppConfig): name = 'Connect'
89
26
from functools import cached_property from .vector3 import Vector3 class Edge: """An edge created by two points.""" def __init__(self, start: Vector3, end: Vector3) -> None: self.start = start self.end = end def __eq__(self, other: object) -> bool: """Return True if this edge is...
914
255
from gps import * import math import time import json import threading gpsd = None poller = None class Poller(threading.Thread): def __init__(self): threading.Thread.__init__(self) global gpsd gpsd = gps(mode=WATCH_ENABLE|WATCH_NEWSTYLE) self.current_value = None self.run...
1,054
348
import json import random import warnings from typing import Any, Callable, Dict, List, Union, Type, Optional, NoReturn from pydantic import PrivateAttr from vkwave.bots import BotEvent, BotType, EventTypeFilter, UserEvent from vkwave.bots.core import BaseFilter from vkwave.bots.core.dispatching.filters.builtin impor...
31,133
9,567
""" Created on 7 Nov 2016 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) example: 25 June 2016 17:44:28 BST: {"datum":{"conc":92,"dens":184},"measured-at":"2016-06-25T17:41:01+01:00"} """ from collections import OrderedDict from scs_core.data.json import JSONable # ------------------------------------...
1,337
340
# # PySNMP MIB module CISCO-FC-PM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FC-PM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:40:52 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
24,154
11,094
import django.contrib.gis.db.models as gis_models from django.apps import apps from django.db import models, connection from django.urls import reverse from distributions.models import TemporalDistribution, Timestep from inventories.models import Scenario, InventoryAlgorithm from materials.models import SampleSeries, ...
13,841
3,647
from evaluation import MetricScorer from .formulas import mar, sa, sd, sdar, effect_size, mmre, mdmre, pred25, pred40 from baseline import MARP0 class MAR(MetricScorer): def setConstants(self): self.name = "mar" self.problem = "regression" self.greater_is_better = False self.lo...
4,205
1,441
""" AbaqusGeometry.py For use with Abaqus 6.13-1 (Python 2.6.2). Created by Ozgur Yapar <oyapar@isis.vanderbilt.edu> Robert Boyles <rboyles@isis.vanderbilt.edu> - Includes modules which take care of geometrical operations in the part and assembly level. """ import re import mat...
8,212
2,295
import climate import glob import gzip import io import lmj.cubes import logging import numpy as np import os import pandas as pd import pickle import theanets def compress(source, k, activation, **kwargs): fns = sorted(glob.glob(os.path.join(source, '*', '*_jac.csv.gz'))) logging.info('%s: found %d jacobians...
2,143
800
import json import os import logging from datetime import datetime from django.db.models import Q,Count from django.http import JsonResponse from django.views.generic import View from django.views.decorators.csrf import csrf_exempt from django.utils.decorators import method_decorator from django.conf import settings fr...
21,369
6,077
from django.shortcuts import render from api.models import Comida, Cerveza, Titulo, TipoComida from django.http import Http404 from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import serializers import csv import os class CervezaSerializer(serializers.ModelSer...
5,666
1,772
{ "targets": [ { "target_name": "usb_dev", "sources": [ "usb_dev.cc" ], "include_dirs" : [ "<!(node -e \"require('nan')\")" ], "libraries": [ "-lsetupapi" ] } ] }
232
95
''' table AD contains RS,ADID;table Parkinson contains RS,PDID;table variant contains ADID, PDID insert table variant one way: below two way: by merge ''' import sys ,re import pandas as pd varfil1=r'C:\Users\BAIOMED07\Desktop\AD_Database_20170629.xls' varfil2=r'C:\Users\BAIOMED07\Desktop\parkinson_TOTAL.xls' varfil...
1,011
482
import serial import time ### FUNCTIONS #### #### SERIAL COMMUNICATION #### def arduino_communication(COM="COM5",BAUDRATE=9600,TIMEOUT=1): """ Initalizes connection with Arduino Board """ try: arduino = serial.Serial(COM, BAUDRATE , timeout=TIMEOUT) time.sleep(2) except: ...
390
131
"""Classes and functions used for data visualization""" import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt def plot_correlation_matrix_heat_map(df,label,qty_fields=10): df = pd.concat([df[label],df.drop(label,axis=1)],axis=1) correlation_matrix = df.corr() index =...
3,595
1,247
import unittest import os, sys, inspect, json currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0, parentdir) from lib.file_management.configeditor import ConfigEditor from lib.file_management.file_management_lib import DirMana...
1,828
575
# Generated by Django 3.0.3 on 2020-11-18 06:06 import chemreg.common.utils import chemreg.common.validators import chemreg.compound.models import chemreg.compound.utils from django.conf import settings from django.db import migrations, models import django.db.models.deletion def fwd_create_illdefined_querystructure...
7,390
1,840
''' Twitter Crawler to get tweets and user data ''' import tweepy import json import os import time def get_counts_quantile(tweets): counts = [] for t in tweets: counts.append() def save_tweet(result): """Function to save tweepy result status""" pass def save_user(result_set): """Functi...
3,466
1,144
from irLib.instruments.instrument import instrument from irLib.helpers.schedule import period from irLib.instruments.legs import fixLeg, floatLeg class swap(instrument): def __init__(self, tradeDate, spotLag=period(0, 'day'), position='long', *legs): super().__init__(tradeDate, spotLag, position) ...
2,206
694
# -*- coding: utf-8 -*- # SPDX-License-Identifier: BSD-3-Clause # PEP 563: Postponed Evaluation of Annotations from __future__ import annotations from functools import partial import multiprocessing as mp from typing import Tuple, Union import warnings import numpy as np from sklearn.base import BaseEstimator from s...
21,083
5,907
""" pyvr calibrate. Usage: pyvr calibrate [options] Options: -h, --help -c, --camera <camera> Source of the camera to use for calibration [default: 0] -r, --resolution <res> Input resolution in width and height [default: -1x-1] -n, --n_masks <n_masks> Number of masks to calibrate [de...
11,859
4,074
from .jsonschema_validator import JSONSchemaValidator as jsonschema # noqa from .marshmallow_validator import MarshmallowValidator as marshmallow # noqa
155
48
aliases['cd-'] = 'cd -' aliases['cl'] = 'cd (ls -1Ft | head -1)' aliases['..'] = 'cd ..' aliases['...'] = 'cd ../..' aliases['....'] = 'cd ../../..' aliases['.....'] = 'cd ../../../..' aliases['......'] = 'cd ../../../../..'
227
99
#! /usr/bin/python ''' Class to handle database connections and queries for Dropbox Mirror Bot ''' import sqlite3 class Database(object): def __init__(self, database=":memory:"): self._database = database c = self.cursor() query = '''CREATE TABLE IF NOT EXISTS dropbox_submissions ( ...
1,894
532
import unittest from mock import patch from starter.starter_AdminEmail import starter_AdminEmail from tests.activity.classes_mock import FakeLogger from tests.classes_mock import FakeLayer1 import tests.settings_mock as settings_mock class TestStarterAdminEmail(unittest.TestCase): def setUp(self): self.fa...
796
257
from unittest import TestCase import numpy as np import phi from phi import math from phi.math import channel, batch from phi.math._shape import CHANNEL_DIM, BATCH_DIM, shape_stack, spatial from phi.math._tensors import TensorStack, CollapsedTensor, wrap, tensor, cached from phi.math.backend import Backend BACKENDS ...
15,963
5,555
# Bep Marketplace ELE # Copyright (c) 2016-2021 Kolibri Solutions # License: See LICENSE file or https://github.com/KolibriSolutions/BepMarketplace/blob/master/LICENSE # from django.contrib import admin from django.shortcuts import reverse from django.utils.html import format_html from .models import Track, Broadca...
1,202
395
from datetime import datetime from pytz import timezone from troposphere import Ref, Template, Parameter, GetAZs, Output, Join, GetAtt, autoscaling, ec2, elasticloadbalancing as elb t = Template() t.add_description("Create FireCARES Webserver Load Balancer, Auto-Scaling group and Celery beat VM") base_ami = "ami-7646...
9,025
3,389
# GCD Program from math import gcd # input num1 = int(input('Enter a number: ')) num2 = int(input('Enter another number: ')) # processing & output divisor = 1 upper_limit = min(num1, num2) gcd_answer = 0 #print(num1, 'and', num2, 'share these factors:') print('GCD of', num1, 'and', num2, 'is:') while divisor <= up...
513
199
#!/usr/bin/python import random word_len = 5 alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' output = open('word_count', 'w') words = set() N = 1000*1000 for x in xrange(N): arr = [random.choice(alphabet) for i in range(word_len)] words.add(''.join(arr)) print len(words) for word...
447
196
from django.shortcuts import render from .models import PrivRepNotification,Notification from django.http import JsonResponse, HttpResponseRedirect, HttpResponse def read_All_Notifications(request): notifics = Notification.objects.filter(noti_receiver=request.user).order_by('-date_created') for objs in noti...
728
216
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): ...
1,243
422
import tensorflow as tf import tensorflow.keras as k import numpy as np from load_and_augment import load_and_augment_data from modelconfig import modelconfig from compile_model import compile_model_adam import compile_model if __name__=='__main__': path=r'/content/drive/My Drive/data' testing_path=r'/c...
1,105
392
import os import glob import codecs from typing import List def dirs(root_dit: str) -> List[str]: return next(os.walk(root_dit))[1] def select_directory_from_list(directories: List[str]) -> str: for i in range(0, len(directories)): print("(%d) %s" % (i, directories[i])) while True: try:...
1,548
510
import time from django import forms from django.core.exceptions import ValidationError from .widgets import CaptchaWidget from .settings import DURATION class CaptchaField(forms.MultiValueField): """A field that contains and validates a simple catcha question WARNING: If you use this field directly in y...
2,403
584
# --- # jupyter: # jupytext: # cell_metadata_filter: -all # comment_magics: true # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.11.3 # kernelspec: # display_name: Python 3 (ipykernel) # ...
4,940
1,765
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-01-11 13:45 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migratio...
3,054
892
import pytest import pprint import string import random import os from pyatlas import AtlasClient #from testutils import * @pytest.fixture def public_key(): return "NGKMIHEO" @pytest.fixture def private_key(): return "66bcc7de-b0de-4d8d-9695-ef97637c6895" @pytest.fixture def client(public_key, private_key): r...
1,455
504
# Copyright 2022 The etils 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 wr...
6,036
1,946
from .ifstat import IfStat from .returnstat import ReturnStat from .whilestat import WhileStat from .breakstat import BreakStat from .switchstat import SwitchStat from .casestat import CaseStat from .forstat import ForStat from .continuestat import ContinueStat
262
70
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
2,594
725
from typing import ( Iterable, Mapping, MutableMapping, Optional, Tuple, TypeVar, Union, ) import collections import logging import operator import types from haoda import ir from soda import tensor import soda.visitor _logger = logging.getLogger().getChild(__name__) def shift(obj, offs...
4,192
1,330
from skillmap.skillmap_parser import SkillMapParser def test_parse_toml(): parser = SkillMapParser() skill_map = parser.parse('tests/url_shortener.toml') assert skill_map assert skill_map['skillmap']['name'] == "url shortener" assert skill_map['groups']['webui']['name'] == "web ui" assert skil...
485
156
"""Consec days""" import calendar from pandas.io.sql import read_sql from pyiem.plot.use_agg import plt from pyiem.util import get_autoplot_context, get_dbconn PDICT = {'above': 'Temperature At or Above (AOA) Threshold', 'below': 'Temperature Below Threshold'} PDICT2 = {'high': 'High Temperature', ...
2,923
1,043
"""Resolwe REST API helpers."""
32
11
#!/usr/bin/python # -*- coding: utf-8 -*- from requests.auth import AuthBase class PizzaAuth(AuthBase): """Attaches HTTP Pizza Authentication to the given Request object.""" def __init__(self, username): # setup any auth-related data here. self.username = username def __call__(self, r): ...
422
123
import csv import numpy as np import pickle with open('data (2).csv','r') as f: csv = csv.reader(f) csvlist = [] for i in csv: csvlist.append(i) #6行目から mas = [] for i in range(364): i+=6 a = 0 b = 0 c = 0 date = csvlist[i][0] weather = csvlist[i][1] ...
866
431
import os import test import unittest def tests(): if not os.path.exists("../test_output"): os.makedirs(os.path.join(os.path.dirname(__file__), "../test_output"), exist_ok=True) unittest.main(test) # if __name__ == '__main__': # Datenmodultests tests()
287
111
a=1 for i in range(5): if 'FBI' in input(): print(i+1,end=' ') a=0 if a: print('HE GOT AWAY!')
99
51
import torch from torch import nn import torch.nn.functional as F from ntm.controller import Controller from ntm.memory import Memory from ntm.head import ReadHead, WriteHead class NTM(nn.Module): def __init__(self, vector_length, hidden_size, memory_size, lstm_controller=True): super(NTM, self).__init__(...
1,971
617
# Copyright 2014 Facebook, Inc. # You are hereby granted a non-exclusive, worldwide, royalty-free license to # use, copy, modify, and distribute this software in source code or binary # form for use in connection with the web services and APIs provided by # Facebook. # As with any software that integrates with the Fa...
3,468
1,082
import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer standaloneTrackMonitor = DQMEDAnalyzer('StandaloneTrackMonitor', moduleName = cms.untracked.string("StandaloneTrackMonitor"), folderName = cms.untracked.string("highPurityTracks"), vertexTag ...
1,198
451
import unittest import numpy.testing as nt import numpy as np from spatialmath.spatialvector import * class TestSpatialVector(unittest.TestCase): def test_list_powers(self): x = SpatialVelocity.Empty() self.assertEqual(len(x), 0) x.append(SpatialVelocity([1, 2, 3, 4, 5, 6])) self...
7,266
2,881
# \s Returns a match where the string contains a white space character # \S Returns a match where the string DOES NOT contain a white space character import re s1 = ''' --- slug: python-non-greedy-regexes title: Python non-greedy regexes summary: How to make Python regexes a little less greedy using the `?` modifier....
3,048
968
#coding=utf-8 # Copyright (C) 2016-2018 Alibaba Group Holding Limited # # 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...
3,006
1,036
__version__ = "0.1.0" __author__ = "Kaoru Nishikawa"
53
27
# -*- coding: utf-8 -*- """ Created on Mon Nov 21 18:51:11 2016 @author: brady """ #################### TRAINING #################### # POS DIRS TRAIN_CLEAN = r'C:\Users\brady\GitHub\MinVAD\data\train\positive\clean' TRAIN_0DB = r'C:\Users\brady\GitHub\MinVAD\data\train\positive\0db' TRAIN_5DB = r'C:\Users\brady\GitHu...
1,542
748
#!/usr/bin/env python # Copyright (C) 2017 Udacity Inc. # # This file is part of Robotic Arm: Pick and Place project for Udacity # Robotics nano-degree program # # All Rights Reserved. # Author: Harsh Pandya # import modules import rospy import tf from kuka_arm.srv import * from trajectory_msgs.msg import JointTraje...
6,735
2,549
import os import csv import glob import time import threading from .misc import name2env as ru_name2env from .misc import get_hostname as ru_get_hostname from .misc import get_hostip as ru_get_hostip from .read_json import read_json as ru_read_json # ---------------------------------...
12,205
3,433
import numpy as np import torch from torch.utils.data import Dataset class CBOWDataSet(Dataset): def __init__(self, corpus, pipeline='hier_softmax', nodes_index=None, turns_index=None, vocab_size=None, neg_samples=None, ...
5,214
1,541
peso1 = float(input('Digite o peso do primeiro animal... ')) peso2 = float(input('Digite o peso do segundo animal... ')) if peso1 > peso2: print('O primeiro animal é mais pesado') elif peso1 < peso2: print('O segundo animal é mais pesado') else: print('Os dois animais têm o mesmo peso')
301
104
# uniform_distribution # used to describe the probability where every event has equal chances of # occuring """ E.g. Generation of random numbers. It has three parameters. a - lower bound - default 0.0 b - upper bound - default 1.0 size = The shape of the returned array """ # 2x3 uniform distribution...
607
204
from tornado.process import Subprocess from tornado import gen from subprocess import PIPE from delivery.models.execution import ExecutionResult, Execution class ExternalProgramService(object): """ A service for running external programs """ @staticmethod def run(cmd): """ Run...
1,563
432
""" Datos de entrada nota_examen_ matematicas-->nem-->float nota_ta1_matematicas-->ntm--> nota_ta2_matematicas-->nttm--> nota_ta3_matematicas-->ntttm--> nota_examen_fisica-->nef-->float nota_ta1_fisica-->ntf-->float nota_ta2_fisica-->nttf-->float nota_examen_quimica-->neq-->float nota_ta1_quimica-->ntq-->float nota_ta2...
1,577
699
import os import numpy as np from collections import namedtuple from .chemparser import chemparse from .xray import mu_elam, atomic_mass from .utils import get_homedir _materials = None Material = namedtuple('Material', ('formula', 'density', 'name', 'categories')) def get_user_materialsfile(): """return name fo...
9,667
2,898
#!/usr/bin/env python3 ''' Server script for simple client/server example Copyright (C) Simon D. Levy 2021 MIT License ''' from threading import Thread from time import sleep import socket from struct import unpack from header import ADDR, PORT def comms(data): ''' Communications thread ''' # Conn...
1,069
366
# -*- coding: utf8 -*- from django.shortcuts import render # Create your views here. def index(request): return render(request, 'about.html')
151
52
import numpy as np from numpy.polynomial import legendre from smuthi import spherical_functions as sf import bessel_functions as bf ##Codebase for computing the T-matrix and its derivative with respect to height and radius for a cylindrical scatterer # with circular cross-section in spherical coordinates. # # inputs: ...
15,126
6,380
# -*- coding: utf8 -*- from __future__ import division, absolute_import, print_function import os import sys import datetime as dt import dvik_print as dvp if __name__ == '__main__': print(sys.version) O = { 'lista': ['el1', 'el2', 1, 2, 3, 4, None, False], 'zbiór': {1, 2, 1, 2, 'a', 'a', 'b...
982
432
"""Authors: Cody Baker and Ben Dichter.""" from abc import ABC from pathlib import Path import spikeextractors as se import numpy as np from pynwb import NWBFile, NWBHDF5IO from pynwb.ecephys import SpikeEventSeries from jsonschema import validate from ...basedatainterface import BaseDataInterface from ...utils.json_sc...
6,200
1,655
"""The libfuzzertest.TestCase for C++ libfuzzer tests.""" import datetime import os from buildscripts.resmokelib import core from buildscripts.resmokelib import utils from buildscripts.resmokelib.testing.fixtures import interface as fixture_interface from buildscripts.resmokelib.testing.testcases import interface c...
1,711
561
class RiskManagerError(Exception): """Base application error class.""" def __init__(self, msg): self.msg = msg class RiskDoesNotExist(RiskManagerError): def __init__(self): super(RiskDoesNotExist, self).__init__( "No risk record found for the provided ID. Are you sure you hav...
509
147
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2020 Ryan L. Collins <rlcollins@g.harvard.edu> # and the Talkowski Laboratory # Distributed under terms of the MIT license. """ Parse simple SEA super-enhancer BED by cell types """ import argparse import csv import subprocess def main(): """ ...
1,278
407
""" python>3 """ import os.path import re from pathlib import Path VERSION = 7 BASE = r""" set cut_paste_input [stack 0] version 12.2 v5 push $cut_paste_input Group { name imageCropDivide tile_color 0x5c3d84ff note_font_size 25 note_font_color 0xffffffff selected true xpos 411 ypos -125 addUserKnob {20 User} ...
2,461
996
#!/usr/bin/env python3 import pytest import os import pandas as pd from io import StringIO import experiment_qc test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ '/../output/experimentQC/' DESIGN_STRING = """sample_id\texperiment_id\tbiosample\tfactor\ttreatment\treplicate\tcontrol_id...
2,294
973
from channels.routing import route from .consumers import ws_message, ws_connect, ws_disconnect # TODO: Edit this to make proper use of channels.routing.route() or not channel_routing = { # route("websocket.receive", ws_message, path=r"^/chat/"), "websocket.connect": ws_connect, "websocket.receive": ws_mes...
371
127
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import copy import datetime import os import posixpath import subprocess import sys import unittest SCRIPT_DIR = os.path.dirname(o...
3,626
1,364
from PhotoHunt import PhotoHunt # Todo: 各URLあたり1~2個の未検出、誤検出等の課題はあるが、概ね意図通り動作する状態となった url_list = [ "https://www.saizeriya.co.jp/entertainment/images/1710/body.png", "https://www.saizeriya.co.jp/entertainment/images/1801/body.png", "https://www.saizeriya.co.jp/entertainment/images/1804/body.png", "https:...
1,089
524
a = b = c = 0 while True: flag = '' i = -1 s = '' while i < 0: i = int(input('idade:\t')) while s != 'M' and s != 'F': s = str(input('Sexo [M] [F]:\t')).strip().upper()[0] if i > 18: a += 1 if s == 'M': b += 1 elif i < 20: c += 1 while flag != ...
568
240