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 |
|---|---|---|---|---|---|---|
# Copyright (C) 2020-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
import csv
import os
import os.path as osp
from datumaro.components.annotation import (
AnnotationType, Bbox, Label, LabelCategories, Points,
)
from datumaro.components.converter import Converter
from datumaro.components.extractor import... | datumaro/plugins/vgg_face2_format.py | 13,023 | Copyright (C) 2020-2021 Intel Corporation SPDX-License-Identifier: MIT | 70 | de | 0.432609 |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import argparse
from mo.graph.graph import Graph
from mo.pipeline.common import get_ir_version
from mo.utils import class_registration
def unified_pipeline(argv: argparse.Namespace):
graph = Graph(cmd_params=argv, name=argv.model_... | model-optimizer/mo/pipeline/unified.py | 637 | Copyright (C) 2018-2021 Intel Corporation SPDX-License-Identifier: Apache-2.0 | 77 | en | 0.245491 |
from pyFilter.py_filter import PyFilter
if __name__ == "__main__":
p = PyFilter()
try:
p.run()
except KeyboardInterrupt:
print("\nClosing PyFilter")
finally:
p.make_persistent(loop=False) # Save any outstanding bans without the constant loop
if p.settings["database"] ==... | run.py | 437 | Save any outstanding bans without the constant loop | 51 | en | 0.741078 |
import codecs
import json
from tqdm import tqdm
import copy
submit_result2 = []
with codecs.open('dialog_chinese-macbert.txt', mode='r', encoding='utf8') as f:
reader = f.readlines(f)
data_list = []
for dialogue_idx_, dialogue_ in enumerate(tqdm(reader)):
dialogue_ = json.loads(dialogue_)
submit_re... | predict/ensemble.py | 6,187 | elif submit_result5[dialogue_idx_]['dialog_info'][content_idx_]['ner'][_ner_idx]['attr'] == '其他': dialogue_['dialog_info'][content_idx_]['ner'][_ner_idx]['attr'] = submit_result5[dialogue_idx_]['dialog_info'][content_idx_]['ner'][_ner_idx]['attr'] | 275 | en | 0.103931 |
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randn(10,3),columns=['a','b','c'],index=list('abcdefghij'))
print(df)
df.ix[::2,0] = np.nan; df.ix[::4,1] = np.nan; df.ix[::3,2] = np.nan;
df = df.dropna(subset=['a','b']) #mid delete rows where df['htm3']==na
bins = np.arange(-3,3,0.1)
bins = [-10... | BasicOperations/05_Pandas/05_Pandas_02_groupby.py | 726 | mid delete rows where df['htm3']==na | 36 | en | 0.675062 |
"""All functions return a Component so you can easily pipe or compose them.
There are two types of functions:
- decorators: return the original component
- containers: return a new component
"""
from functools import lru_cache
import numpy as np
from omegaconf import OmegaConf
from pydantic import validate_argument... | gdsfactory/functions.py | 6,594 | Return Component with a new port.
Add a settings label to a component.
Args:
component:
layer_label:
settings: tuple or list of settings. if None, adds all changed settings
Return component inside a new component with text geometry.
Args:
component:
text: text string.
text_offset: relative to ... | 2,102 | en | 0.625287 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019/2/19 11:06
# @User : zhunishengrikuaile
# @File : TrainTicket.py
# @Email : binary@shujian.org
# @MyBlog : WWW.SHUJIAN.ORG
# @NetName : 書劍
# @Software: 百度识图Api封装
# 火车票识别
import os
import base64
import requests
from bin.AccessToken.AccessToken imp... | utils/BaiduTextApi/BaiduTextApi/bin/TrainTicket/TrainTicket.py | 1,509 | 异步接口获取ID
@image
!/usr/bin/env python3 -*- coding: utf-8 -*- @Time : 2019/2/19 11:06 @User : zhunishengrikuaile @File : TrainTicket.py @Email : binary@shujian.org @MyBlog : WWW.SHUJIAN.ORG @NetName : 書劍 @Software: 百度识图Api封装 火车票识别 | 241 | fr | 0.180231 |
# Authors: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
from warnings import warn
from copy import deepcopy
import os.path as op
import numpy as np
from scipy import linalg
from ..externals.six import BytesIO
from datetime import da... | mne/fiff/meas_info.py | 21,274 | Info class to nicely represent info dicts
Summarize info instead of printing all
Aux function
Read extra blocks from fid
Read fiducials from a fiff file
Returns
-------
pts : list of dicts
List of digitizer points (each point in a dict).
coord_frame : int
The coordinate frame of the points (one of
mne... | 3,685 | en | 0.613813 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import numpy as np
import tensorflow as tf
from niftynet.layer.activation import ActiLayer
from niftynet.layer.convolution import ConvolutionalLayer
from niftynet.layer.deconvolution import DeconvolutionalLayer
from niftynet.laye... | niftynet/network/simulator_gan.py | 10,290 | implementation of
Hu et al., "Freehand Ultrasound Image Simulation with Spatially-Conditioned
Generative Adversarial Networks", MICCAI RAMBO 2017
https://arxiv.org/abs/1707.05392
-*- coding: utf-8 -*- not passed in as a placeholder feature channels design pattern compute output n_feature_channels of i-th layer comput... | 667 | en | 0.693371 |
# Desafio 42 - Aula 12 : Refazer Desasfio 35 e mostrar qual o tipo do triangulo.
# A/ Equilatero.
# B/ Isósceles.
# C/ Escaleno.
print('\033[32mATENÇÃO! VAMOS MONTAR UM TRIÂNGULO!!!\033[m')
a = int(input('Digite a primeira medida: '))
b = int(input('Digite a segunda medida: '))
c = int(input('Digite a terceira medid... | desafios/Mundo 2/Ex042.py | 842 | Desafio 42 - Aula 12 : Refazer Desasfio 35 e mostrar qual o tipo do triangulo. A/ Equilatero. B/ Isósceles. C/ Escaleno. | 121 | pt | 0.742032 |
"""
pyAutoSpec
Spectral learning for WFA/MPS
"""
from .wfa import Wfa, SpectralLearning
from .mps import Mps
from .plots import parallel_plot
from .function_wfa import FunctionWfa
from .function_mps import FunctionMps
from .dataset_mps import DatasetMps
from .image_wfa import ImageWfa
__all__ = ["Wfa", "Mps", "paral... | pyautospec/__init__.py | 407 | pyAutoSpec
Spectral learning for WFA/MPS | 41 | en | 0.719463 |
# -*- coding: utf-8 -*-
import sys
from os.path import dirname, abspath, normpath, join, realpath
from os import listdir, remove, system
import json
from datetime import datetime
begin = len(normpath(abspath(join(dirname(__file__), "../.."))))
end = len(normpath(abspath(join(dirname(__file__), ".."))))
MAIN_DIR = dir... | pyleecan/Generator/run_generate_classes.py | 4,082 | Generate pyleecan Classes code according to doc in root_path
Parameters
----------
root_path : str
Path to the main folder of Pyleecan
gen_dict : dict
Generation dictionnary (contains all the csv data)
Returns
-------
None
-*- coding: utf-8 -*- Add the directory to the python path List of the main packages (... | 576 | en | 0.649802 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Single NN
@author: xuping
"""
import numpy as np
import scipy.io
#from threeNN import sigmoid
def layer_sizes(X, Y):
n_in = X.shape[0]
n_out = Y.shape[0]
return(n_in, n_out)
def initialize_parameters(dim):
np.random.seed(3)
W = np.random.ran... | NN_buildingblock/SingleNN.py | 2,887 | Single NN
@author: xuping
!/usr/bin/env python2 -*- coding: utf-8 -*-from threeNN import sigmoidforwardcost = 1./m*np.sum(np.sum(np.square(A-Y)))backwarddW = 1./m*np.dot(dZ, X.T)np.random.seed(3)load dataparameters5, cost5 = nn_model(X5, Y5, num_iterations, lambd, learning_rate, print_cost=True)parameters10, cost10 =... | 554 | en | 0.312823 |
# the TestEnv environment is used to simply simulate the network
from flow.envs import TestEnv
# the Experiment class is used for running simulations
from flow.core.experiment import Experiment
# the base network class
from flow.networks import Network
from flow.envs.base import Env
# all other imports are standard
... | traci_pedestrian_crossing/movexy_ped.py | 22,992 | See class definition.
See class definition.
check whether a person has requested to cross the street
See class definition.
See class definition.
See class definition.
See parent class.
This also includes updating the initial absolute position and previous
position.
Advance the environment by one step.
Assigns actions... | 5,896 | en | 0.800143 |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 24 14:52:03 2020
@author: DELL
"""
import pandas as pd
data = pd.read_csv('http://187.191.75.115/gobmx/salud/datos_abiertos/datos_abiertos_covid19.zip', encoding = 'ANSI')
res = data[data['ENTIDAD_RES'] == 31]
res.to_csv('data_yuc_actualizado.csv', index = False) | datos_yuc_actualizado.py | 317 | Created on Fri Apr 24 14:52:03 2020
@author: DELL
-*- coding: utf-8 -*- | 74 | en | 0.864873 |
#!/usr/bin/env python
import unittest
from ct.proto import client_pb2
from ct.proto import test_message_pb2
from ct.serialization import tls_message
valid_test_message = test_message_pb2.TestMessage()
valid_test_message.uint_8 = 0
valid_test_message.uint_16 = 258
valid_test_message.uint_24 = 197637
valid_test_messa... | vendor/github.com/google/certificate-transparency/python/ct/serialization/tls_message_test.py | 10,987 | !/usr/bin/env python Test vectors are given as a list of serialized, hex-encoded components. 0: uint_8 1: uint_16 2: uint_24 3: uint_32 4: uint_48 5: uint_64 6: fixed_bytes 7: var_bytes 8: var_bytes2 9: vector_bytes 10: vector_uint32 11: test_enum 12: select_uint32 13: embedded_message.uint_32 14: repeated_message var_... | 835 | en | 0.797192 |
# coding: utf-8
import codecs
import re
import json
from budget2013_common import *
class Budget2013_37_SubTable1Item(object):
def __init__(self):
self._no = None
self._purpose = None
self._principal = None
self._value = None
self._regress = None
self._check = None
self._other = []
@property
def n... | federal/2013/code/budget2013_37.py | 10,833 | coding: utf-8 caption subtable1 caption subtable1 headers subtable1 data no + purpose principal value regress check other ИТОГО notes subtable2 caption subtable2 headerssubtable2 data | 183 | en | 0.124983 |
"""
Baseline CNN, losss function and metrics
Also customizes knowledge distillation (KD) loss function here
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class Flatten(nn.Module):
def forward(self, input):
return input.view(input.size(0), -1)
"""
This is t... | model/studentB.py | 6,169 | We define an convolutional network that predicts the sign from an image. The components
required are:
Args:
params: (Params) contains num_channels
Compute the accuracy, given the outputs and labels for all images.
Args:
outputs: (np.ndarray) output of the model
labels: (np.ndarray) [0, 1, ..., num_classes... | 2,597 | en | 0.763691 |
from typing import TypedDict
from cff.models.cloudfront_event import CloudFrontEvent
class Record(TypedDict):
"""Record of an event that raised a Lambda event."""
cf: CloudFrontEvent
"""The CloudFront event that raised this Lambda event."""
| cff/models/record.py | 257 | Record of an event that raised a Lambda event. | 46 | en | 0.961025 |
"""
Django settings for toDoList project.
Generated by 'django-admin startproject' using Django 2.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
... | toDoList/toDoList/settings.py | 3,462 | Django settings for toDoList project.
Generated by 'django-admin startproject' using Django 2.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
Build paths inside... | 989 | en | 0.642836 |
from .spark_cluster import SparkCluster
from staroid import Staroid
import requests
import os, stat, time
from pathlib import Path
class Ods:
def __init__(self, staroid=None, ske=None, cache_dir=None):
self.__ske = None
if staroid == None:
self._staroid = Staroid()
else:
... | ods/ods.py | 4,416 | create (if not exists) or return cache dir path for module
configure from env var configure from args if instnace is stopped, restart wait for phase to become RUNNING sleep check | 180 | en | 0.623735 |
# -*- coding: utf-8 -*-
# Copyright 2020 The PsiZ 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 r... | examples/rank/mle_3g.py | 10,845 | Build kernel for single group.
Build model.
Arguments:
n_stimuli: Integer indicating the number of stimuli in the
embedding.
n_dim: Integer indicating the dimensionality of the embedding.
Returns:
model: A TensorFlow Keras model.
Return a ground truth embedding.
Run the simulation that infers an e... | 2,806 | en | 0.821421 |
#Reverse the input array
# input : {5,4,3,2,1}
# output : {1,2,3,4,5}
arr = list(map(int,input().split()))
for i in range(len(arr)):
arr.push(a[-1])
arr.remove(a[-1])
print(arr) | Python/test.py | 187 | Reverse the input array input : {5,4,3,2,1} output : {1,2,3,4,5} | 64 | en | 0.122725 |
import pandas as pd
import time
from google import google
import sys
from A00_File_name import file_name
file_df = pd.read_csv(file_name, sep=';', encoding='latin-1')
print(file_df.head())
brand_names_list = file_df['Official Chain Name'].tolist()
'''
create a column with Official Brand WWWs
'''
# ... | A01_WEB_BROWSER_get_Official_WWWs_create_COM_domain.py | 2,149 | https://github.com/abenassi/Google-Search-API | 45 | en | 0.531244 |
"""Representation of a WeMo Motion device."""
from .api.long_press import LongPressMixin
from .switch import Switch
class LightSwitch(Switch, LongPressMixin):
"""Representation of a WeMo Motion device."""
def __repr__(self):
"""Return a string representation of the device."""
return '<WeMo Li... | pywemo/ouimeaux_device/lightswitch.py | 490 | Representation of a WeMo Motion device.
Return a string representation of the device.
Return what kind of WeMo this device is.
Representation of a WeMo Motion device. | 166 | en | 0.769214 |
import requests
import json
class BuddyAPI():
'''
An API of buddymojo.com
:returns: An API
'''
def __init__(self):
self.payload = {'type': 'friend',
'action': 'finish'}
self.payloadf = {'userQuizId': 1,
'type': 'friend',
... | buddymojoAPI/BuddyMojoAPI.py | 3,539 | An API of buddymojo.com
:returns: An API
Returns a url string of the id.
:params ID: The id to get the url from.
:type ID: int
:returns: A url string.
:rtype: String
Returns a user id string of the encUserQuizId.
Send messages to a range of users id.
:params start: The start user id.
:type start: int
:params end: ... | 684 | en | 0.542352 |
# Copyright 2021 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... | official/vision/beta/modeling/factory_test.py | 5,019 | Tests for factory.py.
Copyright 2021 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 a... | 639 | en | 0.850785 |
from model import *
from data import *
from keras.preprocessing.image import ImageDataGenerator
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
data_gen_args = dict(rotation_range=0.2,
width_shift_range=0.05,
height_shift_range=0.05,
shear_range=0.05,
... | main.py | 2,463 | test_dir = "data/membrane/test" test_datagen = ImageDataGenerator(rescale=1./255) test_generator = test_datagen.flow_from_directory( test_dir, target_size=(256, 256), color_mode="grayscale", batch_size=1) test_path = "data/membrane/test" image_datagen = ImageDataGenerator(**data_gen_args... | 1,110 | en | 0.226079 |
# © Copyright IBM Corporation 2020.
#
# LICENSE: Apache License 2.0 (Apache-2.0)
# http://www.apache.org/licenses/LICENSE-2.0
"""
...
"""
# init file
# import cython created shared object files
import sib.c_package # cython with cpp version
# import core functionality
from .sib_main import *
from ._version impor... | src/sib/__init__.py | 393 | ...
© Copyright IBM Corporation 2020. LICENSE: Apache License 2.0 (Apache-2.0) http://www.apache.org/licenses/LICENSE-2.0 init file import cython created shared object files cython with cpp version import core functionality | 225 | en | 0.555048 |
#!/usr/bin/python3
from sys import version_info
from setuptools import setup
if version_info < (3, 5, 3):
raise RuntimeError("aiopm requires Python 3.5.3+")
setup(
name='aiopm',
version='1.1',
description='Async Postmark client (asyncio)',
classifiers=[
'Intended Audience :: Developers',
... | setup.py | 1,384 | !/usr/bin/python3 'Operating System :: MacOS :: MacOS X', 'Development Status :: 5 - Production/Stable', 'CI: Travis': '...', 'Coverage: codecov': '...', 'GitHub: issues': '', 'GitHub: repo': '', | 237 | en | 0.285201 |
import halide as hl
import simple_stub
import complex_stub
def _realize_and_check(f, offset = 0):
b = hl.Buffer(hl.Float(32), [2, 2])
f.realize(b)
assert b[0, 0] == 3.5 + offset + 123
assert b[0, 1] == 4.5 + offset + 123
assert b[1, 0] == 4.5 + offset + 123
assert b[1, 1] == 5.5 + offset + 1... | python_bindings/correctness/pystub.py | 9,020 | ----------- Inputs by-position ----------- Inputs by-name ----------- Above set again, w/ GeneratorParam mixed in (positional) (keyword) ----------- Test various failure modes Inputs w/ mixed by-position and by-name too many positional args too few positional args Inputs that can't be converted to what the receiver nee... | 804 | en | 0.873322 |
from logger import elog, mlog, alog
from db_engine import mysql_connect, mysql_reconnect, get_qs, \
estr, valid_pass, SQLParamError, sql_selectall, \
sql_insertinto, do_param_error, sq, sql_update
import random, time, json, os, os.path, sys, math, types
from utils import *
from... | pyserver/fileapi_local.py | 19,629 | stupid unicode!XXX type(obj) == str:else: raise RuntimeError("unknown object " + str(type(obj)));unix functions; need to test these!strip out '.', so ./path worksos.environ["APPDATA"])os.path.join(get_appdata(), "/.fairmotion")print("Final relative path:", path, len(froot));print("Final name:", self.name)print("PARENT... | 958 | en | 0.468302 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | apps/spark/src/spark/conf.py | 1,391 | !/usr/bin/env python Licensed to Cloudera, Inc. under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Cloudera, Inc. licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use thi... | 759 | en | 0.868888 |
"""
Module holds JMX handlers implementations
Copyright 2017 BlazeMeter 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 appli... | bzt/jmx/tools.py | 30,218 | Helper to build JMeter test plan from Scenario
:type protocol_handlers: dict[str,ProtocolHandler]
:type children: etree.Element
:type req: Request
Generates HTTP Authorization Manager
Generate the test plan
:type executor: ScenarioExecutor
:type original: JMX
Add shaper
:param jmx: JMX
:return:
Detect preferred thread... | 1,496 | en | 0.78949 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import socket
import struct
import asyncio
@asyncio.coroutine
def proxy_data(reader, writer):
try:
while 1:
buf = yield from reader.read(4096)
if not buf:
break
writer.write(buf)
yield... | socksserver.py | 4,574 | !/usr/bin/env python3 -*- coding: utf-8 -*- for random ports Username/password No authentication a (address, port) 2-tuple for AF_INET, a (address, port, flow info, scope id) 4-tuple for AF_INET6 | 195 | en | 0.593343 |
# coding: utf-8
"""
Properties
All HubSpot objects store data in default and custom properties. These endpoints provide access to read and modify object properties in HubSpot. # noqa: E501
The version of the OpenAPI document: v3
Generated by: https://openapi-generator.tech
"""
import pprint
import... | hubspot/crm/properties/models/property_group_update.py | 4,705 | NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Returns true if both objects are equal
PropertyGroupUpdate - a model defined in OpenAPI
Returns true if both objects are not equal
For `print` and `pprint`
Gets the display_order of this Propert... | 1,741 | en | 0.605958 |
from __future__ import print_function
import sys
import logging
import os
os.environ['ENABLE_CNNL_TRYCATCH'] = 'OFF' # pylint: disable=C0413
from itertools import product
import unittest
import torch
import torch_mlu.core.mlu_model as ct
cur_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(cur_dir + "... | test/cnnl/op_test/test_type.py | 8,765 | pylint: disable=C0413 pylint: disable=C0413,C0411 @unittest.skip("not test") @unittest.skip("not test") @unittest.skip("not test") @unittest.skip("not test") @unittest.skip("not test") @unittest.skip("not test") | 211 | en | 0.130675 |
# Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""email package exception classes."""
class MessageError(Exception):
"""Base class for errors in the email package."""
class MessageParseError(MessageError):
"""Base class for message parsing errors... | Src/StdLib/Lib/email/errors.py | 3,535 | Couldn't find terminating boundary.
An illegal charset was given.
A start boundary was found, but not the corresponding close boundary.
A message had a continuation line as its first header line.
Base class for a header defect.
A header that must have a value had none
Error while parsing headers.
base64 encoded sequenc... | 1,594 | en | 0.932007 |
from unittest.mock import ANY, AsyncMock, MagicMock, create_autospec, patch
import aioredis
import pytest
from tests.utils import Keys
from aiocache.backends.redis import RedisBackend, RedisCache, conn
from aiocache.base import BaseCache
from aiocache.serializers import JsonSerializer
pytest.skip("aioredis code is b... | tests/ut/backends/test_redis.py | 12,662 | type: ignore[unreachable] | 25 | en | 0.245221 |
from django.db.models import Max
from datahub.company.models import Company as DBCompany, CompanyPermission
from datahub.core.query_utils import get_aggregate_subquery
from datahub.search.apps import SearchApp
from datahub.search.company.models import Company
class CompanySearchApp(SearchApp):
"""SearchApp for c... | datahub/search/company/apps.py | 1,227 | SearchApp for company. | 22 | en | 0.950199 |
import Gramatica.Gramatica as g
import graphviz
import sys
import threading
import Errores.Nodo_Error as error
import Errores.ListaErrores as lista_err
from tkinter import *
from tkinter import filedialog
from tkinter import font
from tkinter import ttk
#------------------------------------ Interfaz ------------------... | parser/team19/BDTytus/main.py | 3,070 | ------------------------------------ Interfaz ---------------------------------------------------------- | 104 | en | 0.11083 |
import random
# averaging the embeddings between 2 words
# return the averaged embeddings
def average_two_embeddings_vectors(a, b):
avg_embeddings = []
i = 0
for embed in a:
z = (embed + b[i]) / 2.0
avg_embeddings.append(z)
i += 1
return avg_embeddings
# helper func; updates... | support/standardize.py | 7,923 | averaging the embeddings between 2 words return the averaged embeddings helper func; updates tokens and embeddings with the new combined tokens and averaged embeddings return the updated tokens string and embeddings vector update tokens update embeddings delete old tokens and embeddings helper func the words following ... | 1,837 | en | 0.817664 |
# 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-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_py3.py | 7,800 | Describes a Virtual Machine.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource Id
:vartype id: str
:ivar name: Resource name
:vartype name: str
:ivar type: Resource type
:vartype type: str
:p... | 4,747 | en | 0.626091 |
# a = 15*15 + 14*14 + 13*13 + 12*12 + 11*11
# print(a)
# a = 3**33333333 % 100
# b = 7**77777777 % 10
# print(a * b)
# x = 6
# y = 4
# z = 0
# for i in range(1,14):
# z += x*y
# y += 1
# x +=
# print(x, y, z)
# print(z)
# idx = 0
# a = [5,10,20,50,100]
# for i in a:
ax = ... | Code Politan/KSI POSI INFORMATIKA.py | 403 | a = 15*15 + 14*14 + 13*13 + 12*12 + 11*11 print(a) a = 3**33333333 % 100 b = 7**77777777 % 10 print(a * b) x = 6 y = 4 z = 0 for i in range(1,14): z += x*y y += 1 x += print(x, y, z) print(z) idx = 0 a = [5,10,20,50,100] for i in a: | 249 | en | 0.181624 |
import dj_database_url
SECRET_KEY = 'django-migration-docs'
# Install the tests as an app so that we can make test models
INSTALLED_APPS = ['migration_docs', 'migration_docs.tests']
# Database url comes from the DATABASE_URL env var
DATABASES = {'default': dj_database_url.config()}
| settings.py | 285 | Install the tests as an app so that we can make test models Database url comes from the DATABASE_URL env var | 108 | en | 0.872511 |
# -*- coding: utf-8 -*-
# Copyright (C) 2018 by
# Marta Grobelna <marta.grobelna@rwth-aachen.de>
# Petre Petrov <petrepp4@gmail.com>
# Rudi Floren <rudi.floren@gmail.com>
# Tobias Winkler <tobias.winkler1@rwth-aachen.de>
# All rights reserved.
# BSD license.
#
# Authors: Marta Grobelna <marta.grob... | planar_graph_sampler/combinatorial_classes/dissection.py | 7,132 | Represents the class 'I' of irreducible dissections from the paper.
It is however also used for rooted and derived dissections (sizes are incorrect then).
Parameters
----------
half_edge: ClosureHalfEdge
A half-edge on the hexagonal boundary of a closed binary tree.
Gets the three half-edges on the hexagonal bound... | 2,368 | en | 0.868012 |
from flask import Flask, render_template, request, flash, url_for
from flask_mail import Message, Mail
import json
from typing import Dict, List
from pathlib import Path
from forms import ContactForm
from development_config import Config
"""
This file launches the application.
"""
# init application
app = Flask(__nam... | app.py | 3,292 | reads the json files, and formats the description that
is associated with each of the json dictionaries that are read in.
:param json_file: json file to parse from
:param debug: if set to true, will print the json dictionaries as
they are read in
:return: list of all of the json dictionaries
init application add sec... | 684 | en | 0.877038 |
import numpy as np
from caffe2.python import core, workspace
from caffe2.python.test_util import TestCase
from caffe2.proto import caffe2_pb2
class TestPrependDim(TestCase):
def _test_fwd_bwd(self):
old_shape = (128, 2, 4)
new_shape = (8, 16, 2, 4)
X = np.random.rand(*o... | venv/Lib/site-packages/caffe2/python/operator_test/prepend_dim_test.py | 1,556 | Check the shape of the gradient | 31 | en | 0.713439 |
# coding: utf-8
import attr
from ..util.log import sanitize_dictionary
@attr.s(slots=True)
class BoxRequest:
"""Represents a Box API request.
:param url: The URL being requested.
:type url: `unicode`
:param method: The HTTP method to use for... | boxsdk/session/box_request.py | 1,229 | Represents a Box API request.
:param url: The URL being requested.
:type url: `unicode`
:param method: The HTTP method to use for the request.
:type method: `unicode` or None
:param headers: HTTP headers to include with the req... | 670 | en | 0.643058 |
#!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
setup(
author="Faris A Chugthai",
author_email='farischugthai@gmail.com',
description="Python Boilerplate contains all the boilerplate you nee... | setup.py | 873 | The setup script.
!/usr/bin/env python | 39 | en | 0.349468 |
import tensorflow as tf
import numpy as np
import os
from tqdm import tqdm
import argparse
from utils.utils import create_tfr_files, prob_to_secondary_structure
from utils.FastaMLtoSL import FastaMLtoSL
import time
start = time.time()
from argparse import RawTextHelpFormatter
parser = argparse.ArgumentParser()
parser.... | SPOT-RNA.py | 4,593 | parser.add_argument('--NC',default=True, type=bool, help='Set this to "False" to predict only canonical pairs; default = True\n', metavar='')os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' print('RNA name: %s'%(out[1])) | 212 | en | 0.208669 |
import os,sys
import cytnx as cy
class Hising(cy.LinOp):
def __init__(self,L,J,Hx):
cy.LinOp.__init__(self,"mv_elem",2**L,cy.Type.Double,cy.Device.cpu)
## custom members:
self.J = J
self.Hx = Hx
self.L = L
def SzSz(self,i,j,ipt_id):
return ipt_id,(1. - ... | example/ED/ed_ising_mve.py | 1,595 | custom members: let's overload this with custom operation:self.set_elem(oid,a,amp*self.J) def matvec(self,v): out = cy.zeros(v.shape()[0],v.dtype(),v.device()); return out | 177 | en | 0.376182 |
#!/usr/bin/env python
""" Translator Class and builder """
from __future__ import print_function
import codecs
import os
import math
import torch
from tensorboardX import SummaryWriter
from others.utils import rouge_results_to_str, test_rouge, tile
from translate.beam import GNMTGlobalScorer
def build_predictor(ar... | src/models/predictor.py | 17,006 | Container for a translated sentence.
Attributes:
src (`LongTensor`): src word ids
src_raw ([str]): raw src words
pred_sents ([[str]]): words from the n-best translations
pred_scores ([[float]]): log-probs of n-best translations
attns ([`FloatTensor`]) : attention dist for each translation
gold... | 2,938 | en | 0.671323 |
# -*- coding: utf-8 -*-
__version__ = "3.0.0.dev0"
try:
__EMCEE3_SETUP__
except NameError:
__EMCEE3_SETUP__ = False
if not __EMCEE3_SETUP__:
__all__ = [
"moves",
"pools",
"autocorr",
"Model",
"SimpleModel",
"Sampler",
"Ensemble",
"State",
... | emcee3/__init__.py | 506 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
# Copyright 2020 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... | tensorboard/data/experimental/experiment_from_dev_test.py | 11,003 | Test for get_scalars() call that involve inf and nan in user data.
Tests for tensorboard.uploader.exporter.
Copyright 2020 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... | 797 | en | 0.806164 |
import asyncio
import functools
import importlib
import inspect
import logging
from typing import Text, Dict, Optional, Any, List, Callable, Collection, Type
from rasa.shared.exceptions import RasaException
logger = logging.getLogger(__name__)
def class_from_module_path(
module_path: Text, lookup_path: Optional... | rasa/shared/utils/common.py | 6,859 | Helper class to abstract the caching details.
Returns all known (imported) subclasses of a class.
Return the parameters of the function `func` as a list of names.
Caches method calls based on the call's `args` and `kwargs`.
Works for `async` and `sync` methods. Don't apply this to functions.
Args:
f: The decorate... | 2,043 | en | 0.856942 |
# Generated by Django 3.1 on 2020-08-08 05:58
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
opera... | prickly-pufferfish/arena/battle/migrations/0001_initial.py | 1,019 | Generated by Django 3.1 on 2020-08-08 05:58 | 43 | en | 0.687921 |
from django.contrib import admin
from leaflet.admin import LeafletGeoAdmin
from .models import ProblemLabel, ProblemStatus
# Register your models here.
admin.site.register(ProblemLabel, LeafletGeoAdmin)
admin.site.register(ProblemStatus)
| app/problem_register/admin.py | 242 | Register your models here. | 26 | en | 0.957485 |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Transform a roidb into a trainable roidb by adding a bunch of metada... | lib/roi_data_layer/roidb.py | 5,184 | Compute bounding-box regression targets for an image.
Add information needed to train bounding-box regressors.
Enrich the imdb's roidb by adding some derived quantities that
are useful for training. This function precomputes the maximum
overlap, taken over ground-truth boxes, between each ROI and
each ground-truth box.... | 1,438 | en | 0.91677 |
"""This module contains the general information for AdaptorFruCapRef ManagedObject."""
import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class AdaptorFruCapRefConsts():
IS_SUPPORTED_NO = "no"
IS_SUPPORTED_YES = "... | ucsmsdk/mometa/adaptor/AdaptorFruCapRef.py | 3,040 | This is AdaptorFruCapRef class.
This module contains the general information for AdaptorFruCapRef ManagedObject. | 112 | en | 0.635195 |
# 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... | example/gluon/kaggle_k_fold_cross_validation.py | 6,871 | Gets a neural network. Better results are obtained with modifications.
Gets root mse between the logarithms of the prediction and the truth.
Conducts k-fold cross validation for the model.
Trains the model and predicts on the test data set.
Trains the model.
Licensed to the Apache Software Foundation (ASF) under one ... | 2,060 | en | 0.857024 |
#!/usr/bin/env python3
class Solution:
def removeDuplicates(self, nums):
i, ret = 0, 0
for j, n in enumerate(nums):
if nums[i] == n and j-i < 2:
ret += 1
elif nums[i] != n:
i = j
ret += 1
return ret
sol = Solution()
nu... | interview/leet/80_Remove_Duplicates_from_Sorted_Array_II_v2.py | 434 | !/usr/bin/env python3 | 21 | fr | 0.448822 |
#!/usr/bin/env python3
from string import ascii_uppercase
from re import fullmatch
from time import sleep
from random import Random
# Default game presets.
testing_preset = {'height': 10, 'width': 10, '5_ships': 0, '4_ships': 0, '3_ships': 0, '2_ships': 2, '1_ships': 0, 'allow_mines': True, 'allow_moves': True, 'mine... | battleship.py | 62,208 | Class that handles game execution and running.
Controls game setup based off of a certain settings preset.
Handles all input and output for the game.
Attributes
----------
settings : dict
Settings that the game is running based off of.
height : int
Height of the grids used for the game.
width : int
Width ... | 10,164 | en | 0.846345 |
#!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, 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 ... | core/polyaxon/schemas/types/dockerfile.py | 3,317 | !/usr/bin/python Copyright 2018-2020 Polyaxon, 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 w... | 574 | en | 0.83777 |
import os
# toolchains options
ARCH='arm'
CPU='cortex-m3'
CROSS_TOOL='gcc'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
# cross_tool provides the cross compiler
# EXEC_PATH is the compiler execute... | bsp/stm32/stm32f103-mini-system/rtconfig.py | 4,004 | toolchains options bsp lib config cross_tool provides the cross compiler EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR toolchains toolchains toolchains | 186 | en | 0.585943 |
"""
WSGI config for thirdproject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_... | 3_thirdproject/thirdproject/wsgi.py | 401 | WSGI config for thirdproject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ | 218 | en | 0.789304 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# tar command:
# tar czvf mugshots.tar.gz -T mugshot_files.txt
# where the txt is generated by this script
import django
django.setup()
from django.conf import settings
from djforms.scholars.models import Presentation
from djtools.fields import TODAY
YEAR = int(TODAY... | djforms/scholars/tar_mugshots.py | 635 | ! /usr/bin/env python3 -*- coding: utf-8 -*- tar command: tar czvf mugshots.tar.gz -T mugshot_files.txt where the txt is generated by this script list for failed uploadsbunk = [ ]if s.mugshot in bunk: print s.first_name, s.last_name | 235 | en | 0.695172 |
from ibis.sql.compiler import DDL, DML
from .compiler import quote_identifier, _type_to_sql_string
import re
fully_qualified_re = re.compile(r"(.*)\.(?:`(.*)`|(.*))")
def _is_fully_qualified(x):
return bool(fully_qualified_re.search(x))
def _is_quoted(x):
regex = re.compile(r"(?:`(.*)`|(.*))")
quoted,... | ibis/mapd/ddl.py | 9,981 | Create user
Create Table As Select
Create DDL
Parameters
----------
table_name : str
database : str
Create user
Create a view
Create user
noqa: F401 VIEW USER tokens.append(format_tblproperties(self.tbl_properties)) if either database is None, the name is assumed to be fully scoped TODO: varargs '{}...'.format(val) | 318 | en | 0.386356 |
# this script finds all the intersecting tiles for a given input AOI, and then downloads corresponding
# 0.5 meter AHN3 DSM and DTM tiles
from shapely.geometry import Polygon
import geopandas as gpd
import pandas as pd
from tqdm import tqdm
from multiprocessing import Pool
import urllib.request
import zipfile
import ... | download_ahn3_elevation_data.py | 4,625 | this script finds all the intersecting tiles for a given input AOI, and then downloads corresponding 0.5 meter AHN3 DSM and DTM tiles all the tile bounds are in EPSG 28992 reproject the aoi bounds to EPSG 28992 define aoi bounds read csv into dataframe generate shapely geometry iterate through each file Rename the ... | 347 | en | 0.710399 |
import boto3
from queuing_hub.conn.base import BasePub, BaseSub
class AwsBase():
def __init__(self, profile_name=None):
session = boto3.Session(profile_name=profile_name)
self._client = session.client('sqs')
self._queue_list = self._client.list_queues()['QueueUrls']
class AwsPub(AwsBas... | queuing_hub/conn/aws.py | 2,872 | 'ApproximateNumberOfMessagesDelayed', 'ApproximateNumberOfMessagesNotVisible', 'DelaySeconds', 'MessageRetentionPeriod', 'ReceiveMessageWaitTimeSeconds', 'VisibilityTimeout' | 173 | en | 0.114217 |
from django.test import TestCase
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
from core.models import Recipe, Ingredient
RECIPE_URL = reverse('recipe:recipe-list')
def recipe_url(id):
"""Construct URL for a single recipe based on its ID"""
retu... | app/recipe/tests/test_recipe_api.py | 6,633 | Helper function to create a user
Construct URL for a single recipe based on its ID
Test creating a recipe including ingredients
Test deleting a recipe
Test deleting a recipe with ingredients included
Test retrieving a single recipe using name as filter
Test retrieving a recipe
Test retrieving a recipe including ingredi... | 396 | en | 0.908645 |
# 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 use ... | examples/failover.py | 2,068 | 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 use this file ... | 1,178 | en | 0.816688 |
# 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
from ... import _utilities, _tables
from... | sdk/python/pulumi_azure_nextgen/network/v20200701/get_application_gateway.py | 27,598 | Application gateway resource.
Authentication certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits).
Autoscale Configuration.
Backend address pool of the application gateway res... | 4,299 | en | 0.72592 |
from __future__ import (absolute_import, division,print_function, unicode_literals)
from builtins import *
import numpy as np
import cv2
import SimpleITK as sitk
from builtins import *
from scipy.spatial import distance
import sys
import time
############### FUNCTIONS ##########################
def imcomplem... | scripts/image/crack_detection_fast.py | 8,422 | FUNCTIONS print(ct/npoints)DEG=(i)*((360/DEG_NUM)/2)DEG=(i)*((360/DEG_NUM)/2)DEG=(i)*((360/DEG_NUM)/2) MAIN resize if the original size is different from dataset images so we can keep the same parameters for the filters | 221 | en | 0.627533 |
#%% First
import numpy as np
import json
import os
import pandas as pd
import requests
from contextlib import closing
import time
from datetime import datetime
from requests.models import HTTPBasicAuth
import seaborn as sns
from matplotlib import pyplot as plt
from requests import get
from requests_futures.sessions imp... | Pulling data/apiv2_pull.py | 19,968 | Returns True if the response seems to be HTML, False otherwise.
%% First%% warcraftlogs = OAuth2Session(client_id, redirect_uri=callback_uri) authorization_url, state = warcraftlogs.authorization_url(authorize_url, access_type="offline") token = warcraftlogs.fetch_token(token_url = token_url, ... | 781 | en | 0.447057 |
from Tkinter import *
from Tkinter import Text as textcontrol
class StyledTextControl( textcontrol ):
def spaces(self, val):
return str(val*8)
def __screen(self, width, height):
self.
def __init__(self, parent, width, height, fontf, fontsize):
# Predefining Variables
... | lib/stc.py | 919 | Predefining Variables | 21 | en | 0.183492 |
# Copyright 2021 Red Hat, 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 ... | tests/unit/yum_config/mock_modules.py | 670 | Copyright 2021 Red Hat, 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, softw... | 569 | en | 0.858906 |
from litex.soc.cores import uart
from litex.soc.cores.uart import UARTWishboneBridge
from litedram.frontend.bist import LiteDRAMBISTGenerator, LiteDRAMBISTChecker
from litescope import LiteScopeAnalyzer
from litescope import LiteScopeIO
from gateware.memtest import LiteDRAMBISTCheckerScope
from targets.utils import... | targets/mimasv2/scope.py | 1,581 | Litescope for analyzing the BIST output -------------------- self.spiflash.cs_n, self.spiflash.clk, self.spiflash.dq_oe, self.spiflash.dqi, self.spiflash.sr, | 172 | en | 0.201882 |
# 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 https://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function
from distutils.spawn import find_executable
from distutils.vers... | python/servo/bootstrap.py | 15,201 | Dispatches to the right bootstrapping function for the OS.
Bootstrapper for MSVC building on Windows.
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 https://mozilla.org/MPL/2.0/. Please keep these in s... | 1,689 | en | 0.888844 |
#!/usr/bin/env python
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='p... | setup.py | 1,218 | !/usr/bin/env python Get the long description from the README file https://pypi.python.org/pypi?%3Aaction=list_classifiers 4 - Beta 5 - Production/Stable It might work in other versions, but these are not testet. | 216 | en | 0.678904 |
"""
Copyright (c) 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. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
import unittest
import s1a... | lte/gateway/python/integ_tests/s1aptests/test_sctp_abort_after_smc.py | 2,604 | testing Sctp Abort after Security Mode Command for a single UE
Copyright (c) 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. An additional grant
of patent rights can be found in the PATENTS ... | 347 | en | 0.91211 |
'''
Borrowed from Asteroid.py and Ship.py which was created by Lukas Peraza
url: https://github.com/LBPeraza/Pygame-Asteroids
Subzero sprite borrowed from: https://www.spriters-resource.com/playstation/mkmsz/sheet/37161/
'''
import pygame
import os
from CollegiateObjectFile import CollegiateObject
# right in var... | CharacterFile.py | 14,894 | Borrowed from Asteroid.py and Ship.py which was created by Lukas Peraza
url: https://github.com/LBPeraza/Pygame-Asteroids
Subzero sprite borrowed from: https://www.spriters-resource.com/playstation/mkmsz/sheet/37161/
right in variable means facing right, left means facing left Create a list of every image of a ... | 1,403 | en | 0.88369 |
# 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-mgmt-eventgrid/azure/mgmt/eventgrid/models/number_not_in_advanced_filter.py | 1,425 | NumberNotIn Filter.
All required parameters must be populated in order to send to Azure.
:param key: The filter key. Represents an event property with upto two
levels of nesting.
:type key: str
:param operator_type: Required. Constant filled by server.
:type operator_type: str
:param values: The set of filter values... | 801 | en | 0.635212 |
import os
import sys
import socket
import struct
import SocketServer
import threadpool
# fake ip list
FAKE_IPLIST = {}
# dns server config
TIMEOUT = 2 # set timeout 2 second
TRY_TIMES = 5 # try to recv msg times
DNS_SERVER = '8.8.8.8' # remote dns server
# currently not used
def bytetodomain(... | DNSFilter.py | 4,364 | fake ip list dns server config set timeout 2 second try to recv msg times remote dns server currently not used qtype is 1 (mean query HOST ADDRESS), qclass is 1 (mean INTERNET) position for response much faster rebinding udp dns packet no length set socket timeout = 5s load config file, iplist.txt from https://github.c... | 341 | en | 0.82295 |
"""Djinni manager tool"""
import os
import ezored.functions as fn
import ezored.logging as log
from ezored import constants as const
# -----------------------------------------------------------------------------
def run(params={}):
args = params['args']
if len(args) > 0:
action = args[0]
... | files/commands/djinni/djinni.py | 1,563 | Djinni manager tool
----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ----------------------------------------------------------------... | 333 | en | 0.132544 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymongo
import datetime
from scrapy.conf import settings
# 学历列表
educations = ("不限","大专","本科","硕士","博士")
#修正学历 有些职位中的学历明显... | spider/python/tutorial/pipelines.py | 3,902 | -*- coding: utf-8 -*- Define your item pipelines here Don't forget to add your pipeline to the ITEM_PIPELINES setting See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html 学历列表修正学历 有些职位中的学历明显不一致。需要修正判断PHP是否在职位名称中,不在就过滤掉。jd中含有php不参考,因为很多jd中都乱写处理直聘网数据处理51job数据 | 267 | zh | 0.389656 |
# BSD 2-Clause License
# Copyright (c) 2018, Stan Sakl
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this
# list of ... | kwic_python/kwic.py | 1,918 | BSD 2-Clause License Copyright (c) 2018, Stan Sakl All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and th... | 1,321 | en | 0.879645 |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import A... | python/ccxt/async_support/bytetrade.py | 44,292 | -*- coding: utf-8 -*- PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.mdhow-to-contribute-code new metainfo interface Kline of a symbol Market Depth of a symbol Trade records of a symbol Reference information of trading instrument, including b... | 4,323 | en | 0.745309 |
import pytest
import numpy as np
from ebbef2p.structure import Structure
L = 2
E = 1
I = 1
def test_center_load():
P = 100
M_max = P * L / 4 # maximum moment
S_max = P/2 # max shearing force
w_max = -P * L ** 3 / (48 * E * I) # max displacement
tolerance = 1e-6 #set a tolerance of 0.00... | tests/test_simple supported_beam.py | 1,829 | maximum moment max shearing force max displacementset a tolerance of 0.0001% maximum moment max shearing force max displacementset a tolerance of 0.01% | 153 | en | 0.403153 |
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
class Hwloc(AutotoolsPackage):
"""The Hardware Locality (hwloc) software project.
The Portable Hardwa... | var/spack/repos/builtin/packages/hwloc/package.py | 4,815 | The Hardware Locality (hwloc) software project.
The Portable Hardware Locality (hwloc) software package
provides a portable abstraction (across OS, versions,
architectures, ...) of the hierarchical topology of modern
architectures, including NUMA memory nodes, sockets, shared
caches, cores and simultaneous multithread... | 1,001 | en | 0.898575 |
# System Imports
import cv2
import json
from typing import Optional
# Library imports
import numpy
# Twisted Import
from twisted.internet import reactor, defer, threads, protocol
from twisted.internet.endpoints import TCP4ClientEndpoint
from twisted.internet.interfaces import IAddress
# Package Imports
from .data im... | src/octopus/image/source.py | 4,903 | Byte 1: command
Byte 2-5: length
Byte 6+: data
Get an image from the camera.
Returns an Image object.
Get an image from the camera.
Returns a SimpleCV Image.
System Imports Library imports Twisted Import Package Imports Set picture capture dimensions def connectionMade(self): if self._camera_id is not None: ... | 456 | en | 0.522363 |
import numpy as np
import logging
import unittest
import os
import scipy.linalg as LA
import time
from sklearn.utils import safe_sqr, check_array
from scipy import stats
from pysnptools.snpreader import Bed,Pheno
from pysnptools.snpreader import SnpData,SnpReader
from pysnptools.kernelreader import KernelNp... | fastlmm/inference/linear_regression.py | 19,437 | A linear regression predictor, that works like the FastLMM in fastlmm_predictor.py, but that expects all similarity matrices to be identity.
**Constructor:**
:Parameters: * **covariate_standardizer** (:class:`Standardizer`) -- The PySnpTools standardizer to be apply to X, the covariate data. Some choices include ... | 10,422 | en | 0.656375 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""Fake demo records."""
import datetime
import json
import ran... | invenio_rdm_records/fixtures/demo.py | 8,539 | Singleton to store some vocabulary entries.
This is needed because otherwise expensive random picking would have to be
done for every call to create_fake_record().
Even then, we shouldn't load all vocabularies' entries in memory
(at least not big ones).
Create records for demo purposes.
Generates a fake publication_d... | 1,992 | en | 0.587955 |
# Generated by Django 3.2.5 on 2021-07-09 16:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0009_auto_20210709_1606'),
]
operations = [
migrations.AlterField(
model_name='account',
name='conf_labe... | backend/accounts/migrations/0010_auto_20210709_1658.py | 1,836 | Generated by Django 3.2.5 on 2021-07-09 16:58 | 45 | en | 0.759278 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ListMembers
# Retrieves the email addresses of members of a MailChimp list.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
... | temboo/Library/MailChimp/ListMembers.py | 4,839 | An InputSet with methods appropriate for specifying the inputs to the ListMembers
Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
A ResultSet with methods tailored to the values returned by the ListMembers Choreo.
The ResultSet object is used to retrieve the results of a Chor... | 2,499 | en | 0.708699 |
#!/usr/bin/env python
"""
Script which takes one or more file paths and reports on their detected
encodings
Example::
% chardetect somefile someotherfile
somefile: windows-1252 with confidence 0.5
someotherfile: ascii with confidence 1.0
If no paths are provided, it takes its input from stdin.
"""
# C... | venv/lib/python3.8/site-packages/pip/_vendor/chardet/cli/chardetect.py | 2,821 | Return a string describing the probable encoding of a file or
list of strings.
:param lines: The lines to get the encoding of.
:type lines: Iterable of bytes
:param name: Name of file or collection of lines
:type name: str
Handles command line arguments and gets things started.
:param argv: List of arguments, as if s... | 893 | en | 0.704874 |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import time
import math
from fair... | fairseq/meters.py | 4,348 | Computes and stores the average and current value
Computes the sum/avg duration of some event in seconds
Computes the average occurrence of some event per second
Copyright (c) 2017-present, Facebook, Inc. All rights reserved. This source code is licensed under the license found in the LICENSE file in the root directo... | 624 | en | 0.8774 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | dev/scratch/sphinx-quickstart/conf.py | 5,359 | -*- coding: utf-8 -*- Configuration file for the Sphinx documentation builder. This file does only contain a selection of the most common options. For a full list see the documentation: http://www.sphinx-doc.org/en/master/config -- Path setup -------------------------------------------------------------- If extensions ... | 4,081 | en | 0.595275 |
import os
import sys
import logging
import io
from xml.sax.saxutils import escape
import template
#===============================================================================
#===============================================================================
class _TemplateHandler(object):
def __init__(self, pr... | scripts/genproject/eclipse.py | 5,405 | ============================================================================================================================================================== Get toolchain build path ex:'/opt/arm-2012.03/bin' on Mac add homebrew path to compiler path Get toolchain cross prefix ex:'arm-none-linux-gnueabi-' or '' for na... | 670 | en | 0.394952 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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 requir... | ceilometerclient/tests/v2/test_trait_descriptions.py | 2,121 | Copyright 2014 Hewlett-Packard Development Company, L.P. 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.856178 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.