text
string
size
int64
token_count
int64
# An example of a turbulent BEC in a harmonic trap. The groundstate is found # and then some vortices randomly printed about with a phase printing. Some # evolution in imaginary time is then performed to smooth things out before # evolving the BEC in time. # Run with 'mpirun -n <N CPUs> python run_example.py' from __...
4,212
1,509
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 28 09:33:53 2020 @author: dhulls """ from __future__ import print_function from __future__ import absolute_import from argparse import ArgumentParser import numpy as nm import sys sys.path.append('.') from sfepy.base.base import IndexedStruct, St...
3,918
1,573
# -*- coding: utf-8 -*- from __future__ import unicode_literals import frappe import json from frappe.utils import now, cint from functools import partial from toolz import compose @frappe.whitelist() def deliver_result(lab_test, revert=0, delivery_time=None): doc = frappe.get_doc("Lab Test", lab_test) if doc...
4,063
1,232
#!/usr/bin/env python3 from scripts.workflow import get_app_name, is_name_valid from scripts.workflow import get_args, is_args_valid from scripts.workflow import create_dir, create_app, create_templates_folder, create_static_folder, create_dockerfile from scripts.manual import print_manual from scripts.messages import...
2,283
667
import os from pathlib import Path from jinja2 import Template import parser from utils import write_to_file from utils import mkdir_p parser.init() # parse and assign to vars spec = parser.spec def _concat(slice: str) -> str: """helper to concatenate each template slice.""" return "{}\n".format(slice) ...
2,960
965
# -*- coding:utf-8 -*- # /usr/bin/env python """ Author: Albert King date: 2019/10/20 10:58 contact: jindaxiang@163.com desc: 外汇配置文件 """ # headers SHORT_HEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36' } # url FX_SPOT_URL ...
621
322
import os from datetime import datetime import pytest from entropylab import ExperimentResources, SqlAlchemyDB, PyNode, Graph @pytest.mark.skipif( datetime.utcnow() > datetime(2022, 6, 25), reason="Please remove after two months have passed since the fix was merged", ) def test_issue_204(initialized_project...
1,283
403
from .file_core import FileEngine from src.utils.utils import * from .version import __version__
97
27
# # def add(x, y): # """ # Add Number Together # """ # return x+y # # # def subtract(x, y): # """ # Subtract x from y # """ # return x-y
169
71
from open_anafi.models import Indicator, IndicatorParameter, IndicatorLibelle from open_anafi.serializers import IndicatorSerializer from .frame_tools import FrameTools from open_anafi.lib import parsing_tools from open_anafi.lib.ply.parsing_classes import Indic import re from django.db import transaction from django.c...
7,673
1,966
import os,sys,math,random from phycas import * from MCMCManager import LikelihoodCore from phycas.utilities.PhycasCommand import * from phycas.readnexus import NexusReader from phycas.utilities.CommonFunctions import CommonFunctions class LikeImpl(CommonFunctions): #---+----|----+----|----+----|----+----|----+----...
3,576
1,040
from app import db import datetime from flask_mongoengine.wtf import model_form class Todo(db.Document): content = db.StringField(required=True, max_length=20) time = db.DateTimeField(default=datetime.datetime.now()) status = db.IntField(default=0) TodoForm = model_form(Todo)
291
96
dia = int(input('Dia = ')) mes = str(input('Mês = ')) ano = int(input('Ano = ')) print('Você nasceu no dia {} de {} de {}. Correto?' .format(dia, mes, ano))
157
66
############################################################################## # Copyright (c) 2009-2021, Hajime Nakagami<nakagami@gmail.com> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * ...
16,089
5,838
from discord.ext import commands from typing import Union from types import ModuleType from .context import Context class SourceConverter(commands.Converter): """A Converter that converts a string to a Command, Cog or Extension.""" async def convert( self, ctx: Context, argument: str ) -> Union[...
763
196
import logging from credstuffer.db.connector import DBConnector from credstuffer.exceptions import DBCreatorError class Database: """ class Database to build a sql string for Database creation USAGE: Database(name="web") """ def __init__(self, name): self.logger = logging.getLogg...
8,230
2,338
from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING if TYPE_CHECKING: from poetry.core.poetry import Poetry class Builder: def __init__(self, poetry: Poetry) -> None: from poetry.core.masonry.builders.sdist import SdistBuilder from poetry.core.masonr...
897
266
"""users.country Revision ID: 429d596c43a7 Revises: 77e0c0edaa04 Create Date: 2020-10-23 21:26:55.598146 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '429d596c43a7' down_revision = '77e0c0edaa04' branch_labels = None depends_on = None def upgrade(): # ...
659
266
""" Module for processing mentions of the bot via the Twitter API. """ from ConnectFourGame import * from databasehelpers import * from helpers import * from minimax import * def process_mentions(): """ Scan through recent mentions and send them to be processed. """ api = get_twitter_api() first = Tru...
4,535
1,445
import pandas as pd def get_seasonality_weekly(bills, date_column='dates', group_column='level_4_name', regular_only=False, promo_fact_column=None): bills['week'] = pd.to_datetime(bills[date_column]).dt.week bills['year'] = pd.to_datetime(bills[date_column]).dt.year # - Группиру...
3,448
1,317
from .command import Command, ApiCommand class Application: def __init__(self, client): self.client = client self.http = client.http self.__commands = [] async def fetch_commands(self) -> List[ApiCommand]: """ This can fetch discord application commands from dis...
1,729
434
from unittest import TestCase, main from single_package.single import Single class SingleTests(TestCase): def setUp(self): self.single = Single() def test_Single(self): self.assertIsInstance(self.single, Single) if __name__ == "__main__": main()
280
87
import responses from tests.util import random_str from tests.util import mock_http_response from binance.spot import Spot as Client from binance.lib.utils import encoded_string from binance.error import ParameterRequiredError mock_item = {"key_1": "value_1", "key_2": "value_2"} key = random_str() secret = random_st...
1,563
528
# Copyright 2014 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 collections import copy import traceback from telemetry import value as value_module from telemetry.results import page_run from telemetry.results im...
6,232
1,892
from tensorflow.keras.models import Model import tensorflow as tf from tensorflow import keras import matplotlib.pyplot as plt import matplotlib.cm as cm import numpy as np import cv2 import numpy as np import pandas as pd from tensorflow.keras.models import load_model import tensorflow as tf import os #--------------...
11,273
3,834
# coding:utf-8 """ start rob task good luck! > python start.py """ import datetime import time from sys import version_info import threadpool import ticket_config as config from config.stations import check_station_exists from train.login import Login from train.order import Order from train.ticket import Ticket f...
5,038
1,486
import subprocess import sys import os import setup_util from os.path import expanduser def start(args, logfile, errfile): fwroot = args.fwroot setup_util.replace_text("cakephp/app/Config/database.php", "'host' => '.*',", "'host' => '" + args.database_host + "',") setup_util.replace_text("cakephp/app/Config/cor...
2,769
986
import os, stat def addPermission(Filename): os.chmod(Filename, os.stat(Filename).st_mode | stat.S_IXUSR); def transform(content): name = ''; for i in range(0, len(content)): if (content[i] == ' ' and content[i + 1] == ' '): name += '\n'; else: name += content[i]; ...
624
219
from django.db import models from django.utils.translation import ugettext_lazy as _, ugettext
102
35
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Common utility functions Created on Sun May 27 16:37:42 2018 @author: chen """ import math import cv2 import os from imutils import paths import numpy as np import scipy.ndimage def rotate_cooridinate(cooridinate_og,rotate_angle,rotate_center): """ calculat...
6,987
2,590
import os import sys from subprocess import CalledProcessError from working_with_github.utils import run def checkout_pr(): user, branch = sys.argv[1].split(":") _checkout_pr(user, branch) def _checkout_pr(user, branch): run(f"git remote add {user} git@github.com:{user}/addons.git", fail_ok=True) r...
1,225
433
import logging import time import re import serial from threading import Thread, Event from respeaker import Microphone from respeaker import BingSpeechAPI from respeaker import PixelRing,pixel_ring BING_KEY = '95e4fe8b3a324389be4595bd1813121c' ser = serial.Serial('/dev/ttyS1',115200,timeout=0) data=[0xAA,0x01,0x64,...
4,144
1,472
#!/usr/bin/env python # encoding: utf-8 ''' @author: caroline @license: (C) Copyright 2019-2022, Node Supply Chain Manager Corporation Limited. @contact: caroline.fang.cc@gmail.com @software: pycharm @file: account_voteCredit.py @time: 2020/1/8 11:23 上午 @desc: ''' from apis.API import request_Api def voteCredit(api_...
1,063
592
import numpy as np from matplotlib import pyplot as plt def sign(y_pred): y_pred = (y_pred >= 0) * 2 - 1 return y_pred def plot(x, w): plt.scatter(x[:, 1][pos_index], x[:, 2][pos_index], marker="P") plt.scatter(x[:, 1][neg_index], x[:, 2][neg_index], marker=0) x = [-1, 100] y = -(w[0] + w[1]...
1,582
734
from ..utils import _make_pseudo_id from .base import BaseModel, cleanup_list, SourceMixin from .bill import Bill from .popolo import pseudo_organization from .schemas.vote_event import schema from pupa.exceptions import ScrapeValueError import re class VoteEvent(BaseModel, SourceMixin): _type = 'vote_event' ...
5,974
1,763
#################### # ES-DOC CIM Questionnaire # Copyright (c) 2017 ES-DOC. All rights reserved. # # University of Colorado, Boulder # http://cires.colorado.edu/ # # This project is distributed according to the terms of the MIT license [http://www.opensource.org/licenses/MIT]. #################### from djan...
2,472
768
# -*- coding: utf-8 -*- import os import shutil from django.conf import settings from django.core.management import call_command from django.test import TestCase from six import StringIO try: from unittest.mock import patch except ImportError: from mock import patch class CreateCommandTests(TestCase): "...
3,902
1,223
import pandas as pd import numpy as np from cvxopt import matrix from cvxopt import solvers import math def read_csv_input(filename): df = pd.read_csv(filename, header = None).to_numpy() y = df[:, [-1]] X = df[:, range(df.shape[1]-1)] return X, y def opt(X, y, c): m, n = X.shape P_top = np.concatenate(...
4,032
1,814
class AnythingType(set): def __contains__(self, other): return True def intersection(self, other): return other def union(self, other): return self def __str__(self): return '*' def __repr__(self): return "Anything" Anything = AnythingType()
307
94
import os, IP2Location, sys, ipaddress # database = IP2Location.IP2Location(os.path.join("data", "IPV6-COUNTRY.BIN"), "SHARED_MEMORY") database = IP2Location.IP2Location(os.path.join("data", "IPV6-COUNTRY.BIN")) try: ip = sys.argv[1] if ip == '' : print ('You cannot enter an empty IP address.') ...
626
213
import ADT_of_person as AP import datetime as dm #ADT Staff() # Staff(self, str name, str sex, tuple birthday, tuple entey_date, int salary, str position) # name(self) # sex(self) # en_year(self) # salary(self) # set_salary(self, new_salary) # position(self) # set_position(self, new_position...
1,927
651
""" Test signal handlers for completion. """ from datetime import datetime from unittest.mock import patch import ddt import pytest from completion import handlers from completion.models import BlockCompletion from completion.test_utils import CompletionSetUpMixin from django.test import TestCase from pytz import utc...
5,734
1,724
from typing import Tuple import pygame import numpy as np from .wall import Wall class MovingWall(Wall): def __init__(self, top: int = 0, left: int = 0, bottom: int = 1, right: int = 1): super().__init__(top, left, bottom, right) ...
907
283
light_up(light_1, light_2, light_3) Sets the brightness of the individual lights on the Color Sensor. This causes the Color Sensor to change modes, which can affect your program in unexpected ways. For example, the Color Sensor can't read colors when it's in light up mode. Parameters light_1 The desired brightness of ...
1,962
653
''' Script by: Gabriele Bendetti date: 25/06/2021 Utilities functions. This file is used to have a more organized main script. It contains: + Random plane orientation generator that can be used to practice plane attitude interpretation + Random fold generator + Plotter + Data converter from pandas dataframe to dic...
7,711
3,060
import tensorflow as tf import os from bayes_filter import logging from bayes_filter.filters import FreeTransitionVariationalBayes from bayes_filter.feeds import DatapackFeed, IndexFeed from bayes_filter.misc import make_example_datapack, maybe_create_posterior_solsets, get_screen_directions from bayes_filter.datapack ...
3,574
1,179
import argparse import json import matplotlib.pyplot as plt import numpy as np import pickle import time import torch from torch import optim from typing import Tuple, List, Dict import dataset from model import BiLSTM_CRF import utils def parse_args(): parser = argparse.ArgumentParser() parser.add_argument(...
13,237
4,910
from pymongo.errors import PyMongoError class IdNotFound(PyMongoError): """Raised when _id was not found in the database collection.""" def __init__(self, *args): if args: self.message = args[0] else: self.message = self.__doc__ def __str__(self): return s...
926
320
from typing import Dict, Any, Optional, List import gym import numpy as np from collections import defaultdict from flatland.core.grid.grid4_utils import get_new_position from flatland.envs.agent_utils import EnvAgent, RailAgentStatus from flatland.envs.rail_env import RailEnv, RailEnvActions from envs.flatland.obse...
45,205
13,722
import torch from torch import nn class CBOWClassifier(nn.Module): """ Continuous bag of words classifier. """ def __init__(self, hidden_size, input_size, max_pool, dropout=0.5): """ :param hidden_size: :param input_size: :param max_pool: if true then max pool over word ...
1,226
405
import datetime from mock import Mock, call import pytest from finicky import ValidationException, is_int, is_float, is_str, is_date, is_dict, is_list # noinspection PyShadowingBuiltins class TestIntValidator: def test_must_raise_validation_exception_when_input_is_none_and_required_is_true(self): with p...
14,637
5,248
import numpy as np import cv2 as cv img = cv.imread('1.jpeg',cv.IMREAD_COLOR) #for polygon we need to have set of points so we create a numpy array. and pts is an object. pts = np.array([[20,33],[300,120], [67,79], [123,111], [144,134]], np.int32) #the method polylines will actully draws a polygon by taking differe...
583
238
#!/usr/bin/env python2 from BeautifulSoup import BeautifulSoup, NavigableString import urllib import string import re class Entry(object): def __init__(self, name, value, description, url): self.name = name self.value = value self.description = description self.url = url def ...
3,871
944
import flwr as fl import flwr.client from sources.utils.simulation_parameters import DEFAULT_SERVER_ADDRESS from sources.simulators.base_client_provider import BaseClientProvider def start_client(client_provider: BaseClientProvider, client_identifier): client = client_provider(str(client_identifier)) if isi...
547
155
#!/usr/bin/env python3 # -*- 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 ma...
23,056
6,511
import mock from mock import patch import unittest from vnc_api.vnc_api import * from svc_monitor.port_tuple import PortTupleAgent from svc_monitor.config_db import * import test_common_utils as test_utils class PortTupleTest(unittest.TestCase): def setUp(self): InstanceIpSM._cassandra = mock.MagicMock() ...
6,046
2,111
from functools import partial from typing import Callable, List, Optional, Type import numpy as np from gym.vector.vector_env import VectorEnv from pearll.agents.base_agents import BaseAgent from pearll.buffers import RolloutBuffer from pearll.buffers.base_buffer import BaseBuffer from pearll.callbacks.base_callback ...
5,672
1,612
import scipy, numpy, typing, numbers from tequila.objective import Objective from tequila.objective.objective import assign_variable, Variable, format_variable_dictionary, format_variable_list from .optimizer_base import Optimizer from ._containers import _EvalContainer, _GradContainer, _HessContainer, _QngContainer fr...
17,643
4,621
import numpy as np import time import warnings from sklearn.linear_model import LinearRegression from solar import solar from sklearn.exceptions import ConvergenceWarning # For recent version of Scikit-learn: since the class 'Lars' may rely on the Cholesky decomposition and hence may have potential c...
12,051
3,825
cases=int(raw_input()) for case in range(cases): answers=[0,0] grid=[[0 for x in range(4)] for y in range(2)] common=[] for i in range(2): answers[i]=int(raw_input()) for j in range(4): grid[i][j]=raw_input().split() grid[i][j] = map(int, grid[i][j]) # Code...
615
223
allct_dat = { "TYR": { "HB2":{'torsion': 300.0, 'tree': 'E', 'NC': 4, 'NB': 6, 'NA': 8, 'I': 9, 'angle': 109.5, 'blen': 1.09, 'charge': 0.038, 'type': 'HC'}, "HB3":{'torsion': 60.0, 'tree': 'E', 'NC': 4, 'NB': 6, 'NA': 8, 'I': 10, 'angle': 109.5, 'blen': 1.09, 'charge': 0.038, 'type': 'HC'}, "impropTors":[['-M', 'CA'...
69,067
42,931
# # This file is part of the chi repository # (https://github.com/DavAug/chi/) which is released under the # BSD 3-clause license. See accompanying LICENSE.md for copyright notice and # full license details. # import copy import myokit import myokit.formats.sbml as sbml import numpy as np class MechanisticModel(obj...
39,961
10,498
# -*- coding: utf-8 -*- """ Django settings for smartlicense project. Generated by 'django-admin startproject' using Django 2.0.2. For more information on this file, see https://docs.djangoproject.com/en/2.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.0/re...
4,954
1,730
## Copyright (c) 2022, Team FirmWire ## SPDX-License-Identifier: BSD-3-Clause from enum import Enum, auto from .hw.soc import SOCPeripheral class MemoryMapEntryType(Enum): GENERIC = auto() FILE_BACKED = auto() PERIPHERAL = auto() ANNOTATION = auto() class MemoryMapEntry: def __init__(self, ty, s...
2,226
693
from .helper import fill_optional_fields from maps_geometry.feature_extraction import get_bounding_box from .MapistoShape import MapistoShape from .BoundingBox import BoundingBox class Land: def __init__(self, land_id, representations: list, bounding_box=None): assert isinstance(bounding_box, BoundingBox...
1,688
493
from typing import List def two_sum(lis: List[int], target: int): dici = {} for i, value in enumerate(lis): objetive = target - value if objetive in dici: return [dici[objetive], i] dici[value] = i return [] print(two_sum([1, 2, 3, 4, 5, 6], 7))
298
110
from vue.bridge import Object import javascript class VueDecorator: __key__ = None __parents__ = () __id__ = None __value__ = None def update(self, vue_dict): base = vue_dict for parent in self.__parents__: base = vue_dict.setdefault(parent, {}) if self.__id__...
1,032
318
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc from google.cloud.datalabeling_v1beta1.proto import ( annotation_spec_set_pb2 as google_dot_cloud_dot_datalabeling__v1beta1_dot_proto_dot_annotation__spec__set__pb2, ) from google.cloud.datalabeling_v1beta1.proto import ( data_la...
40,992
12,726
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import keras from keras.models import Model, load_model from keras import backend as K from keras.preprocessing.image import ImageDataGenerator import tensorflow as tf tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) # mute deprecation warnings from kera...
6,777
2,425
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** from .. import _utilities import typing # Export this package's modules as members: from ._enums import * from .application import * from .application_...
2,734
1,346
from setuptools import setup, find_packages __name__ = "appJar" __version__ = "0.94.0" __author__ = "Richard Jarvis" __desc__ = "An easy-to-use, feature-rich GUI wrapper for tKinter. Designed specifically for use in the classroom, but powerful enough to be used anywhere." __author_email_...
1,853
620
import shapefile class Andir: def __init__(self): self.kelurahan = shapefile.Writer( 'kelurahan_andir', shapeType=shapefile.POLYGON) self.kelurahan.shapeType self.kelurahan.field('kelurahan_di_andir', 'C') self.kantor = shapefile.Writer( 'kantor_kelurahan_a...
141,788
91,329
# Copyright 2016-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import torch, glob, os from .sparseConvNetTensor import SparseConvNetTensor from .metadata import Metadata import sparsecon...
8,226
2,889
# import numpy as np #create numpy arrays # #Generate array height=np.round(np.random.normal(1.75,0.20,5000),2) weight=np.round(np.random.normal(60.32,15,5000),2) np_city=np.column_stack((height,weight)) print(np_city.shape) cars=["Toyota","Chevrolet","Ford","Honda","Brabus"] cars_np=np.array(cars) weight=[20.12,2...
12,983
10,210
# # Copyright (c) 2017-2018 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # from sysinv.common import constants from sysinv.common import utils from sysinv.helm import helm from sysinv.puppet import openstack class NfvPuppet(openstack.OpenstackBasePuppet): """Class to encapsulate puppet opera...
11,818
3,597
from data import * from heapq import * class Timeline: def __init__(self): self.events=[] def addEvent(self, event): heappush(self.events, event) def nextEvent(self): assert(self.events != []) return heappop(self.events) def nextEvents(self): if self.events == []: return [] cur_time = self.event...
1,151
506
import json from django.core.exceptions import ObjectDoesNotExist from django.db import transaction from treebeard.mp_tree import MP_Node try: from wagtail.core.blocks import StreamValue except ImportError: # pragma: no cover; fallback for Wagtail < 2.0 from wagtail.wagtailcore.blocks import StreamValue ...
5,394
1,700
from typing import Dict _codes: Dict[int, str] = { # Debug (1xxxx) # System (100xx) 10000: 'Test debug', # Pipe (103xx) 10301: 'Reindexing parser', # Resolver (109xx) 10901: 'Executing catalog', 10902: 'Executing target', 10903: 'Catalog executed', 10904: 'Target executed', ...
8,436
3,245
# Erstellt aus vielen TIFF Datei eine stacked Datei mit dem ArcGIS # Tool composite bands import arcpy import os arcpy.env.overwriteOutput = True # Ueberschreiben fuer ArcGIS aktivieren arcpy.env.pyramid = "NONE" # Verhindert dass Pyramiden berechnet werden arcpy.env.rasterStatistics = "NONE" # Verhindert dass ...
937
368
from collections import OrderedDict from unittest import TestCase from frozenordereddict import FrozenOrderedDict class TestFrozenOrderedDict(TestCase): ITEMS_1 = ( ("b", 2), ("a", 1), ) ITEMS_2 = ( ("d", 4), ("c", 3), ) ODICT_1 = OrderedDict(ITEMS_1) ODICT_2 ...
2,106
826
import random import unittest from serial.serialutil import SerialException from data_gateway.dummy_serial import DummySerial, constants, exceptions, random_bytes, random_string from tests.base import BaseTestCase class DummySerialTest(BaseTestCase): def setUp(self): """Set up the test environment: ...
7,560
2,531
# -*- coding: utf-8 -*- r""" speaklater ~~~~~~~~~~ A module that provides lazy strings for translations. Basically you get an object that appears to be a string but changes the value every time the value is evaluated based on a callable you provide. For example you can have a global `lazy_get...
5,216
1,623
import unittest import numpy as np from graph import Graph class TestGraphClass(unittest.TestCase): """ Test Class for Graph Class """ def test_generating_graph_object(self): """ Testing Generation of Graph Object from Adjacent Matrix """ # setup A = np.array(...
848
299
def kelime_sayisi(string): counter = 1 for i in range(0,len(string)): if string[i] == ' ': counter += 1 return counter cumle = input("Cumlenizi giriniz : ") print("Cumlenizdeki kelime sayisi = {}".format(kelime_sayisi(cumle)))
260
98
import MySQLdb def domains_from_db(connection_data: dict, at_a_time: int = 1000) -> list: domains = [] for connect_params in connection_data: if 'charset' not in connect_params: connect_params['charset'] = 'utf8' db = MySQLdb.connect(**connect_params) cursor = db.cursor() ...
909
271
############################################################################### # Copyright (c) 2019 Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory # # Written by M. Monterial, K. Nelson # monterial1@llnl.gov # # LLNL-CODE-805904 # # All rights reserved. # # Permissi...
3,370
972
# -*- coding: utf-8 -*- """ Created on %(date)s @author: %Christian """ """ #BASE +BN层 #dropout改为0.15 """ import paddle import paddle.nn as nn import paddle.nn.functional as F import paddlenlp as ppnlp class QuestionMatching_base(nn.Layer): ''' base模型 dropout改为0.15 ''' de...
2,976
1,115
from functools import partialmethod import pandas as pd from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine import sqlite3 import click import json import pkg_resources from itertools import combinations from q2_mlab.db.schema import RegressionScore from q2_mlab.plotting.components import ( ...
21,917
6,501
import torch import torch.distributions as D class ExponentialFamily(D.ExponentialFamily): """ Shared base distribution for exponential family distributions. """ @property def is_sparse(self): """ Whether the distribution's parameters are sparse. Just returns `False`. """ ...
6,378
1,506
#!/usr/bin/python condition = 42 # IMPORTANT: colons, _indentation_ are significant! if condition: print "Condition is true!" elif True: # not 'true'! print "I said it's true! :)" else: print "Condition is false :(" # of course, elif/else are optional assert True == (not False) # Equivalent of `for (in...
557
196
#!/usr/bin/python # -*- coding: utf-8 -*- # provides functions for selecting a sample of training data from itertools import combinations, islice import blocking import core import numpy import logging import random import sys def findUncertainPairs(field_distances, data_model, bias=0.5): """ Given a set of ...
6,492
1,818
list1 = [10,9,3,7,2,1,23,1,561,1,1,96,1] def cmp1(x,y): if x == 1 or y==1: c = y-x else: c = x-y return c list1.sort(cmp = cmp1) print list1
166
116
from AIPS import AIPS from AIPSTask import AIPSTask from AIPSData import AIPSImage from ObitTask import ObitTask AIPS.userno = 103 image = AIPSImage('MANDELBROT', 'MANDL', 1, 1) mandl = AIPSTask('mandl') mandl.outdata = image mandl.imsize[1:] = [ 512, 512 ] mandl.go() try: template = ObitTask('Template') te...
520
219
import bpy import bmesh import numpy from random import randint import time # pointsToVoxels() has been modified from the function generate_blocks() in https://github.com/cagcoach/BlenderPlot/blob/master/blendplot.py # Some changes to accomodate Blender 2.8's API changes were made, # and the function has been made m...
5,186
1,872
#!/usr/bin/python #-*-coding:utf-8-*- import json import sys import time # TBD: auto discovery # data_path = "/proc/fs/lustre/llite/nvmefs-ffff883f8a4f2800/stats" data_path = "/proc/fs/lustre/lmv/shnvme3-clilmv-ffff8859d3e2d000/md_stats" # use a dic1/dic2 to hold sampling data def load_data(dic): # Open file ...
2,182
775
import unittest from hashlib import sha1 import pickle import numpy as np from datasketch.lsh import MinHashLSH from datasketch.minhash import MinHash from datasketch.weighted_minhash import WeightedMinHashGenerator class TestMinHashLSH(unittest.TestCase): def test_init(self): lsh = MinHashLSH(threshold=...
5,716
2,229
import logging from typing import Callable from typing import List import numpy as np import torch.utils.data from .video_dataset import VideoDataset from .video_dataset import VideoRecord LOG = logging.getLogger(__name__) # line_profiler injects a "profile" into __builtins__. When not running under # line_profile...
4,134
1,207
import click import ce_api import base64 import os from ce_cli.cli import cli, pass_info from ce_cli.utils import check_login_status from ce_cli.utils import api_client, api_call from ce_api.models import FunctionCreate, FunctionVersionCreate from ce_cli.utils import declare, notice from tabulate import tabulate from c...
5,947
1,869
# # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # This file incorporates work covered by the following license noti...
1,747
492
# 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 (t...
5,416
1,562