text
string
size
int64
token_count
int64
from python_on_rails.either import as_either, Failure, Success @as_either(TypeError) def add_one(x): return x + 1 @as_either() def times_five(x): return x * 5 def test_success_executes_bindings(): result = Success(1).bind(add_one).bind(times_five) assert isinstance(result, Success) assert resu...
632
223
from django.db import models # Create your models here. # Station class Stations(models.Model): stationName = models.CharField(max_length=100) stationLocation = models.CharField(max_length=100) stationStaffId = models.CharField(max_length=100) date = models.DateTimeField(auto_now_add=True) d...
1,943
621
# Test definitions for Lit, the LLVM test runner. # # This is reusing the LLVM Lit test runner in the interim until the new build # rules are upstreamed. # TODO(b/136126535): remove this custom rule. """Lit runner globbing test """ load("//tensorflow:tensorflow.bzl", "filegroup") load("@bazel_skylib//lib:paths.bzl", "...
5,340
1,612
""" These are functions to add to the configure context. """ def __checkCanLink(context, source, source_type, message_libname, real_libs=[]): """ Check that source can be successfully compiled and linked against real_libs. Keyword arguments: source -- source to try to compile source_type -- type of source file, ...
2,181
877
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, 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 cop...
12,950
4,285
import os from timeit import default_timer as timer import unittest import pytest from decorator import decorator from hail.utils.java import Env import hail as hl from hail.backend.local_backend import LocalBackend _initialized = False def startTestHailContext(): global _initialized if not _initialized: ...
4,906
1,818
""" Modifications copyright (C) 2020 Michael Strobl """ import time import tensorflow as tf import numpy as np from entity_linker.models.base import Model class LabelingModel(Model): """Unsupervised Clustering using Discrete-State VAE""" def __init__(self, batch_size, num_labels, context_encoded_dim, ...
2,728
848
#!/usr/bin/env python import sys import parmed as pmd import numpy as np from scipy.spatial import distance if len(sys.argv) < 2: print "Usage: molecular_diameter.py <mymolecule.mol2>" exit(1) mol = pmd.load_file(sys.argv[1]) crds = mol.coordinates dist = distance.cdist(crds, crds, 'euclidean') print np.max(dist...
329
138
import sys import pandas as pd from simpletransformers.classification import ClassificationModel prefix = "data/" train_df = pd.read_csv(prefix + "train.csv", header=None) train_df.head() eval_df = pd.read_csv(prefix + "test.csv", header=None) eval_df.head() train_df[0] = (train_df[0] == 2).astype(int) eval_df[0]...
2,425
929
import networkx as nx import os.path def load_graph(path, weighted=False, delimiter='\t', self_loop=False): graph = nx.Graph() if not os.path.isfile(path): print("Error: file " + path + " not found!") exit(-1) with open(path) as file: for line in file.readlines(): w = 1.0 line = line.split(delimiter) ...
1,049
492
import logging import uuid from django.db import models from django.urls import reverse from django.utils.encoding import force_text from django.utils.translation import ugettext_lazy as _ from model_utils.managers import InheritanceManager from mayan.apps.django_gpg.exceptions import VerificationError from mayan.ap...
5,853
1,667
from ConfigParser import ConfigParser from sys import argv REPLACE_PROPERTIES = ["file_path", "database_connection", "new_file_path"] MAIN_SECTION = "app:main" def sync(): # Add or replace the relevant properites from galaxy.ini # into reports.ini reports_config_file = "config/reports.ini" if len(arg...
2,226
646
# Copyright (c) 2020 Huawei Technologies Co.,Ltd. # # openGauss is licensed under Mulan PSL v2. # You can use this software according to the terms and conditions of the Mulan PSL v2. # You may obtain a copy of Mulan PSL v2 at: # # http://license.coscl.org.cn/MulanPSL2 # # THIS SOFTWARE IS PROVIDED ON AN "AS IS...
1,448
512
# Original work Copyright (C) 2017 Tiancheng Zhao, Carnegie Mellon University # Modified work Copyright 2018 Weiyan Shi. import tensorflow as tf import numpy as np from nltk.translate.bleu_score import sentence_bleu from nltk.translate.bleu_score import SmoothingFunction def get_bleu_stats(ref, hyps): scores = [...
3,838
1,308
# Licensed to the Apache Software Foundation (ASF) 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 u...
4,927
1,549
import plotly.graph_objects as go import streamlit as st import pandas as pd from utils import * import glob import wfdb import os ANNOTATIONS_COL_NAME = 'annotations' ''' # MIT-BIH Arrhythmia DB Exploration ''' record_ids = [os.path.basename(file)[:-4] for file in glob.glob('data/*.dat')] if len(record_ids) == 0: ...
3,631
1,123
class CharEnumerator(object): """ Supports iterating over a System.String object and reading its individual characters. This class cannot be inherited. """ def ZZZ(self): """hardcoded/mock instance of the class""" return CharEnumerator() instance=ZZZ() """hardcoded/returns an instance of the class""" de...
2,345
751
from .config_store import ConfigStore config = ConfigStore() config.set_mqtt_broker("mqtt", 1883) config.set_redis_config("redis", 6379, 0)
143
61
# -*- coding: utf-8 -*- import socket as csocket from struct import pack,unpack from website.contrib.communication.models import * def enum(**enums): return type('Enum', (), enums) class Socket: Dommaine = enum(IP=csocket.AF_INET,LOCAL=csocket.AF_UNIX) Type = enum(TCP=csocket.SOCK_STREAM, UDP=csocket.SOCK...
3,915
1,377
import pandas as pd import ete2 from ete2 import faces, Tree, AttrFace, TreeStyle import pylab from matplotlib.colors import hex2color, rgb2hex, hsv_to_rgb, rgb_to_hsv kelly_colors_hex = [ 0xFFB300, # Vivid Yellow 0x803E75, # Strong Purple 0xFF6800, # Vivid Orange 0xA6BDD7, # Very Light Blue 0xC100...
12,262
4,262
import attr from firedrake import * import numpy as np import matplotlib.pyplot as plt import matplotlib from scipy.linalg import svd from scipy.sparse.linalg import svds from scipy.sparse import csr_matrix from slepc4py import SLEPc import pandas as pd from tqdm import tqdm import os matplotlib.use('Agg') @attr.s c...
46,827
18,666
# -*- encoding: utf-8 -*- ''' @File :_time_domain_features.py @Time :2021/04/16 20:02:55 @Author :wlgls @Version :1.0 ''' import numpy as np def statistics(data, combined=True): """Statistical features, include Power, Mean, Std, 1st differece, Normalized 1st difference, 2nd difference, Nor...
7,884
3,031
from .session import Session, MutualAPI
39
10
from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, SubmitField from wtforms.validators import InputRequired, Email, ValidationError from models import User class RegistrationForm(FlaskForm): email = StringField('Your Email Address', validators=[InputRequired(), Email()]) username ...
936
236
# GENERATED BY KOMAND SDK - DO NOT EDIT import komand import json class Component: DESCRIPTION = "Creates a security policy with the default values" class Input: NAME = "name" class Output: ID = "id" class CreateSecurityPolicyInput(komand.Input): schema = json.loads(""" { "type": "o...
1,064
368
#!/usr/bin/python3 from pyspark.sql import SparkSession from haychecker.dhc.metrics import rule spark = SparkSession.builder.appName("rule_example").getOrCreate() df = spark.read.format("csv").option("header", "true").load("examples/resources/employees.csv") df.show() condition1 = {"column": "salary", "operator": ...
1,090
402
import collections import logging import urllib.parse from structlog import wrap_logger from secure_message.constants import MESSAGE_BY_ID_ENDPOINT, MESSAGE_LIST_ENDPOINT, MESSAGE_QUERY_LIMIT from secure_message.services.service_toggles import party, internal_user_service logger = wrap_logger(logging.getLogger(__nam...
10,579
2,997
# -*- coding: utf-8 -*- """ Defines various renderers for the game of nonogram """ from abc import ABC from sys import stdout from notetool.tool.log import logger from six import integer_types, itervalues, text_type from ..utils.iter import max_safe, pad from ..utils.other import two_powers from .common import BOX, ...
8,353
2,483
from __future__ import print_function, division from .str import StrPrinter from sympy.utilities import default_sort_key class LambdaPrinter(StrPrinter): """ This printer converts expressions into strings that can be used by lambdify. """ def _print_MatrixBase(self, expr): return "%s(%s)...
9,047
2,859
""" Fill na with most common of the whole column """ import numpy as np import pandas as pd import time import matplotlib.pyplot as plt from datetime import datetime import re from collections import Counter from statistics import median from tqdm import tqdm def find_most_common_value(element_list): for elemen...
1,690
587
from tkinter import Tk from tkinter import Entry from tkinter import Button from tkinter import StringVar t=Tk() t.title("Tarun Jaiswal") t.geometry("425x300") t.resizable(0,0) t.configure(background="black")#back ground color a=StringVar() def show(c): a.set(a.get()+c) def equal(): x=a.get() a.set(eva...
3,071
1,393
import hashlib import mimetypes from urllib.parse import unquote from django.conf import settings from django.core.exceptions import ValidationError from django.db import models from django.http import HttpResponseRedirect from django.template.loader import render_to_string from django.urls import reverse from django....
41,687
11,978
# -*-coding utf-8 -*- ########################################################################## # # Copyright (c) 2022 Baidu.com, 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 th...
9,860
2,811
# -*- coding: utf-8 -*- # # This file is part of menRva. # Copyright (C) 2018-present NU,FSM,GHSL. # # menRva is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Test terms views.py""" from cd2h_repo_project.modules.terms.views import ...
1,370
479
import webbrowser import wikipedia import requests def yt_search(search: str): webbrowser.open_new_tab(f"https://www.youtube.com/results?search_query={search}") def google_search(search: str): webbrowser.open_new_tab(f"https://www.google.com/search?q={search}") def bing_search(search: str): webbrowser.op...
1,766
625
import string from timeit import itertools s1 = '315c4eeaa8b5f8aaf9174145bf43e1784b8fa00dc71d885a804e5ee9fa40b16349c146fb778cdf2d3aff021dfff5b403b510d0d0455468aeb98622b137dae857553ccd8883a7bc37520e06e515d22c954eba5025b8cc57ee59418ce7dc6bc41556bdb36bbca3e8774301fbcaa3b83b220809560987815f65286764703de0f3d524400a19b15961...
9,307
5,177
# -*- coding: utf-8 -*- """Classes (Python) to compute the Bandit UCB (Upper Confidence Bound) arm allocation and choosing the arm to pull next. See :mod:`moe.bandit.bandit_interface` for further details on bandit. """ import copy from abc import abstractmethod from moe.bandit.bandit_interface import BanditInterfac...
5,777
1,792
import Hedge while True: text = input('Hedge > ') if text.strip() == "": continue result, error = Hedge.run('<stdin>', text) if (error): print(error.asString()) elif result: if len(result.elements) == 1: print(repr(result.elements[0])) else: print(repr(result))
296
131
import numpy as np from yt.geometry.selection_routines import GridSelector from yt.utilities.io_handler import BaseIOHandler from yt.utilities.logger import ytLogger as mylog from yt.utilities.on_demand_imports import _h5py as h5py _convert_mass = ("particle_mass", "mass") _particle_position_names = {} class IOHan...
14,420
4,366
#!/usr/bin/env python3 """ cidr_enum.py is a very simple tool to help enumerate IP ranges when being used with other tools """ import argparse import netaddr def enum_ranges(ranges, do_sort): cidrs=[] for r in ranges: try: cidrs.append(netaddr.IPNetwork(r)) except Exception as e: print("Error:", e) re...
1,275
494
# model settings model = dict( type='Semi_AppSup_TempSup_SimCLR_Crossclip_PTV_Recognizer3D', backbone=dict( type='ResNet3d', depth=18, pretrained=None, pretrained2d=False, norm_eval=False, conv_cfg=dict(type='Conv3d'), norm_cfg=dict(type='SyncBN', requires...
7,469
2,846
#!/usr/bin/python2.7 # Python 2.7 version by Alex Eames of http://RasPi.TV # functionally equivalent to the Gertboard dtoa test by Gert Jan van Loo & Myra VanInwegen # Use at your own risk - I'm pretty sure the code is harmless, but check it yourself. # This will not work unless you have installed py-spidev as in the ...
3,351
1,141
# -*- coding: utf-8 -*- import sublime from . import blame from . import templates class SimpleStatusBarTemplate(object): """A simple template class with the same interface as jinja2's one.""" # a list of variables used by this template variables = frozenset([ 'repo', 'branch', 'compare', 'inser...
5,370
1,373
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase class RandomTestCase(TestCase): def test_one_plus_one1(self): self.assertEqual(1+1, 2)
194
78
# import logging # import hercules.lib.util.hercules_logging as l # from hercules.lib.util import sso as sso import opencv2 as cv2 import urllib import numpy as np # log = l.setup_logging(__name__) def main(args=None): # username, passowrd = sso.get_login_credentials("WATCHER") # Open a sample video available...
1,115
362
from rest_framework.exceptions import APIException from rest_framework import status class GraphAPIError(APIException): """Base class for exceptions in this module.""" pass class NodeNotFoundError(GraphAPIError): status_code = status.HTTP_404_NOT_FOUND def __init__(self, id): self.id = id ...
1,244
388
#!/usr/bin/env python3 # Crypto trading bot using binance api # Author: LeonardoM011<Leonardo.leo.201@gmail.com> # Created on 2021-02-05 21:56 # Set constants here: DELTA_TIME = 300 # How long can we check for setting up new trade (in seconds) # ---------------------- # Imports: import os import sys...
3,792
1,349
# -*- coding: utf-8 -*- """Plotting.py for notebook 01_Exploring_DM_Halos This python file contains all the functions used for plotting graphs and maps in the 1st notebook (.ipynb) of the repository: 01. Exploring parameters in DM halos and sub-halos Script written by: Soumya Shreeram Project supervised by Johan Com...
13,061
5,125
# Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licenses this file to you under the # Apache License, Version 2.0 (the "License"); you may not u...
2,239
697
import matplotlib.pyplot as plt import random import pickle from skimage.transform import rotate from scipy import ndimage from skimage.util import img_as_ubyte from joblib import Parallel, delayed from sklearn.ensemble.forest import _generate_unsampled_indices from sklearn.ensemble.forest import _generate_sample_indic...
7,730
2,762
import numpy as np import pandas as pd from sklearn.base import BaseEstimator, TransformerMixin, clone from sklearn_pandas.util import validate_dataframe class MonitorMixin(object): def print_message(self, message): if self.logfile: with open(self.logfile, "a") as fout: fout.w...
3,763
1,123
import pytest from CommonServerPython import * from ProofpointThreatResponse import create_incident_field_context, get_emails_context, pass_sources_list_filter, \ pass_abuse_disposition_filter, filter_incidents, prepare_ingest_alert_request_body, \ get_incidents_batch_by_time_request, get_new_incidents, get_tim...
10,842
3,648
import sys import os import json from enum import Enum from .mach_o import LC_SYMTAB from macholib import MachO from macholib import mach_o from shutil import copy2 from shutil import SameFileError class ReplaceType(Enum): objc_methname = 1 symbol_table = 2 def replace_in_bytes(method_bytes, name_dict, type...
3,522
1,198
#!/usr/bin/env python import math import numpy as np def sd1(rr): sdnn = np.std(rr) return math.sqrt(0.5 * sdnn * sdnn)
123
55
# Copyright 2021 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
1,515
494
""" Disjoint set. Reference: https://en.wikipedia.org/wiki/Disjoint-set_data_structure """ class Node: def __init__(self, data: int) -> None: self.data = data self.rank: int self.parent: Node def make_set(x: Node) -> None: """ Make x as a set. """ # rank is the di...
1,829
655
# Timothy Keller # S = 1/2, I = 1/2 # Spin 1/2 electron coupled to spin 1/2 nuclei import numpy as np from scipy.linalg import expm from matplotlib.pylab import * from matplotlib import cm sigma_x = 0.5*np.r_[[[0, 1],[1, 0]]] sigma_y = 0.5*np.r_[[[0,-1j],[1j, 0]]] sigma_z = 0.5*np.r_[[[1, 0],[0, -1]]] Identity = np.e...
1,391
803
from spiderNest.preIntro import * path_ = os.path.dirname(os.path.dirname(__file__)) + '/dataBase/log_information.csv' def save_login_info(VMess, class_): """ VMess入库 class_: ssr or v2ray """ now = str(datetime.now()).split('.')[0] with open(path_, 'a', encoding='utf-8', newline='') as f: ...
1,787
673
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
29,585
8,110
import os.path import re import sys import traceback from pprint import pformat import tornado from tornado import template SENSITIVE_SETTINGS_RE = re.compile( 'api|key|pass|salt|secret|signature|token', flags=re.IGNORECASE ) class ExceptionReporter: def __init__(self, exc_info, handler): self....
4,119
1,241
class SeqIter: def __init__(self,l): self.l = l self.i = 0 self.stop = False def __len__(self): return len(self.l) def __list__(self): l = [] while True: try: l.append(self.__next__()) except StopIteration: ...
2,426
692
from lite_content.lite_internal_frontend.open_general_licences import ( OGEL_DESCRIPTION, OGTCL_DESCRIPTION, OGTL_DESCRIPTION, ) from lite_forms.components import Option class OpenGeneralExportLicences: class OpenGeneralLicence: def __init__(self, id, name, description, acronym): s...
1,542
588
# -*- coding: utf-8 -*- """RotateMatrix.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1LX-dZFuQCyBXDNVosTp0MHaZZxoc5T4I """ #Function to rotate matrix by 90 degree def rotate(mat): # `N × N` matrix N = len(mat) # Transpose the m...
887
381
def quicksort(xs): if len(xs) == 0: return [] pivot = xs[0] xs = xs[1:] left = [x for x in xs if x <= pivot] right = [x for x in xs if x > pivot] res = quicksort(left) res.append(pivot) res += quicksort(right) return res xs = [1, 3, 2, 4, 5, 2] sorted_xs = quicksort(xs)
319
135
# Copyright IBM Corp. 2016 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 a...
9,372
2,652
''' Created on Mar 6, 2018 @author: cef hp functions for workign with dictionaries ''' import logging, os, sys, math, copy, inspect from collections import OrderedDict from weakref import WeakValueDictionary as wdict import numpy as np import hp.basic mod_logger = logging.getLogger(__name__) #...
13,868
3,852
import os import random try: from colorama import Fore, Style except ModuleNotFoundError: os.system("pip install colorama") from urllib.request import urlopen from Core.helper.color import green, white, blue, red, start, alert Version = "2.2" yellow = ("\033[1;33;40m") def connected(host='http://duckduckgo.com'):...
3,532
1,588
#!/usr/bin/env python # # Copyright 2019-2020 Flavio Garcia # Copyright 2016-2017 Veeti Paananen under MIT License # # 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...
10,163
2,718
"""PyTorch policy class used for Simple Q-Learning""" import logging from typing import Dict, Tuple import gym import ray from ray.rllib.agents.dqn.simple_q_tf_policy import ( build_q_models, compute_q_values, get_distribution_inputs_and_class) from ray.rllib.models.modelv2 import ModelV2 from ray.rllib.models.to...
5,832
1,853
#Grapheme Rime_tone=[ "a","ă","â","e","ê","i","o","ô","ơ","u","ư","y","iê","oa","oă","oe","oo","uâ","uê","uô","uơ","uy","ươ","uyê","yê", #blank "á","ắ","ấ","é","ế","í","ó","ố","ớ","ú","ứ","ý","iế","óa","oắ","óe","oó","uấ","uế","uố","ướ","úy","ướ","uyế","yế", #grave ...
66,873
40,135
__author__ = 'Dmitry Golubkov' from django.contrib.sessions.base_session import AbstractBaseSession from django.contrib.sessions.backends.db import SessionStore as DBStore class CustomSession(AbstractBaseSession): @classmethod def get_session_store_class(cls): return SessionStore class Meta: ...
505
157
import unittest #write the import for function for assignment7 sum_list_values from src.assignments.assignment7 import sum_list_values class Test_Assign7(unittest.TestCase): def sample_test(self): self.assertEqual(1,1) #create a test for the sum_list_values function with list elements: # bill 23 ...
498
190
# Copyright 2018 by Kurt Griffiths # # 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,957
1,539
from arm.logicnode.arm_nodes import * class DetectMobileBrowserNode(ArmLogicTreeNode): """Determines the mobile browser or not (works only for web browsers).""" bl_idname = 'LNDetectMobileBrowserNode' bl_label = 'Detect Mobile Browser' arm_version = 1 def init(self, context): super(DetectMobileBrowserNode, sel...
382
127
import inspect import json import uuid from collections import Counter from datetime import datetime from io import StringIO import mock from django.contrib.admin.utils import NestedObjects from django.db import transaction, IntegrityError from django.db.models.signals import post_delete, post_save from django.test im...
29,959
9,141
import pytest import numpy as np from numpy.testing import assert_allclose from keras import backend as K from keras import activations def get_standard_values(): ''' These are just a set of floats used for testing the activation functions, and are useful in multiple tests. ''' return np.array([[...
4,561
1,648
#import numpy #import os #from xml.etree.ElementTree import * import tables #from Xdmf import * def H5toXMF(basename,size,start,finaltime,stride): # Open XMF files for step in range(start,finaltime+1,stride): XMFfile = open(basename+"."+str(step)+".xmf","w") XMFfile.write(r"""<?xml version="1.0...
4,932
1,650
# # PySNMP MIB module CISCO-TRUSTSEC-POLICY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-TRUSTSEC-POLICY-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:14:36 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
102,577
40,385
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI 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 ...
1,685
498
""" sphinx.ext.napoleon ~~~~~~~~~~~~~~~~~~~ Support for NumPy and Google style docstrings. :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ from sphinx import __display_version__ as __version__ from sphinx.application import Sphinx from ...
17,126
4,754
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from rdkit import DataStructs import plugin_api __license__ = "X11" class LbvsEntry(plugin_api.PluginInterface): """ Compute Tanimoto similarity. """ def __init__(self): self.stream = None self.counter = 0 self.first_...
2,390
720
# coding: utf-8 import time from config.config_loader import global_config from mall_spider.spiders.actions.context import Context from mall_spider.spiders.actions.direct_proxy_action import DirectProxyAction __proxy_service = None class ProxyService(object): proxies_set = set() proxies_list = ['https://' +...
2,849
910
import os import weather import datetime import unittest import tempfile class WeatherTestCase(unittest.TestCase): def setUp(self): self.db_fd, weather.app.config['DATABASE'] = tempfile.mkstemp() weather.app.config['TESTING'] = True self.app = weather.app.test_client() weather.init...
965
328
import asyncio class Activator: def __init__(self, name, packet_stream=None): self.ps = None self.name = name self.future = None self.data = 0 self.state = '' if packet_stream: self.set_packet_stream(packet_stream) @_core.module_cmd def wait_activator(self): pass @_core.module_cmd def check...
984
432
""" This example shows how to evaluate DeepCT (using Anserini) in BEIR. For more details on DeepCT, refer here: https://arxiv.org/abs/1910.10687 The original DeepCT repository is not modularised and only works with Tensorflow 1.x (1.15). We modified the DeepCT repository to work with Tensorflow latest (2.x). We do not...
7,779
2,483
# Engineering Mechanics: Statics, 4th Edition # Bedford and Fowler # Problem 6.64 # Units for this model are meters and kilonewtons # Import 'FEModel3D' and 'Visualization' from 'PyNite' from PyNite import FEModel3D from PyNite import Visualization # Create a new model truss = FEModel3D() # Define the nodes truss.Ad...
3,018
1,150
import yagmail receiver = "your@gmail.com" #Receiver's gmail address body = "Hello there from Yagmail" filename = "document.pdf" yag = yagmail.SMTP("my@gmail.com")#Your gmail address yag.send( to=receiver, subject="Yagmail test (attachment included", contents=body, attachments=filename, )...
322
115
############################################################################## # # Copyright (c) 2003-2020 by The University of Queensland # http://www.uq.edu.au # # Primary Business: Queensland, Australia # Licensed under the Apache License, version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # # Development unt...
5,064
1,702
from bosonstar.ComplexBosonStar import Complex_Boson_Star # ===================== # All imporntnat definitions # ===================== # Physics defintions phi0 = 0.40 # centeral phi D = 5.0 # Dimension (total not only spacial) Lambda = -0.2 # Cosmological constant # Solver definitions Rst...
1,116
406
#!/usr/bin/env python # coding=utf-8 from setuptools import setup, find_packages with open('README.md', encoding='utf-8') as f: readme = f.read() with open('LICENSE', encoding='utf-8') as f: license = f.read() with open('requirements.txt', encoding='utf-8') as f: reqs = f.read() pkgs = [p for p in find_...
796
292
# flake8: noqa """ Ory APIs Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501 The version of the OpenAPI document: v0.0.1-alpha.187 Contact: support@ory.sh ...
855
249
from abc import ABC, abstractmethod from typing import Tuple from requests import Response from .pydantic_models import (AppliedExclusionConditionsResponse, BiasAttributeConfigListResponse, ComputeRewardResponse, DefaultPredictionResponse, ...
3,810
942
from __future__ import print_function, unicode_literals #Ensures Unicode is used for all strings. my_str = 'whatever' #Shows the String type, which should be unicode type(my_str) #declare string: ip_addr = '192.168.1.1' #check it with boolean:(True) ip_addr == '192.168.1.1' #(false) ip_addr == '10.1.1.1' #is this su...
752
292
#enhanced keyboard driver import copy import os import configparser from pp_displaymanager import DisplayManager class pp_kbddriver_plus(object): # control list items NAME=0 # symbolic name for input and output DIRECTION = 1 # in/out MATCH = 2 # for input the charac...
10,411
2,891
# Generated by Django 3.2.6 on 2021-09-03 15:48 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('grocery', '0002_alter_item_comments'), ] operations = [ migrations.AlterField( model_name='item', name='comments', ...
452
150
#!/usr/bin/env python # Copyright 1996-2019 Cyberbotics Ltd. # # 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 applica...
2,770
1,194
""" test local env """ import os for k, v in os.environ.iteritems(): print k, '=', v
92
38
"""This file contains code for use with "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2014 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function, division import bisect import numpy as np import pandas as pd import scipy.sta...
27,844
11,359
from __future__ import absolute_import, division, print_function from six.moves import range from dials.array_family import flex import math class reflection_table_utils(object): @staticmethod def get_next_hkl_reflection_table(reflections): '''Generate asu hkl slices from an asu hkl-sorted reflection table'''...
3,955
1,254
import py import inspect from rpython.rlib.objectmodel import compute_hash, compute_identity_hash from rpython.translator.c import gc from rpython.annotator import model as annmodel from rpython.rtyper.llannotation import SomePtr from rpython.rtyper.lltypesystem import lltype, llmemory, rffi, llgroup from rpython.memo...
45,496
14,412