content
stringlengths
27
928k
path
stringlengths
4
230
size
int64
27
928k
nl_text
stringlengths
21
396k
nl_size
int64
21
396k
nl_language
stringlengths
2
3
nl_language_score
float64
0.04
1
#!/usr/bin/env python from setuptools import setup, find_packages with open("README.md", "r") as fh: long_description = fh.read() setup( name='bcpy', version='0.1', author='Igor Neves Faustino', author_email='igornfaustino@gmail.com', url='https://github.com/igornfaustino/bcpy.git', descr...
setup.py
605
!/usr/bin/env python entry_points={ 'console_scripts': ['forecastio = displayforecastio.app:run'], }
104
en
0.186589
from collections import OrderedDict, defaultdict, namedtuple from functools import partial from itertools import groupby from cached_property import cached_property import numpy as np from devito.ir import (SEQUENTIAL, PARALLEL, PARALLEL_IF_PVT, ROUNDABLE, DataSpace, Forward, IterationInstance,...
devito/passes/clusters/aliases.py
42,243
Base class for CIRE transformers. A collection of aliasing expressions. Round up the innermost IterationInterval of the tensor temporaries IterationSpace to a multiple of the SIMD vector length. This is not always possible though (it depends on how much halo is safely accessible in all read Functions). Transform the sc...
12,822
en
0.849241
#!/usr/bin/env python import os import sys import platform import tempfile import urllib2 import shutil import boto from boto.exception import BotoClientError def merge_dicts(a, b): """ Merge two dictionaries. If there is a key collision, `b` overrides `a`. :param a: Dictionary of default settings :param ...
MasterScripts/systemprep-linuxmaster.py
14,403
Removes temporary files loaded to the system. :param workingdir: str, Path to the working directory :return: bool Creates a directory in `basedir` with a prefix of `dirprefix`. The directory will have a random 5 character string appended to `dirprefix`. Returns the path to the working directory. :rtype : str :p...
2,879
en
0.699074
## # This software was developed and / or modified by Raytheon Company, # pursuant to Contract DG133W-05-CQ-1067 with the US Government. # # U.S. EXPORT CONTROLLED TECHNICAL DATA # This software product contains export-restricted data whose # export/transfer/disclosure is restricted by U.S. law. Dissemination # to ...
cave/com.raytheon.viz.gfe/python/testFormatters/FirePeriodTable.py
3,854
This software was developed and / or modified by Raytheon Company, pursuant to Contract DG133W-05-CQ-1067 with the US Government. U.S. EXPORT CONTROLLED TECHNICAL DATA This software product contains export-restricted data whose export/transfer/disclosure is restricted by U.S. law. Dissemination to non-U.S. persons whe...
1,821
en
0.732319
# Python stubs generated by omniidl from /tmp/corba/omni/share/idl/omniORB/COS/CosObjectIdentity.idl # DO NOT EDIT THIS FILE! import omniORB, _omnipy from omniORB import CORBA, PortableServer _0_CORBA = CORBA _omnipy.checkVersion(4,2, __file__, 1) try: property except NameError: def property(*args): ...
ansys_corba/omniORB/COS/CosObjectIdentity_idl.py
4,366
Python stubs generated by omniidl from /tmp/corba/omni/share/idl/omniORB/COS/CosObjectIdentity.idl DO NOT EDIT THIS FILE! Start of module "CosObjectIdentity" typedef ... ObjectIdentifier interface IdentifiableObject IdentifiableObject operations and attributes IdentifiableObject object reference IdentifiableObject skel...
367
en
0.570013
#!/usr/bin/env python3 # Copyright (c) 2014-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the wallet accounts properly when there is a double-spend conflict.""" from decimal import Decimal...
test/functional/wallet_txn_doublespend.py
6,973
Test the wallet accounts properly when there is a double-spend conflict. !/usr/bin/env python3 Copyright (c) 2014-2018 The Bitcoin Core developers Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. Start with split network: All nodes sho...
1,493
en
0.865153
import time try: import wandb wandb_log=True except ImportError: wandb_log=False import numpy as np from advbench.lib.plotting import plot_perturbed_wandb from einops import rearrange class AverageMeter: """Computes and stores the average and current value""" def __init__(self, avg_mom=0.5): ...
advbench/lib/meters.py
3,920
Computes and stores the average and current value running average of whole epoch
82
en
0.878469
from collections import OrderedDict from datetime import date, datetime, time, timedelta from decimal import Decimal from enum import Enum from pathlib import Path from typing import Any from uuid import UUID from .datetime_parse import parse_date, parse_datetime, parse_duration, parse_time from .exceptions import Con...
pydantic/validators.py
4,124
is there anything else we want to add here? If you think so, create an issue. order is important here, for example: bool is a subclass of int so has to come first, datetime before date same
189
en
0.953448
# -*- coding: utf-8 -*- # from typing import Optional from ..category import Category class Utils(Category): def check_link( self, url: str = None, **kwargs ) -> dict: return self._request("checkLink", locals()) def delete_from_last_shortened( self, key: ...
pyvdk/api/categories/utils.py
1,497
-*- coding: utf-8 -*-
21
en
0.767281
# # PySNMP MIB module SNMP-MPD-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNMP-MPD-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:08:13 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
pysnmp-with-texts/SNMP-MPD-MIB.py
6,338
PySNMP MIB module SNMP-MPD-MIB (http://snmplabs.com/pysmi) ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNMP-MPD-MIB Produced by pysmi-0.3.4 at Wed May 1 15:08:13 2019 On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
318
en
0.397818
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
core/domain/rule_domain_test.py
4,390
Tests for the actual rules in extensions/. Tests for rules. Test for functions involving rules. Tests for rule services. Tests for rule objects. coding: utf-8 Copyright 2014 The Oppia Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in comp...
778
en
0.876197
from __future__ import division, print_function, absolute_import # noinspection PyUnresolvedReferences from six.moves import range import numpy as np from scipy.misc import doccer from ...stats import nonuniform from ...auxiliary.array import normalize, nunique, accum __all__ = ['markov'] _doc_default_callparams =...
mlpy/stats/models/_basic.py
5,420
Markov model. The `startprob` keyword specifies the start probabilities for the model. The `transmat` keyword specifies the transition probabilities the model follows. Methods ------- score(x, startprob, transmat) Log probability of the given data `x`. sample(x, startprob, transmat, size=1) Draw random sample...
2,140
en
0.487438
# Copyright 2017 Battelle Energy Alliance, 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
framework/TSA/PolynomialRegression.py
5,833
A constructor that will appropriately intialize a supervised learning object @ In, args, list, an arbitrary list of positional values @ In, kwargs, dict, an arbitrary dictionary of keywords and values @ Out, None Determines the charactistics of the signal based on this algorithm. @ In, signal, np.ndarray, time series w...
2,399
en
0.819432
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2014-10-26 13:02:58 # @Author : yml_bright@163.com from sqlalchemy import Column, String, Integer from sqlalchemy.ext.declarative import declarative_base from db import dbengine, Base class User(Base): __tablename__ = 'user' cardnum = Column(String(1...
mod/models/user.py
753
!/usr/bin/env python -*- coding: utf-8 -*- @Date : 2014-10-26 13:02:58 @Author : yml_bright@163.com
103
fr
0.217562
import torch import torch.nn as nn def clip_by_tensor(t, t_min, t_max): result = (t>=t_min)*t+(t<t_min)*t_min result = (result<=t_max)*result+(result>t_max)*t_max return result class FocalLoss(nn.Module): def __init__(self, gamma=2, alpha=0.25): super(FocalLoss, self).__init__() self...
utils/FocalLoss.py
2,302
input:size is M*2. M is the batch number For poitive prediction, only need consider front part loss, back part is 0; target_tensor > zeros <=> z=1, so poitive coefficient = z - p. For negative prediction, only need consider back part loss, front part is 0; target_tensor > zeros <=> z=1, so negative coefficient = 0.
316
en
0.775647
# Generated by Django 2.2.2 on 2019-07-18 19:00 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('weblog', '0011_auto_20190718_1829'), ] operations = [ migrations.AddField( model_name='userdetail', name='phone', ...
weblog/migrations/0012_userdetail_phone.py
409
Generated by Django 2.2.2 on 2019-07-18 19:00
45
en
0.60828
import csv import itertools import sys import re import math def get_root_mean_square( mean_square, number): return math.sqrt(mean_square / number) def gpsr_tlm_compare(target_arr, answer_arr, lift_off_time, fileobj, csv_header): cache_idx = 0 sim_data_list = [] start_flight_idx = 0 iter_idx = 0 ...
utilities/log_parser/parser_utility.py
2,644
simtime gps sow time DM Length DM SPEED DM ABEE Target Benchmark (DM_GPSR_TLM - target_GPSR_TLM) Answer DM-TLM Target DM-TLM Root Mean square
141
en
0.346746
""" .. See the NOTICE file distributed with this work for additional information regarding copyright ownership. 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....
tests/test_rest_file_region.py
1,945
Definges the client object to make requests against Close the client once testing has completed Test that the track endpoint is returning the usage paramerts Test that the track endpoint is returning the usage paramerts .. See the NOTICE file distributed with this work for additional information regarding copyright ...
899
en
0.891744
# Demo Python Datetime - The strftime() Method ''' The strftime() Method The datetime object has a method for formatting date objects into readable strings. The method is called strftime(), and takes one parameter, format, to specify the format of the returned string. Directive Description ...
0-python-tutorial/25-dates05_strftime23_z.py
2,408
The strftime() Method The datetime object has a method for formatting date objects into readable strings. The method is called strftime(), and takes one parameter, format, to specify the format of the returned string. Directive Description Example %a ...
2,588
en
0.721466
class Solution(object): # def findKthLargest(self, nums, k): # """ # :type nums: List[int] # :type k: int # :rtype: int # """ # return sorted(nums, reverse=True)[k - 1] # def findKthLargest(self, nums, k): # # build min heap # heapq.heapify(nums) ...
python/215_Kth_Largest_Element_in_an_Array.py
1,289
def findKthLargest(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ return sorted(nums, reverse=True)[k - 1] def findKthLargest(self, nums, k): build min heap heapq.heapify(nums) remove n - k smallest number while len(nums) > k: heapq.heappop(nums)...
420
en
0.348321
"""Configuration for reproducing leaderboard of grb-citeseer dataset.""" import torch import torch.nn.functional as F from grb.evaluator import metric model_list = ["gcn", "gcn_ln", "gcn_at", "graphsage", "graphsage_ln", "graphsage_at", ...
pipeline/configs/grb-citeseer/config.py
21,321
Hyper-parameters are determined by auto training, refer to grb.utils.trainer.AutoTrainer. Configuration for reproducing leaderboard of grb-citeseer dataset.
156
en
0.786265
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = r''' module: sns_topic short_description: Manages A...
venv/lib/python3.7/site-packages/ansible_collections/community/aws/plugins/modules/sns_topic.py
20,649
Handles SNS Topic creation and destruction !/usr/bin/python -*- coding: utf-8 -*- Copyright: Ansible Project GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) handled by AnsibleAWSModule topic names cannot have colons, so this captures the full topic name AWS automatically inj...
618
en
0.686816
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
azure-servicefabric/azure/servicefabric/models/wait_for_primary_placement_safety_check.py
1,111
Safety check that waits for the primary replica that was moved out of the node due to upgrade to be placed back again on that node. :param kind: Constant filled by server. :type kind: str :param partition_id: :type partition_id: str coding=utf-8 -----------------------------------------------------------------------...
688
en
0.765365
#Shows data from the first 1000 blocks import random import os import subprocess import json #Set this to your raven-cli program cli = "raven-cli" #mode = "-testnet" mode = "" rpc_port = 8746 #Set this information in your raven.conf file (in datadir, not testnet3) rpc_user = 'rpcuser' rpc_pass = 'rpcpass555' def ...
assets/tools/blockfacts.py
1,122
Shows data from the first 1000 blocksSet this to your raven-cli programmode = "-testnet"Set this information in your raven.conf file (in datadir, not testnet3)print("Connection: " + connection)
193
en
0.836165
""" Distribution class """ # To do: # # - wrap bins for cyclic histograms # - check use of float() in count_mag() etc # - clarify comment about negative selectivity # # - function to return value in a range (like a real histogram) # - cache values # - assumes cyclic axes start at 0: include a shift based on range # # -...
featuremapper/distribution.py
41,177
Return the two peak values of distributions in the given matrix Return the two modes of distributions in the given matrix, by fit with von Mises function The results of the main mode are available in self.{preference,selectivity,good_of_fit}, while the second mode results are in the first element of the self.more_mode...
18,738
en
0.875903
#!/usr/bin/env python # encoding: utf-8 """ @version: v1.0 @author: Shijie Qin @license: Apache Licence @contact: qsj4work@gmail.com @site: https://shijieqin.github.io @software: PyCharm @file: __init__.py.py @time: 2018/11/8 3:13 PM """
core/__init__.py
251
@version: v1.0 @author: Shijie Qin @license: Apache Licence @contact: qsj4work@gmail.com @site: https://shijieqin.github.io @software: PyCharm @file: __init__.py.py @time: 2018/11/8 3:13 PM !/usr/bin/env python encoding: utf-8
237
en
0.393099
""" Bilinear Attention Networks Jin-Hwa Kim, Jaehyun Jun, Byoung-Tak Zhang https://arxiv.org/abs/1805.07932 This code is written by Jin-Hwa Kim. """ import sys sys.path.append('./ban') import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils.weight_norm import weight_norm from attention i...
AiR-M/ban/base_model.py
8,138
Gated Recurrent Unit without long-term memory Forward v: [batch, num_objs, obj_dim] b: [batch, num_objs, b_dim] q: [batch_size, seq_length] return: logits, not probs Forward v: [batch, num_objs, obj_dim] b: [batch, num_objs, b_dim] q: [batch_size, seq_length] return: logits, not probs Computing the lengths of sente...
913
en
0.664841
"""Tag the sandbox for release, make source and doc tarballs. Requires Python 2.6 Example of invocation (use to test the script): python makerelease.py --force --retag --platform=msvc6,msvc71,msvc80,mingw -ublep 0.5.0 0.6.0-dev Example of invocation when doing a release: python makerelease.py 0.5.0 0.6.0-dev...
external/jsoncppWrapper/makerelease.py
15,151
otherwise ignore error, meaning tag does not exist psftp -agent -C blep,jsoncpp@web.sourceforge.net -batch -b batch.sftp -bc doc_dirname = r'jsoncpp-api-html-0.5.0' doc_tarball_path = r'e:\prg\vc\Lib\jsoncpp-trunk\dist\jsoncpp-api-html-0.5.0.tar.gz' Decompress source tarball, download and install scons-lo...
374
en
0.547672
""" Getting started tutorial ======================== In this introductory example, you will see how to use the :code:`spikeinterface` to perform a full electrophysiology analysis. We will first create some simulated data, and we will then perform some pre-processing, run a couple of spike sorting algorithms, inspect ...
examples/getting_started/plot_getting_started.py
12,555
Getting started tutorial ======================== In this introductory example, you will see how to use the :code:`spikeinterface` to perform a full electrophysiology analysis. We will first create some simulated data, and we will then perform some pre-processing, run a couple of spike sorting algorithms, inspect and ...
6,050
en
0.838902
########################################################### # # Copyright (c) 2005, Southpaw Technology # All Rights Reserved # # PROPRIETARY INFORMATION. This software is proprietary to # Southpaw Technology, and is not to be reproduced, transmitted, # or disclosed in any way without written permi...
src/tactic/ui/filter/filter_element_wdg.py
74,827
represents the base filter This filter uses a subselect so that it can look for dates that are on another table than the main serach derives from SelectFilterElementWdg but with a text box Copyright (c) 2005, Southpaw Technology All Rights Reserved PROPRIETARY INFORMATION. This software is propri...
8,007
en
0.619886
"""This module contains the general information for BiosVfExecuteDisableBit ManagedObject.""" from ...ucsmo import ManagedObject from ...ucscoremeta import MoPropertyMeta, MoMeta from ...ucsmeta import VersionMeta class BiosVfExecuteDisableBitConsts: SUPPORTED_BY_DEFAULT_NO = "no" SUPPORTED_BY_DEFAULT_YES = ...
ucsmsdk/mometa/bios/BiosVfExecuteDisableBit.py
3,294
This is BiosVfExecuteDisableBit class. This module contains the general information for BiosVfExecuteDisableBit ManagedObject.
126
en
0.687176
""" MIT License Copyright (c) 2021 TheHamkerCat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, ...
wbb/modules/webss.py
1,992
MIT License Copyright (c) 2021 TheHamkerCat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, dist...
1,068
en
0.864151
import tweepy from .config import Config def update_twitter_banner(api: tweepy.API) -> None: """Update the twitter banner of the current profile using the image specified in config.""" api.update_profile_banner(Config.IMAGE_PATH)
app/twitter.py
241
Update the twitter banner of the current profile using the image specified in config.
85
en
0.332115
# 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! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities fro...
sdk/python/pulumi_azure_native/documentdb/v20210615/private_endpoint_connection.py
15,637
The set of arguments for constructing a PrivateEndpointConnection resource. :param pulumi.Input[str] account_name: Cosmos DB database account name. :param pulumi.Input[str] resource_group_name: The name of the resource group. The name is case insensitive. :param pulumi.Input[str] group_id: Group id of the private endpo...
3,099
en
0.677806
# Copyright (c) 2017 Rocky Bernstein """ Parsing for a trepan2/trepan3k debugger "breakpoint', "list", or "disasm" command arguments This is a debugger location along with: - an optional condition parsing for breakpoints commands - a range or count for "list" commands """ from __future__ import print_function imp...
example/gdb-loc/gdbloc/parser.py
7,525
Location parsing as used in trepan2 and trepan3k for list, breakpoint, and assembly commands Note: function parse() comes from GenericASTBuilder arange_start ::= opt_space arange arange ::= range arange ::= addr_location opt_space COMMA opt_space NUMBER arange ::= addr_location opt_space COMMA opt_space OFFSET arange ...
3,075
en
0.747114
# # 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...
airflow/contrib/hooks/gcp_cloud_build_hook.py
1,169
This module is deprecated. Please use `airflow.providers.google.cloud.hooks.cloud_build`. 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 ...
879
en
0.845277
"""woqlClient.py WOQLClient is the Python public API for TerminusDB""" import copy import gzip import json import os import urllib.parse as urlparse import warnings from collections.abc import Iterable from datetime import datetime from enum import Enum from typing import Any, Dict, List, Optional, Union import reques...
terminusdb_client/woqlclient/woqlClient.py
77,984
Class for API Token Authentication in requests Class for JWT Authentication in requests Enum for the different TerminusDB resources Client for querying a TerminusDB server using WOQL queries. Attributes ---------- server_url: str URL of the server that this client connected. api: str API endpoint for this clie...
23,892
en
0.583796
# # 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 us...
python/pyspark/ml/regression.py
87,662
Accelerated Failure Time (AFT) Model Survival Regression Fit a parametric AFT survival regression model based on the Weibull distribution of the survival time. .. seealso:: `AFT Model <https://en.wikipedia.org/wiki/Accelerated_failure_time_model>`_ >>> from pyspark.ml.linalg import Vectors >>> df = spark.createDataF...
35,918
en
0.58069
# Copyright 2013 OpenStack Foundation # 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 requ...
python/venv/lib/python2.7/site-packages/glanceclient/tests/unit/v2/test_tags.py
2,381
Copyright 2013 OpenStack Foundation 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 l...
606
en
0.86872
from .impl.cloud.rest_api import RestApi from .impl.decorators import with_project from a2ml.api.utils.decorators import error_handler, authenticated from .impl.model import Model from .credentials import Credentials class AugerModel(object): def __init__(self, ctx): self.ctx = ctx self.credential...
a2ml/api/auger/model.py
3,488
@with_project(autocreate=False)@with_project(autocreate=False)@with_project(autocreate=False)
93
en
0.318625
# Generated by Django 2.0.2 on 2018-03-25 23:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('course', '0004_course_tag'), ] operations = [ migrations.AddField( model_name='video', name='url', field...
timecat/apps/course/migrations/0005_video_url.py
413
Generated by Django 2.0.2 on 2018-03-25 23:41
45
en
0.72971
import itertools import math import string import sys from bisect import bisect_left as bi_l from bisect import bisect_right as bi_r from collections import Counter, defaultdict, deque from heapq import heappop, heappush from operator import or_, xor inf = float("inf") from functools import lru_cache, reduc...
jp.atcoder/abc009/abc009_4/17183548.py
95,141
my lib MOD = 998244353 no mod, or mod ≠ prime tree doubling up-stream find direct child of LCA. print(Algebra.bitwise_mat_pow(d, m-k)) print(Algebra.bitwise_dot(Algebra.bitwise_mat_pow(d, m-k), a[::-1].reshape(-1, 1))[0].item()) 0 <= d <= r//2, south edges = [[] for _ in range(n)] tree = GeometryTopology.TreeGraph(n,...
645
en
0.465909
# -*- coding: utf-8 -*- """hw06_training.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1bjAeUIVjt9W8mASk8vw1y2SbuBYuQdlG """ !pip install reports import PIL.Image as Image, requests, urllib, random import argparse, json, PIL.Image, reports, os...
hw06_train.py
21,535
-*- coding: utf-8 -*- Mount google drive to run on Colabfrom google.colab import drivedrive.mount('/content/drive')%cd "/content/drive/My Drive/Colab Notebooks/DeepLearning/hw06/"!pwd!ls Structure of the all_annotations file: indexed by the image filepath, removing the '.jpg' or the string version (with zeros) of the i...
2,926
en
0.675868
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @File : spanish.py @Time : 2020/08/21 @Author : JavierSC @Version : 1.0 @Contact : @Desc : ''' class LangSpanish(object): SETTING = "AJUSTES" VALUE = "VALORES" SETTING_DOWNLOAD_PATH = "Ruta de descarga" SETTING_ONLY_M4...
TIDALDL-PY/tidal_dl/lang/spanish.py
4,230
@File : spanish.py @Time : 2020/08/21 @Author : JavierSC @Version : 1.0 @Contact : @Desc : !/usr/bin/env python -*- encoding: utf-8 -*-
154
fr
0.384257
# -*- coding: utf-8 -*- """ ruobr.ru/api ~~~~~~~~~~~~ Библиотека для доступа к API электронного дневника. Пример: >>> from ruobr_api import Ruobr >>> r = Ruobr('username', 'password') >>> r.getUser() User(id=7592904, status='child', first_name='Иван', last_name='Иванов', middle_name='Иванович', school='69...
ruobr_api/__init__.py
842
ruobr.ru/api ~~~~~~~~~~~~ Библиотека для доступа к API электронного дневника. Пример: >>> from ruobr_api import Ruobr >>> r = Ruobr('username', 'password') >>> r.getUser() User(id=7592904, status='child', first_name='Иван', last_name='Иванов', middle_name='Иванович', school='69-МБОУ "СОШ №69"', school_is_...
542
ru
0.184293
"""grouping module""" from __future__ import absolute_import, division, print_function, unicode_literals from builtins import * import itertools import numpy as np from numpy_indexed.index import as_index import numpy_indexed as npi __author__ = "Eelco Hoogendoorn" __license__ = "LGPL" __email__ = "hoogendoorn.eelco...
numpy_indexed/grouping.py
20,018
GroupBy class contains an index of keys, and extends the index functionality with grouping-specific functionality not sure how i feel about this. explicit is better than implict? Parameters ---------- keys : indexable object sequence of keys to group by axis : int, optional axis to regard as the key-sequence, ...
9,732
en
0.549522
import argparse import os from multiprocessing import Process, Queue import time import logging log = logging.getLogger(__name__) from scipy import linalg import cooler import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.cm import get_cmap from sklearn.cluster import KMeans, Spectr...
schicexplorer/scHicCluster.py
19,632
define the arguments compute overlap of cell_type find found clusters percentage_threshold = 0.8 body = ''
106
en
0.855709
from PySide import QtGui, QtCore import os, subprocess, shutil, re class animQt(QtGui.QMainWindow): def __init__(self): super(animQt, self).__init__() self.setGeometry(250,250,360,100) style = """ QMainWindow, QMessageBox{ background-color: qradialgradient(spread:pad, cx:0....
testing.py
6,913
self.createSetup() print path+each+"/python.exe" self.pyPath.addItem("Z:/workspace_mel/dqepy/py27/Scripts/python.exe")
118
en
0.350689
# -*- coding: utf-8 -*- import codecs import re from os import path from distutils.core import setup from setuptools import find_packages def read(*parts): return codecs.open(path.join(path.dirname(__file__), *parts), encoding='utf-8').read() def find_version(*file_paths): version_fil...
setup.py
1,496
-*- coding: utf-8 -*-
21
en
0.767281
from PauliInteraction import PauliInteraction from Ising import Ising from CoefficientGenerator import CoefficientGenerator from Evaluator import Evaluator #from DataVisualizer import DataVisualizer #from DataLogger import DataLogger import Driver as Driver_H from MasterEquation import MasterEquation from QuantumAn...
main.py
3,459
from DataVisualizer import DataVisualizerfrom DataLogger import DataLoggerfrom mpi4py import MPINUM_TESTS = 1N = 7NUM_INTERACTIONS = int((N * (N - 1)) / 2) MAIN TEST CASES FROM SAMPLE CODE THIS IS NOT USED! Scatterfor i in range(10):test(RAND_COEF, i) THIS IS USED! MPI Initialization If process is master rank, allocate...
949
en
0.880859
# # run this command # $ FLASK_APP=rest.py flask run # # request like this # curl -X POST -H 'Accept:application/json' -H 'Content-Type:application/json' -d '{"start-time":"2019-05-08 09:15", "end-time":"2019-05-08 09:30", "match":"error", "user":"syslog", "password":"mvEPMNThq94LQuys68gR", "count":"true", "sum":"fals...
webui/rest/rest.py
3,129
run this command $ FLASK_APP=rest.py flask run request like this curl -X POST -H 'Accept:application/json' -H 'Content-Type:application/json' -d '{"start-time":"2019-05-08 09:15", "end-time":"2019-05-08 09:30", "match":"error", "user":"syslog", "password":"mvEPMNThq94LQuys68gR", "count":"true", "sum":"false", "exact":"...
345
en
0.488203
""" Gadget class """ # Standard Library Imports # Third Party Imports # Local Imports from static_analyzer.Instruction import Instruction class Gadget(object): """ The Gadget class represents a single gadget. """ def __init__(self, raw_gadget): """ Gadget constructor :param...
src/static_analyzer/Gadget.py
28,398
The Gadget class represents a single gadget. Gadget constructor :param str raw_gadget: raw line output from ROPgadget :return void: Increases gadget's score if the gadget has an intermediate instruction that performs certain operations on the indirect branch target register family. :return void: Increases...
9,494
en
0.783389
import hashlib import requests import sys def valid_proof(last_proof, proof): guess = f'{last_proof}{proof}'.encode() guess_hash = hashlib.sha256(guess).hexdigest() return guess_hash[:6] == "000000" def proof_of_work(last_proof): """ Simple Proof of Work Algorithm - Find a number p' suc...
client_mining_p/miner.py
1,641
Simple Proof of Work Algorithm - Find a number p' such that hash(pp') contains 6 leading zeroes, where p is the previous p' - p is the previous proof, and p' is the new proof What node are we interacting with? Run forever until interrupted Get the last proof from the server and look for a new one When found, POST it ...
490
en
0.887631
# Copyright 2019 The Cirq Developers # # 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 ...
cirq-core/cirq/protocols/equal_up_to_global_phase_protocol.py
4,101
Object which can be compared for equality mod global phase. Approximate comparator. Types implementing this protocol define their own logic for comparison with other types. Args: other: Target object for comparison of equality up to global phase. atol: The minimum absolute tolerance. See `np.isclose()` ...
2,323
en
0.828272
import os import tempfile import pytest import mlagents.trainers.tensorflow_to_barracuda as tf2bc from mlagents.trainers.tests.test_nn_policy import create_policy_mock from mlagents.trainers.settings import TrainerSettings from mlagents.tf_utils import tf from mlagents.model_serialization import SerializationSettings,...
ml-agents/mlagents/trainers/tests/test_barracuda_converter.py
1,935
make sure there are no left-over files test if file exists after conversion currently converter produces small output file even if input file is empty 100 bytes is high enough to prove that conversion was successful cleanup These checks taken from test_barracuda_converter
272
en
0.920832
# Copyright 2016 The TensorFlow 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 applica...
tensorflow/python/training/checkpoint_utils.py
20,260
Returns list of `tf.Variable` that comprise the partitioned variable. Returns checkpoint filename given directory or specific checkpoint file. See `init_from_checkpoint` for documentation. Overrides given variable's initialization op. Sets variable initializer to assign op that initializes variable from tensor's value...
9,829
en
0.777189
from collections import namedtuple import contextlib import pickle import hashlib from llvmlite import ir from llvmlite.llvmpy.core import Type, Constant import llvmlite.llvmpy.core as lc import ctypes from numba import _helperlib from numba.core import ( types, utils, config, lowering, cgutils, imputils, seriali...
numba/core/pythonapi.py
66,327
Encapsulate the result of converting a Python object to a native value, recording whether the conversion was successful and how to cleanup. Internal utils for calling objmode dispatcher from within NPM code. Code generation facilities to call into the CPython C API (and related helpers). The facilities required by...
7,159
en
0.773352
from rest_framework import serializers from .models import Post, Comment, Friendship, Follow, Server, PostCategory, PostAuthorizedAuthor # REST API Serializer JSON https://www.youtube.com/watch?v=V4NjlXiu5WI from users.models import CustomUser class UserSerializer(serializers.ModelSerializer): class Meta: ...
backend/project404_t8/API/serializers.py
1,573
REST API Serializer JSON https://www.youtube.com/watch?v=V4NjlXiu5WI['id', 'username', 'password', 'last_login'] "id", "last_login", "is_superuser", "first_name", "last_name", "email", "is_staff", "is_active", "date_joined", "username", "password", "admin", "timestamp", "groups", "user_permissions" id = serializers.R...
334
en
0.205565
""" AKShare 是基于 Python 的开源财经数据接口库, 实现对股票, 期货, 期权, 基金, 债券, 外汇等金 融产品的量价数据, 基本面数据和另类数据从数据采集, 数据清洗到数据下载的工具, 满足金融数据科学 家, 数据科学爱好者在数据获取方面的需求. 它的特点是利用 AKShare 获取的是基于可信任数据源 发布的原始数据, 广大数据科学家可以利用原始数据进行再加工, 从而得出科学的结论. """ """ 版本更新记录: 0.1.13 更新所有基于 fushare 的接口 0.1.14 更新 requirements.txt 文件 0.1.15 自动安装所需要的 packages 0.1.16 修正部分函数命名 ...
akshare/__init__.py
106,616
AKShare 是基于 Python 的开源财经数据接口库, 实现对股票, 期货, 期权, 基金, 债券, 外汇等金 融产品的量价数据, 基本面数据和另类数据从数据采集, 数据清洗到数据下载的工具, 满足金融数据科学 家, 数据科学爱好者在数据获取方面的需求. 它的特点是利用 AKShare 获取的是基于可信任数据源 发布的原始数据, 广大数据科学家可以利用原始数据进行再加工, 从而得出科学的结论.
201
zh
0.990824
import pytest from ml_api.api.app import create_app from ml_api.api.config import TestingConfig #Fixtures provide an easy way to setup and teardown resources @pytest.fixture def app(): app = create_app(config_object=TestingConfig) with app.app_context(): yield app @pytest.fixture def flask_test_clie...
packages/ml_api/tests/conftest.py
398
Fixtures provide an easy way to setup and teardown resources
60
en
0.79544
import scipy, copy import SloppyCell.Utility load = SloppyCell.Utility.load save = SloppyCell.Utility.save import SloppyCell.ReactionNetworks.Dynamics as Dynamics try: import SloppyCell.Plotting as Plotting except ImportError: pass def setup(paramfile,calcobject,senstrajfile,jtjfile) : """ Set up the quan...
SloppyCell/ReactionNetworks/OptDesign.py
25,614
The number of optimizable variables for the calculation we are considering might be less than the number of parameters for the whole model. We are only working with this calculation so we need to trim down the J^t J (Fisher information) matrix accordingly the change should always be negative NOTE: assuming a 10...
2,015
en
0.804401
# from tensorflow.contrib.training import HParams # from aukit.audio_io import Dict2Obj from dotmap import DotMap import json class Dict2Obj(DotMap): """ 修正DotMap的get方法生成DotMap对象的bug。 Dict2Obj的get方法和dict的get功能相同。 """ def __getitem__(self, k): if k not in self._map: return None...
breaker_audio/component_cmn/synthesizer/hparams.py
19,249
修正DotMap的get方法生成DotMap对象的bug。 Dict2Obj的get方法和dict的get功能相同。 from tensorflow.contrib.training import HParams from aukit.audio_io import Dict2Obj Default hyperparameters Comma-separated list of cleaners to run on text prior to training and eval. For non-English text, you may want to use "basic_cleaners" or "transliterat...
13,610
en
0.78914
# -*- coding: utf8 -*- # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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...
tencentcloud/ims/v20200713/ims_client.py
5,797
控制台识别统计 :param request: Request instance for DescribeImageStat. :type request: :class:`tencentcloud.ims.v20200713.models.DescribeImageStatRequest` :rtype: :class:`tencentcloud.ims.v20200713.models.DescribeImageStatResponse` 图片机器审核明细 :param request: Request instance for DescribeImsList. :type request: :class:`tencentc...
2,089
en
0.353984
# First create a Shuffle list my_shuffle_list = [1,2,3,4,5] # Now Import shuffle from random import shuffle shuffle(my_shuffle_list) print(my_shuffle_list) # check wether shuffle is working or not # Now let's create Guess Game. First create a list mylist = ['','o',''] # Define function which will used furth...
python_basics/Method_ function/mixed_function_guess_game.py
1,083
First create a Shuffle list Now Import shuffle check wether shuffle is working or not Now let's create Guess Game. First create a list Define function which will used further First check your mylist without shuffle Now check that function for shuffle worning or not Now create function for user to take input as guess nu...
364
en
0.813774
# qubit number=5 # total number=45 import cirq import qiskit from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute, transpile from pprint import pprint from qiskit.test.mock import FakeVigo from math import log2,floor, sqrt, pi import numpy as np import networkx as ...
benchmark/startQiskit953.py
4,076
qubit number=5 total number=45 implement the oracle O_f^\pm NOTE: use U1 gate (P gate) with \lambda = 180 ==> CZ gate or multi_control_Z_gate (issue 127) oracle.h(controls[n]) oracle.barrier() circuit begin number=3 number=4 number=5 number=6 number=21 number=1 number=2 number=7 number=42 number=43 number=44 number=8 n...
580
en
0.226324
from django.shortcuts import render from accounts import models from rest_framework import viewsets from rest_framework.authentication import TokenAuthentication from rest_framework.permissions import IsAuthenticated from rest_framework.authtoken.views import ObtainAuthToken from rest_framework.settings import api_set...
backend/accounts/views.py
1,953
Handles creating, reading and updating patient info readings Sets the patient profile to the logged in user Will use this to tell API what data to exect when making a POST PUT PATCH request to API This points to the Validates that a user is authenticated to read or modify objects overriding this function so that when...
873
en
0.776555
def now(): print('2017-05-31') now.__name__ f = now f.__name__ # 定义记录log的装饰器 def log(func): def wrapper(*args, **kw): print('call %s():' % func.__name__) return func(*args, **kw) return wrapper @log def now1(): print('2017-05-31') # 如果 decorator 需要传入参数,需要编写一个返回 decorator 的高阶函数 d...
python01/PythonDecorator.py
1,035
定义记录log的装饰器 如果 decorator 需要传入参数,需要编写一个返回 decorator 的高阶函数 带参数
60
zh
0.992897
""" mbase module This module contains the base model class from which all of the other models inherit from. """ import abc import os import shutil import threading import warnings import queue as Queue from datetime import datetime from shutil import which from subprocess import Popen, PIPE, STDOUT import copy im...
flopy/mbase.py
56,165
MODFLOW-based models base class. Parameters ---------- modelname : str, default "modflowtest" Name of the model, which is also used for model file names. namefile_ext : str, default "nam" Name file extension, without "." exe_name : str, default "mf2k.exe" Name of the modflow executable. model_ws : str, opt...
15,346
en
0.623829
df['A'] # A # --------- # -0.613035 # -1.265520 # 0.763851 # -1.248425 # 2.105805 # 1.763502 # -0.781973 # 1.400853 # -0.746025 # -1.120648 # # [100 rows x 1 column]
h2o-docs/src/booklets/v2_2015/source/Python_Vignette_code_examples/python_select_column_name.py
179
A --------- -0.613035 -1.265520 0.763851 -1.248425 2.105805 1.763502 -0.781973 1.400853 -0.746025 -1.120648 [100 rows x 1 column]
134
en
0.166234
# -*- coding: utf-8 -*- """Docstring Parsers/Formatters""" # TODO: break this module up into smaller pieces import sys import re from textwrap import dedent from collections import OrderedDict from itertools import islice from .autodocstring_logging import logger PY3k = sys.version_info[0] == 3 if PY3k: string...
docstring_styles.py
35,713
Handle parsing / modifying / writing docstrings Styles understood by napoleon, aka. Google/Numpy Args: names (list): list of names types (str): string describing data types description (str): description text tag (int): some meaningful index? not fleshed out yet descr_only (bool): only description i...
5,546
en
0.773931
# from binho.errors import DriverCapabilityError class binhoAccessory: """ Base class for objects representing accessory boards. """ # Optional: subclasses can set this variable to override their accessory name. # If not provided, their name will automatically be taken from their class names. # This ...
binho/accessory.py
1,590
Base class for objects representing accessory boards. Returns a list of available neighbors. Creates a new binhoAccessory object from its name. Default implementation of a function that returns a class's name. Optional: subclasses can set this variable to override their accessory name. If not provided, their name...
682
en
0.853585
# coding: utf-8 """ flyteidl/service/admin.proto No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: version not set Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import...
gen/pb_python/flyteidl/service/flyteadmin/test/test_admin_pager_duty_notification.py
1,044
AdminPagerDutyNotification unit test stubs Test AdminPagerDutyNotification flyteidl/service/admin.proto No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: version not set Generated by: https://github.com/swagger-api/swagger-codege...
520
en
0.481734
__author__ = 'Burgos, Agustin - Schelotto, Jorge' # -*- coding: utf-8 -*- # Copyright 2018 autors: Burgos Agustin, Schelotto Jorge # # 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 res...
Clases/Palabras.py
3,347
Controla los eventos y coliciones de los sprites Palabras -*- coding: utf-8 -*- Copyright 2018 autors: Burgos Agustin, Schelotto Jorge 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 rest...
1,280
en
0.709984
""" Configuration file for py.test """ import django def pytest_configure(): from django.conf import settings settings.configure( DEBUG=True, USE_TZ=True, USE_I18N=True, ROOT_URLCONF="tests.urls", DATABASES={ "default": { "ENGINE": "django.d...
conftest.py
1,220
Configuration file for py.test
30
en
0.625989
import sys from subprocess import Popen import cx_Oracle root_directory = sys.argv[1] def main(directory): public_projects = get_public_project_accessions() for project_accession in public_projects: Popen(['./runAnnotator.sh', directory, str(project_accession)]) # get all the project references fr...
scripts/batchAnnotator.py
1,187
get all the project references from pride archive connect to pride archive database connect to archive database Create an cursor object for archive database
156
en
0.642029
# Timing functionality from Python's built-in module from time import perf_counter from functools import lru_cache def timer(fn): def inner(*args): start = perf_counter() result = fn(*args) end = perf_counter() elapsed = end - start print(result) print('elapsed', el...
lesson3-functional_programming/timing.py
732
Timing functionality from Python's built-in module @timer @lru_cache() def fib(n): if n < 2: return n return fib(n-1) + fib(n-2) fib(25)
152
en
0.476997
from echo import CallbackProperty, SelectionCallbackProperty, keep_in_sync, delay_callback from matplotlib.colors import to_rgba from glue.core.message import LayerArtistUpdatedMessage from glue.core.state_objects import State from glue.viewers.common.state import ViewerState, LayerState from glue.utils import defe...
glue/viewers/matplotlib/state.py
11,291
A callback property where drawing is deferred until after notify has called all callback functions. A callback property where drawing is deferred until after notify has called all callback functions. A base class that includes common attributes for viewers based on Matplotlib. A base class that includes common attribut...
1,226
en
0.940934
#!/usr/bin/env python3 import os import platform import shutil import sys from urllib import request import bs4 import patoolib url = "http://bearware.dk/teamtalksdk" cd = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) def get_url_suffix_from_platform() -> str: machine = platform.machine() i...
tools/ttsdk_downloader.py
3,906
!/usr/bin/env python3
21
fr
0.448822
# Copyright (C) 2019 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
test/sampleData/micropython/MCP4725.py
4,326
Microchip 4725 Digital-to-Analog Converter Swap the endianness of a number Only allows you to send fully on or off If EEPROM is set, the saved voltage output will be loaded from power-on. VOut = (Vcc * value) / 4096 The output is a range between 0 and Vcc with steps of Vcc/4096. In a 3.3v system, each step is 800 micro...
1,524
en
0.809681
# Charlie Conneely # Score Keeper from player import Player ranks_file = "rankings.txt" class ScoreKeeper: def __init__(self): self.ranks = [] """ Check if player score ranks against scores in rankings.txt """ def check_ranking(self, p): self.populate_ranks_array(ranks_file) ...
score_system.py
1,990
Charlie Conneely Score Keeper check score against rankings Clear ranks array sort ranks array by scores remove the last item
124
en
0.669745
import numpy as np import pandas as pd import scipy.stats from .utils_complexity_embedding import complexity_embedding from .entropy_shannon import entropy_shannon def entropy_distribution(signal=None, delay=1, dimension=3, bins="Sturges", base=2): """**Distribution Entropy (DistrEn)** Distribution Entropy ...
neurokit2/complexity/entropy_distribution.py
3,817
**Distribution Entropy (DistrEn)** Distribution Entropy (**DistrEn**, more commonly known as **DistEn**). Parameters ---------- signal : Union[list, np.array, pd.Series] The signal (i.e., a time series) in the form of a vector of values. delay : int Time delay (often denoted *Tau* :math:`\tau`, sometimes refe...
1,838
en
0.673718
import numpy as np import pandas as pd import matlibplot.pyplot as plt ''' Simulating Solow-Swan model, which attempts to model the long-run economic growth by looking at capital accumulation (K), population growth (L) and technological progress, which results in increase in productivity. It models the total product...
macro_lib/growth/solow.py
7,248
A: total factor productivity k0: the initial amount of capital delta: rate of depreciation of cpiatal s: the saving rate n: the population growth rate alpha: output elasticity of capital starting_year: update k update tupdate y
229
en
0.539963
#!/usr/local/bin/python # based on code by henryk ploetz # https://hackaday.io/project/5301-reverse-engineering-a-low-cost-usb-co-monitor/log/17909-all-your-base-are-belong-to-us # and the wooga office weather project # https://blog.wooga.com/woogas-office-weather-wow-67e24a5338 import os, sys, fcntl, time, socket fr...
monitor.py
3,563
!/usr/local/bin/python based on code by henryk ploetz https://hackaday.io/project/5301-reverse-engineering-a-low-cost-usb-co-monitor/log/17909-all-your-base-are-belong-to-us and the wooga office weather project https://blog.wooga.com/woogas-office-weather-wow-67e24a5338 Create a metric to track time spent and requests ...
703
en
0.83155
# -*- coding: utf-8 -*- import os.path as osp #import netCDF4 #from netcdf_helpers.reader import say_hello, get_time_series_from_location #from plot.plot import plot_time_series_for_locations #from sklearn.model_selection import train_test_split #from sklearn.preprocessing import MinMaxScaler import numpy as np ...
SK_Clustering_WIP.py
5,281
-*- coding: utf-8 -*-import netCDF4from netcdf_helpers.reader import say_hello, get_time_series_from_locationfrom plot.plot import plot_time_series_for_locationsfrom sklearn.model_selection import train_test_splitfrom sklearn.preprocessing import MinMaxScalerimport cartopy.crs as ccrssay_hello() set a path to the direc...
2,444
en
0.752714
""" Listas Listas em Python funcionam como vetores/matrizes (arrays) em outras linguagens, com a diferença de serem DINÂMICO e também de podermos colocar QUALQUER tipo de dado. Linguagens C/Java: Arrays - Possuem tamanho e tipo de dado fixo; Ou seja, nestas linguagens se você criar um array do tipo int e com tamanh...
Python/Programação_em_Python_Essencial/5- Coleções/listas.py
8,882
Listas Listas em Python funcionam como vetores/matrizes (arrays) em outras linguagens, com a diferença de serem DINÂMICO e também de podermos colocar QUALQUER tipo de dado. Linguagens C/Java: Arrays - Possuem tamanho e tipo de dado fixo; Ou seja, nestas linguagens se você criar um array do tipo int e ...
8,938
pt
0.927231
import sys import numpy as np import cv2 def overlay(img, glasses, pos): sx = pos[0] ex = pos[0] + glasses.shape[1] sy = pos[1] ey = pos[1] + glasses.shape[0] if sx < 0 or sy < 0 or ex > img.shape[1] or ey > img.shape[0]: return img1 = img[sy:ey, sx:ex] img2 = glasses[:, :, 0:3]...
project/snowapp/snow.py
2,387
cam open XML file load Video process
36
en
0.755343
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals try: from builtins import object from builtins import str except ImportError: from __bu...
external/rocksdb/buckifier/targets_builder.py
2,974
Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
69
en
0.949347
# Copyright 2017 Bruno Ribeiro, Mayank Kakodkar, Pedro Savarese # # 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 applicabl...
py/util/config.py
5,765
Copyright 2017 Bruno Ribeiro, Mayank Kakodkar, Pedro Savarese 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...
678
en
0.859146
# The Core of Toby from flask import Flask, request, jsonify, g import os import logging from ax.log import trace_error from ax.connection import DatabaseConnection from ax.datetime import now from ax.tools import load_function, get_uuid, decrypt from ax.exception import InvalidToken logger = logging.getLogger('werkz...
toby.py
2,111
Closes the database again at the end of the request. Opens a new database connection if there is none yet for the current application context. The Core of Toby app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False verify token
227
en
0.723737
# -*- coding: utf-8 -*- # Copyright 2020 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
google/ads/googleads/v10/services/services/feed_service/client.py
19,826
Service to manage feeds. Metaclass for the FeedService client. This provides class-level methods for building and retrieving support objects (e.g. transport) without polluting the client instance objects. Releases underlying transport's resources. .. warning:: ONLY use as a context manager if the transport is NOT...
8,006
en
0.746857
# Standard Library import unittest # YouTubeTimestampRedditBot from src.utils.youtube import is_youtube_url_without_timestamp class Youtube(unittest.TestCase): def test_is_youtube_url_without_timestamp(self): dicts = [ # no timestamps {"input": "https://youtube.com/asdf", "expecte...
tests/unit/utils/test_youtube.py
1,136
Standard Library YouTubeTimestampRedditBot no timestamps has timestamps not youtube
83
en
0.721571
''' Harness Toolset Copyright (c) 2015 Rich Kelley Contact: @RGKelley5 RK5DEVMAIL[A T]gmail[D O T]com www.frogstarworldc.com License: MIT ''' import threading import builtins import sys from random import randint from harness.core import framework from harness.core import threads from collect...
harness/core/module.py
3,912
Harness Toolset Copyright (c) 2015 Rich Kelley Contact: @RGKelley5 RK5DEVMAIL[A T]gmail[D O T]com www.frogstarworldc.com License: MIT ----------------------------------------------------- Thread Events must be initialized before framework due to print function thread controls in ModuleFrame ---------...
638
en
0.438159
""" load the dataset example and return the maximum image size, which is used to definite the spike generation network; images with different size are focused onto the center of the spike generation network; the generated poisson spikes are recorded and saved for further use. """ """ on 12th November by xiaoquinNUDT ve...
Spike generation/spike_recorder_focal.py
7,116
read input images (vector), dump into '.pickle' format for next load, and return it as a numpy array. load the dataset example and return the maximum image size, which is used to definite the spike generation network; images with different size are focused onto the center of the spike generation network; the generated...
1,406
en
0.468026
# https://repl.it/@thakopian/day-4-2-exercise#main.py # write a program which will select a random name from a list of names # name selected will pay for everyone's bill # cannot use choice() function # inputs for the names - Angela, Ben, Jenny, Michael, Chloe # import modules import random # set varialbles for in...
BEGIN/DAY_04/04.1-day-4-2-exercise-solution.py
1,817
https://repl.it/@thakopian/day-4-2-exercisemain.py write a program which will select a random name from a list of names name selected will pay for everyone's bill cannot use choice() function inputs for the names - Angela, Ben, Jenny, Michael, Chloe import modules set varialbles for input and another to modify the inpu...
1,443
en
0.849895
# -*- coding: utf-8 -*- from .expr import * def_Topic( Title("Legendre polynomials"), Section("Particular values"), Entries( "9bdf22", "217521", "d77f0a", "9b7f05", "a17386", "13f971", "a7ac51", "3df748", "674afa", "85eebc", ...
formulas/legendre_polynomial.py
11,141
-*- coding: utf-8 -*- todo: also valid on CC? Bounds and inequalities
69
en
0.876843
from django.db import models import os def get_image_path(instance, filename): return os.path.join('pics', str(instance.id), filename) # Create your models here. class Pets(models.Model): pet_foto = models.ImageField(upload_to=get_image_path, blank=True, null=True) DOG = 'C' CAT = 'G' ...
src/doghouse/models.py
1,341
Create your models here.
24
en
0.920486
# coding: utf-8 """ TextMagic API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: 2 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six ...
TextMagic/models/reopen_chats_bulk_input_object.py
3,947
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. Returns true if both objects are equal ReopenChatsBulkInputObject - a model defined in Swagger Returns true if both objects are not equal For `print` and `pprint` Gets the all of this ReopenChatsBulkInputObject. ...
1,368
en
0.683554
import os import unittest import abc from funkyvalidate.examples.existing_directory import ExistingDirectory from funkyvalidate.examples.existing_file import ExistingFile from funkyvalidate import InterfaceType, meets form_path = lambda *parts: os.path.abspath(os.path.join(*parts)) test_dir = form_path(__file__, '...
funkyvalidate/tests/test_interfaces.py
6,507
This cannot be instantiated, even though the instance overrides first_name. I believe this to be buggy behavior, however, it is shared by abc.ABCMeta. (IE its not my fault). These test __instancecheck__ and __subclasscheck__, which depend on the meets function. AlsoClass does not meet the interface as a class, but...
1,317
en
0.778528
# Copyright 2017 VMware, 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 a...
vmware_nsx/services/lbaas/nsx_v3/v2/lb_driver_v2.py
8,794
Helper class to make any subclass of LoadBalancerBaseDriver explode if it is missing any of the required object managers. Prevent removing a router GW or deleting a router used by LB Copyright 2017 VMware, Inc. All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you may not use t...
1,552
en
0.877938
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2017-11-26 15:51 from __future__ import unicode_literals import datetime from django.db import migrations, models from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('core', '0009_auto_20171126_1058'), ...
check/core/migrations/0010_auto_20171126_1351.py
1,781
-*- coding: utf-8 -*- Generated by Django 1.11.7 on 2017-11-26 15:51
68
en
0.638266