hexsha stringlengths 40 40 | size int64 4 996k | ext stringclasses 8
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 4 996k | avg_line_length float64 1.33 58.2k | max_line_length int64 2 323k | alphanum_fraction float64 0 0.97 | content_no_comment stringlengths 0 946k | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
79012566e499cbd48cac0b024328d5d1ff49f78a | 272 | py | Python | apps/challenge/serializers/clan.py | mehrbodjavadi79/AIC21-Backend | 9f4342781f0722804a2eb704b43b52984c81b40a | [
"MIT"
] | 3 | 2021-03-12T18:32:39.000Z | 2021-11-08T10:21:04.000Z | apps/challenge/serializers/clan.py | mehrbodjavadi79/AIC21-Backend | 9f4342781f0722804a2eb704b43b52984c81b40a | [
"MIT"
] | null | null | null | apps/challenge/serializers/clan.py | mehrbodjavadi79/AIC21-Backend | 9f4342781f0722804a2eb704b43b52984c81b40a | [
"MIT"
] | 2 | 2021-01-29T14:52:53.000Z | 2022-03-05T10:24:24.000Z | from rest_framework import serializers
from apps.challenge.models import Clan
class ClanSerializer(serializers.ModelSerializer):
class Meta:
model = Clan
fields = (
'name', 'leader', 'image', 'score', 'wins', 'losses', 'draws'
)
| 22.666667 | 73 | 0.632353 | from rest_framework import serializers
from apps.challenge.models import Clan
class ClanSerializer(serializers.ModelSerializer):
class Meta:
model = Clan
fields = (
'name', 'leader', 'image', 'score', 'wins', 'losses', 'draws'
)
| true | true |
79012662b4270c3d1b6d7ea3dfe0f5c6576f3f9a | 302 | py | Python | djcookie_demo_proj/conftest.py | muutttu/djcookie_demo_proj | a023fdbdbf90560daf29cf9ee626393a3b4ea30d | [
"MIT"
] | null | null | null | djcookie_demo_proj/conftest.py | muutttu/djcookie_demo_proj | a023fdbdbf90560daf29cf9ee626393a3b4ea30d | [
"MIT"
] | null | null | null | djcookie_demo_proj/conftest.py | muutttu/djcookie_demo_proj | a023fdbdbf90560daf29cf9ee626393a3b4ea30d | [
"MIT"
] | null | null | null | import pytest
from djcookie_demo_proj.users.models import User
from djcookie_demo_proj.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> User:
return UserFactory()
| 20.133333 | 64 | 0.791391 | import pytest
from djcookie_demo_proj.users.models import User
from djcookie_demo_proj.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> User:
return UserFactory()
| true | true |
790126d1da63826dbfb07210b34108d89c42d1a0 | 2,992 | py | Python | app/app.py | tjdaley/publicdataws | 1aa4a98cf47fae10cc0f59a8d01168df806b4919 | [
"MIT"
] | null | null | null | app/app.py | tjdaley/publicdataws | 1aa4a98cf47fae10cc0f59a8d01168df806b4919 | [
"MIT"
] | null | null | null | app/app.py | tjdaley/publicdataws | 1aa4a98cf47fae10cc0f59a8d01168df806b4919 | [
"MIT"
] | null | null | null | """
app.py - Flask-based server.
@author Thomas J. Daley, J.D.
@version: 0.0.1
Copyright (c) 2019 by Thomas J. Daley, J.D.
"""
import argparse
import random
from flask import Flask, render_template, request, flash, redirect, url_for, session, jsonify
from wtforms import Form, StringField, TextAreaField, PasswordField,... | 28.769231 | 98 | 0.734626 | import argparse
import random
from flask import Flask, render_template, request, flash, redirect, url_for, session, jsonify
from wtforms import Form, StringField, TextAreaField, PasswordField, validators
from functools import wraps
from views.decorators import is_admin_user, is_logged_in, is_case_set
from webservice... | true | true |
790126edbd7d91701d3b3d02b8852ca27bbe5606 | 416 | py | Python | Taller-de-Estrucuras-de-Control-Repeticion/ejercicio 9.py | Davidpadilla1234/Taller-de-Estrucuras-de-Control-Repeticion | 5fd3f058a8007e6e6d886959149c7d5e42f26a3a | [
"MIT"
] | null | null | null | Taller-de-Estrucuras-de-Control-Repeticion/ejercicio 9.py | Davidpadilla1234/Taller-de-Estrucuras-de-Control-Repeticion | 5fd3f058a8007e6e6d886959149c7d5e42f26a3a | [
"MIT"
] | null | null | null | Taller-de-Estrucuras-de-Control-Repeticion/ejercicio 9.py | Davidpadilla1234/Taller-de-Estrucuras-de-Control-Repeticion | 5fd3f058a8007e6e6d886959149c7d5e42f26a3a | [
"MIT"
] | null | null | null | un = 0
re = 0
gramo = 0
mientras que es cierto :
numero = int ( entrada ( "" ))
si ( numero == 4 ):
descanso
si ( numero == 1 ):
un = un + 1
elif ( numero == 2 ):
re = re + 1
elif ( numero == 3 ):
gramo = gramo + 1
elif ( numero == 4 ):
de... | 24.470588 | 88 | 0.435096 | un = 0
re = 0
gramo = 0
mientras que es cierto :
numero = int ( entrada ( "" ))
si ( numero == 4 ):
descanso
si ( numero == 1 ):
un = un + 1
elif ( numero == 2 ):
re = re + 1
elif ( numero == 3 ):
gramo = gramo + 1
elif ( numero == 4 ):
de... | false | true |
79012714af783f40450f1f7a34a623e977db7c54 | 286 | py | Python | vmall/pipelines.py | gikoluo/vmall | 285e4156ba68d7e14be417801c262897101c8486 | [
"MIT"
] | null | null | null | vmall/pipelines.py | gikoluo/vmall | 285e4156ba68d7e14be417801c262897101c8486 | [
"MIT"
] | null | null | null | vmall/pipelines.py | gikoluo/vmall | 285e4156ba68d7e14be417801c262897101c8486 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
class VmallPipeline(object):
def process_item(self, item, spider):
return item
| 23.833333 | 65 | 0.70979 |
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
class VmallPipeline(object):
def process_item(self, item, spider):
return item
| true | true |
79012948ddbd0051e478defc15a182e6c0e5cda8 | 2,987 | py | Python | setup.py | maxwu/ci-stat | e8ed2f5d4d43afdc3afc0689435881202efbcbb3 | [
"MIT"
] | 1 | 2017-04-23T02:52:02.000Z | 2017-04-23T02:52:02.000Z | setup.py | maxwu/cistat | e8ed2f5d4d43afdc3afc0689435881202efbcbb3 | [
"MIT"
] | 2 | 2017-05-28T12:48:35.000Z | 2017-06-19T11:22:40.000Z | setup.py | maxwu/cistat | e8ed2f5d4d43afdc3afc0689435881202efbcbb3 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Public Title.
Doc str for module users
.. moduleauthor:: Max Wu <http://maxwu.me>
.. References::
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
.. Test Samples in doctest format
>>> None
"""
from setupt... | 29.87 | 79 | 0.634416 |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
with open('requirements.txt') as f:
required = f.read().splitlines()
with open(p... | true | true |
79012996927d899f532bbb0579b4390baf69efd5 | 4,685 | py | Python | InteractionTracker/accounts/models.py | desertzebra/Lean-UX-Platform | 1b61a4b4e0af6fc08e052fb22b4141e65122ef9a | [
"Apache-2.0"
] | 34 | 2019-03-11T08:10:16.000Z | 2021-12-14T05:53:22.000Z | InteractionTracker/accounts/models.py | shahidzaffar/Lean-UX-Platform | 40c46c0421dd21cdfca254db689bf566c95e4d6a | [
"Apache-2.0"
] | 6 | 2020-11-17T06:57:39.000Z | 2022-01-04T16:51:41.000Z | InteractionTracker/accounts/models.py | shahidzaffar/Lean-UX-Platform | 40c46c0421dd21cdfca254db689bf566c95e4d6a | [
"Apache-2.0"
] | 28 | 2019-03-11T08:10:19.000Z | 2021-12-14T06:02:37.000Z | """
# Interaction Tracker
# @license http://www.apache.org/licenses/LICENSE-2.0
# Author @ Jamil Hussain, Zaki
"""
from django.conf import settings
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.core.validators import RegexValidator
from django.db import models
from dj... | 29.099379 | 110 | 0.646105 |
from django.conf import settings
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.core.validators import RegexValidator
from django.db import models
from django.db.models.signals import post_save
from .utils import code_generator
USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'
clas... | true | true |
79012ae549279f92da52b3f15e21f5a44f6e7d42 | 753 | py | Python | AudioFile.py | CoryXie/SpeechShadowing | a0190ce488b754e5c9a6828a3510a665294864f0 | [
"MIT"
] | null | null | null | AudioFile.py | CoryXie/SpeechShadowing | a0190ce488b754e5c9a6828a3510a665294864f0 | [
"MIT"
] | null | null | null | AudioFile.py | CoryXie/SpeechShadowing | a0190ce488b754e5c9a6828a3510a665294864f0 | [
"MIT"
] | null | null | null |
from pydub import AudioSegment
from pydub.playback import play
import os
import utils
class audiofile:
def __init__(self, file):
""" Init audio stream """
self.file = file
def play(self):
""" Play entire file """
utils.displayInfoMessage('Playing Audio')
pathpa... | 25.965517 | 67 | 0.628154 |
from pydub import AudioSegment
from pydub.playback import play
import os
import utils
class audiofile:
def __init__(self, file):
self.file = file
def play(self):
utils.displayInfoMessage('Playing Audio')
pathparts = self.file.rsplit(".", 1)
fileformat = pathparts[1]
... | true | true |
79012b0a8825f72490fa1900112437ae89e9a963 | 5,320 | py | Python | python_scripts/03_categorical_pipeline_sol_01.py | leonsor/scikit-learn-mooc | 27c5caf7b0d2f0cc734baee59ad65efc263704cd | [
"CC-BY-4.0"
] | 1 | 2022-01-25T19:20:21.000Z | 2022-01-25T19:20:21.000Z | python_scripts/03_categorical_pipeline_sol_01.py | gmash24/scikit-learn-mooc | b58f051efb591a38859a4242369c9494ccac6a17 | [
"CC-BY-4.0"
] | null | null | null | python_scripts/03_categorical_pipeline_sol_01.py | gmash24/scikit-learn-mooc | b58f051efb591a38859a4242369c9494ccac6a17 | [
"CC-BY-4.0"
] | null | null | null | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.6.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# # 📃 Solution for Exercise M1.04
#
... | 37.202797 | 123 | 0.755827 |
cessor is assembled in a pipeline with
# `LogisticRegression`. The generalization performance of the pipeline can be
# evaluated by cross-validation and then compared to the score obtained when
# using `OneHotEncoder` or to some other baseline score.
#
# First, we load the dataset.
# %%
import pandas as... | true | true |
79012b6bcab788292571d51f675e4af415834ad9 | 2,816 | py | Python | data.py | IFFranciscoME/trading-project | 55c6ce679b6d859f80a4726266e0c4bc719755b5 | [
"MIT"
] | 1 | 2022-03-08T06:03:42.000Z | 2022-03-08T06:03:42.000Z | data.py | IFFranciscoME/trading-project | 55c6ce679b6d859f80a4726266e0c4bc719755b5 | [
"MIT"
] | null | null | null | data.py | IFFranciscoME/trading-project | 55c6ce679b6d859f80a4726266e0c4bc719755b5 | [
"MIT"
] | null | null | null |
# -- --------------------------------------------------------------------------------------------------- -- #
# -- project: A python project for algorithmic trading in FXCM -- #
# -- ----------------------------------------------------------------------------------------------... | 44.698413 | 109 | 0.393111 |
import fxcmpy
import pandas as pd
api_token = "ba432..."
con = fxcmpy.fxcmpy(access_token=api_token, server='demo', log_level='error', log_file='fxcm_logs.txt')
def fxcm_ohlc(p_instrument, p_period, p_ini, p_end):
data_ohlc = con.get_candles(instrument=p_instrument, period=p_period,
... | true | true |
79012c98f41ed59afab30e18ab63b304f177d16d | 22,952 | py | Python | egs/librispeech/ASR/conformer_mmi/decode.py | aarora8/icefall | 8cb7f712e413fffbcdfdd865be73d6ff43f0ce7a | [
"Apache-2.0"
] | null | null | null | egs/librispeech/ASR/conformer_mmi/decode.py | aarora8/icefall | 8cb7f712e413fffbcdfdd865be73d6ff43f0ce7a | [
"Apache-2.0"
] | null | null | null | egs/librispeech/ASR/conformer_mmi/decode.py | aarora8/icefall | 8cb7f712e413fffbcdfdd865be73d6ff43f0ce7a | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# Copyright 2021 Xiaomi Corporation (Author: Liyong Guo, Fangjun Kuang)
#
# See ../../../../LICENSE for clarification regarding multiple authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain ... | 33.02446 | 91 | 0.605132 |
import argparse
import logging
from collections import defaultdict
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import k2
import sentencepiece as spm
import torch
import torch.nn as nn
from asr_datamodule import LibriSpeechAsrDataModule
from conformer import Conformer
from... | true | true |
79012e1fe05f97211877e7f016653b49e98150cb | 5,754 | py | Python | src/index_runner/es_indexers/sample_set.py | slebras/index_runner | 997374fdf47c58b001e1fd844b4af27f6af3d76c | [
"MIT"
] | null | null | null | src/index_runner/es_indexers/sample_set.py | slebras/index_runner | 997374fdf47c58b001e1fd844b4af27f6af3d76c | [
"MIT"
] | null | null | null | src/index_runner/es_indexers/sample_set.py | slebras/index_runner | 997374fdf47c58b001e1fd844b4af27f6af3d76c | [
"MIT"
] | null | null | null | from src.utils.config import config
import json
# import uuid
import requests
_NAMESPACE = "WS"
_VER_NAMESPACE = "WSVER"
_SAMPLE_NAMESPACE = "SMP"
# versioned and non-versioned index have same version
_SAMPLE_SET_INDEX_VERSION = 1
_SAMPLE_SET_INDEX_NAME = 'sample_set_' + str(_SAMPLE_SET_INDEX_VERSION)
_VER_SAMPLE_SET... | 36.417722 | 111 | 0.590024 | from src.utils.config import config
import json
import requests
_NAMESPACE = "WS"
_VER_NAMESPACE = "WSVER"
_SAMPLE_NAMESPACE = "SMP"
_SAMPLE_SET_INDEX_VERSION = 1
_SAMPLE_SET_INDEX_NAME = 'sample_set_' + str(_SAMPLE_SET_INDEX_VERSION)
_VER_SAMPLE_SET_INDEX_NAME = 'sample_set_version_' + str(_SAMPLE_SET_INDEX_VERSIO... | true | true |
79012e8ba9e024bf36080d05dc89f82953d35edf | 1,068 | py | Python | oct/util/playbook.py | staebler/origin-ci-tool | 2cb86c3cad7a37450e711571ac75997118c899e5 | [
"Apache-2.0"
] | 23 | 2017-01-06T21:32:09.000Z | 2022-03-14T17:14:49.000Z | oct/util/playbook.py | staebler/origin-ci-tool | 2cb86c3cad7a37450e711571ac75997118c899e5 | [
"Apache-2.0"
] | 129 | 2017-01-06T18:29:51.000Z | 2022-01-27T17:37:21.000Z | oct/util/playbook.py | staebler/origin-ci-tool | 2cb86c3cad7a37450e711571ac75997118c899e5 | [
"Apache-2.0"
] | 52 | 2017-01-06T16:03:49.000Z | 2022-01-24T18:58:58.000Z | # coding=utf-8
"""
A utility module for working with playbooks in the `origin-ci-tool` repository.
"""
from __future__ import absolute_import, division, print_function
from os.path import abspath, dirname, exists, join
from click import ClickException
def playbook_path(playbook_name):
"""
Get the path to th... | 29.666667 | 118 | 0.707865 |
from __future__ import absolute_import, division, print_function
from os.path import abspath, dirname, exists, join
from click import ClickException
def playbook_path(playbook_name):
from ..oct import __file__ as root_path
for parent_repo in ['oct', 'openshift-ansible']:
playbook_file = join(abspa... | true | true |
79012f8da0a0040279480db03d5e4b0738c17c2c | 3,354 | py | Python | pridcon/utils.py | Mirindi95/PrIDcon | 2deaef197727e62f8a56c2ba0ebfb9594e55ad12 | [
"MIT"
] | 1 | 2021-02-11T10:46:23.000Z | 2021-02-11T10:46:23.000Z | pridcon/utils.py | Mirindi95/PrIDcon | 2deaef197727e62f8a56c2ba0ebfb9594e55ad12 | [
"MIT"
] | null | null | null | pridcon/utils.py | Mirindi95/PrIDcon | 2deaef197727e62f8a56c2ba0ebfb9594e55ad12 | [
"MIT"
] | null | null | null | def read_fasta(filename):
"""Returns a list of tuples of each header and sequence in a fasta (or multifasta) file.
first element in tuple is header and second the sequence.
Key Arguments:
filename -- fasta file.
"""
tmp_seq = None
seqs_list = []
with open(filename, 'r') as fasta... | 37.266667 | 118 | 0.589147 | def read_fasta(filename):
tmp_seq = None
seqs_list = []
with open(filename, 'r') as fasta_file:
for line in fasta_file:
line = line.replace('\n','')
if '>' in line:
if tmp_seq != None:
seqs_list.append((hd, tmp_seq))
tmp_seq... | true | true |
790131cd9d7c076bd447ebb36385a3eb1d0961be | 1,519 | py | Python | train-app/helper_functions.py | pivotal-legacy/moves | c946a66b35af355353b648f3736ceee46c00edeb | [
"Apache-2.0"
] | 4 | 2018-04-27T14:30:15.000Z | 2020-01-15T01:54:21.000Z | train-app/helper_functions.py | pivotal-legacy/moves | c946a66b35af355353b648f3736ceee46c00edeb | [
"Apache-2.0"
] | null | null | null | train-app/helper_functions.py | pivotal-legacy/moves | c946a66b35af355353b648f3736ceee46c00edeb | [
"Apache-2.0"
] | null | null | null | import json
import os
import pandas
import redis
import types
def json2redis(data,r):
if isinstance(data, types.ListType):
for row in data:
channel = row['channel']
data_type = row['data_type']
rkey = 'channel_{}_{}'.format(channel,data_type)
r.lpush(rkey,ro... | 29.784314 | 72 | 0.574062 | import json
import os
import pandas
import redis
import types
def json2redis(data,r):
if isinstance(data, types.ListType):
for row in data:
channel = row['channel']
data_type = row['data_type']
rkey = 'channel_{}_{}'.format(channel,data_type)
r.lpush(rkey,ro... | true | true |
790132aad9c447a13fd54c300127bc54b57c25a8 | 1,464 | py | Python | detectron/lib/python3.6/site-packages/caffe2/python/onnx/onnxifi.py | JustinBear99/Mask_RCNN | d43eaf7c6ebf29d4d6da796a0f7ff5561e21acff | [
"Apache-2.0"
] | null | null | null | detectron/lib/python3.6/site-packages/caffe2/python/onnx/onnxifi.py | JustinBear99/Mask_RCNN | d43eaf7c6ebf29d4d6da796a0f7ff5561e21acff | [
"Apache-2.0"
] | null | null | null | detectron/lib/python3.6/site-packages/caffe2/python/onnx/onnxifi.py | JustinBear99/Mask_RCNN | d43eaf7c6ebf29d4d6da796a0f7ff5561e21acff | [
"Apache-2.0"
] | null | null | null | ## @package onnx
#Module caffe2.python.onnx.onnxifi
"""
ONNXIFI a Caffe2 net
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace
import ca... | 29.877551 | 85 | 0.602459 | re__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace
import caffe2.python._import_c_extension as C
import numpy as np
def onnxifi_caffe2_net(
pred... | true | true |
79013348c6a77e28ea1c7c9c2338a7ab1db8253a | 2,952 | py | Python | python/evaluate_division.py | shub0/leetcode | 8221d10f201d001abcb15b27c9cf4b8cd5060f1f | [
"BSD-3-Clause"
] | null | null | null | python/evaluate_division.py | shub0/leetcode | 8221d10f201d001abcb15b27c9cf4b8cd5060f1f | [
"BSD-3-Clause"
] | null | null | null | python/evaluate_division.py | shub0/leetcode | 8221d10f201d001abcb15b27c9cf4b8cd5060f1f | [
"BSD-3-Clause"
] | null | null | null | '''
Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers. If the answer does not exist, return -1.0.
Example:
Given a / b = 2.0, b / c = 3.0.
queries are: a / c = ?, b / a = ?, a / e = ?, ... | 35.566265 | 240 | 0.542005 | '''
Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers. If the answer does not exist, return -1.0.
Example:
Given a / b = 2.0, b / c = 3.0.
queries are: a / c = ?, b / a = ?, a / e = ?, ... | false | true |
79013424f233c162748f93eb9247598f7aa19885 | 934 | py | Python | human_services/locations/serializers.py | DarwishMenna/pathways-backend | e9825e0373c586ce8f07ee8b70aecc7de679fb41 | [
"BSD-3-Clause"
] | null | null | null | human_services/locations/serializers.py | DarwishMenna/pathways-backend | e9825e0373c586ce8f07ee8b70aecc7de679fb41 | [
"BSD-3-Clause"
] | null | null | null | human_services/locations/serializers.py | DarwishMenna/pathways-backend | e9825e0373c586ce8f07ee8b70aecc7de679fb41 | [
"BSD-3-Clause"
] | null | null | null | from rest_framework import serializers
from human_services.locations import models
from human_services.addresses.serializers import AddressSerializer
from human_services.phone_at_location.serializers import PhoneAtLocationSerializer
class LocationAddressSerializer(serializers.ModelSerializer):
address = AddressSe... | 38.916667 | 82 | 0.756959 | from rest_framework import serializers
from human_services.locations import models
from human_services.addresses.serializers import AddressSerializer
from human_services.phone_at_location.serializers import PhoneAtLocationSerializer
class LocationAddressSerializer(serializers.ModelSerializer):
address = AddressSe... | true | true |
790134f9806150a2e7d8202fa607f56425581494 | 2,714 | py | Python | services/pv_simulator/main.py | reynierg/pv_simulator_challenge | ab7903a3ef60e92a0ff96122d24409cd1d399b2a | [
"MIT"
] | null | null | null | services/pv_simulator/main.py | reynierg/pv_simulator_challenge | ab7903a3ef60e92a0ff96122d24409cd1d399b2a | [
"MIT"
] | null | null | null | services/pv_simulator/main.py | reynierg/pv_simulator_challenge | ab7903a3ef60e92a0ff96122d24409cd1d399b2a | [
"MIT"
] | null | null | null | import logging
import os
from pathlib import Path
import typing
from logging.handlers import RotatingFileHandler
from dotenv import load_dotenv
import services.pv_simulator.constants as constants
from services.pv_simulator.main_loop import MainLoop
from services.pv_simulator.mq_receiver import MQReceiver, MQReceiverF... | 36.675676 | 110 | 0.695652 | import logging
import os
from pathlib import Path
import typing
from logging.handlers import RotatingFileHandler
from dotenv import load_dotenv
import services.pv_simulator.constants as constants
from services.pv_simulator.main_loop import MainLoop
from services.pv_simulator.mq_receiver import MQReceiver, MQReceiverF... | true | true |
790135152f1349225398169e57cf2612a9d3d016 | 486 | py | Python | build/chrome_extension_version.py | meacer/deasciifier | 213abe2aceaace673a0c78b9c746513bb75dd94f | [
"MIT"
] | 80 | 2015-12-18T03:38:13.000Z | 2022-03-14T12:14:20.000Z | build/chrome_extension_version.py | meacer/deasciifier | 213abe2aceaace673a0c78b9c746513bb75dd94f | [
"MIT"
] | 11 | 2016-01-09T09:28:23.000Z | 2021-07-09T00:44:26.000Z | build/chrome_extension_version.py | meacer/deasciifier | 213abe2aceaace673a0c78b9c746513bb75dd94f | [
"MIT"
] | 15 | 2015-09-18T11:23:03.000Z | 2021-06-07T12:52:18.000Z | """
Reads the version information from the manifest of the Chrome extension.
Author: Mustafa Emre Acer
"""
import json
import sys
def ReadChromeExtensionVersion(manifest_path):
with open(manifest_path) as manifest_file:
manifest = json.load(manifest_file)
print(manifest['version'])
if __name__ == "__... | 22.090909 | 74 | 0.726337 |
import json
import sys
def ReadChromeExtensionVersion(manifest_path):
with open(manifest_path) as manifest_file:
manifest = json.load(manifest_file)
print(manifest['version'])
if __name__ == "__main__":
if len(sys.argv) > 1:
ReadChromeExtensionVersion(sys.argv[1])
else:
print('\nUsage: chrome... | true | true |
790135935c28da7cda36cc78a1ae42b690316fb1 | 613 | py | Python | backend/app/database.py | lupinthe14th/ptodo | 6851f834936d944cf3f4759eb84863c695bd45c1 | [
"MIT"
] | null | null | null | backend/app/database.py | lupinthe14th/ptodo | 6851f834936d944cf3f4759eb84863c695bd45c1 | [
"MIT"
] | 2 | 2021-08-16T08:07:45.000Z | 2021-08-16T12:14:22.000Z | backend/app/database.py | lupinthe14th/ptodo | 6851f834936d944cf3f4759eb84863c695bd45c1 | [
"MIT"
] | null | null | null | import os
from databases import Database
from sqlalchemy import MetaData, create_engine
SQLALCHEMY_DATABASE_URL = (
os.environ.get("DATABASE_URL")
or '{}://{}:{}@{}:{}/{}'.format(
os.environ.get("DATABASE"),
os.environ.get("DB_USERNAME"),
os.environ.get("DB_PASSWORD"),
os.envir... | 19.774194 | 46 | 0.631321 | import os
from databases import Database
from sqlalchemy import MetaData, create_engine
SQLALCHEMY_DATABASE_URL = (
os.environ.get("DATABASE_URL")
or '{}://{}:{}@{}:{}/{}'.format(
os.environ.get("DATABASE"),
os.environ.get("DB_USERNAME"),
os.environ.get("DB_PASSWORD"),
os.envir... | true | true |
7901359d780dedf2d8569f0323f6b8404acbf4c5 | 5,972 | py | Python | test/functional/wallet_txn_clone.py | weicrypto/wei | 031b608636db4309ecc9d5e6d0512179fb50fd4e | [
"MIT"
] | null | null | null | test/functional/wallet_txn_clone.py | weicrypto/wei | 031b608636db4309ecc9d5e6d0512179fb50fd4e | [
"MIT"
] | null | null | null | test/functional/wallet_txn_clone.py | weicrypto/wei | 031b608636db4309ecc9d5e6d0512179fb50fd4e | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2014-2016 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 are cloned transactions with malleated scriptsigs."""
fro... | 45.587786 | 168 | 0.64501 |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
class TxnMallTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 4
def add_options(self, parser):
parser.add_option("--mineblock", dest="mine_block", default=False, action=... | true | true |
790136c258112456331c611d13cd5bdbb73254a1 | 1,094 | py | Python | server/tests/test_repository.py | 74th/vscode-book-python | a3a90ee57851bca9898c60e8fa74c92e53e9469b | [
"MIT"
] | 3 | 2020-04-26T15:35:01.000Z | 2020-08-15T07:02:58.000Z | server/tests/test_repository.py | 74th/vscode-book-python | a3a90ee57851bca9898c60e8fa74c92e53e9469b | [
"MIT"
] | null | null | null | server/tests/test_repository.py | 74th/vscode-book-python | a3a90ee57851bca9898c60e8fa74c92e53e9469b | [
"MIT"
] | 2 | 2021-08-20T06:39:40.000Z | 2022-03-07T12:24:42.000Z | from typing import List
import unittest
from model import tasks
class TestRepository(unittest.TestCase):
def test_list(self):
rep = tasks.Repository()
l = rep.list()
self.assertEqual(len(l), 2)
self.assertEqual(l[0].id, 1)
self.assertEqual(l[0].text, "task1")
self.... | 24.311111 | 47 | 0.565814 | from typing import List
import unittest
from model import tasks
class TestRepository(unittest.TestCase):
def test_list(self):
rep = tasks.Repository()
l = rep.list()
self.assertEqual(len(l), 2)
self.assertEqual(l[0].id, 1)
self.assertEqual(l[0].text, "task1")
self.... | true | true |
7901378cfed666fdb4826694ca54d6ccc4f71d02 | 2,563 | py | Python | examples/Rest/ex17_mount_virtual_media_iso.py | killionadmin/ILOscripts | 951f53df9bf58bc7b186a501e2d123645f0e55a3 | [
"Apache-2.0"
] | 27 | 2015-04-07T13:44:20.000Z | 2016-03-26T01:23:58.000Z | examples/Rest/ex17_mount_virtual_media_iso.py | killionadmin/ILOscripts | 951f53df9bf58bc7b186a501e2d123645f0e55a3 | [
"Apache-2.0"
] | 5 | 2017-05-11T23:36:34.000Z | 2018-05-27T09:11:17.000Z | examples/Rest/ex17_mount_virtual_media_iso.py | killionadmin/ILOscripts | 951f53df9bf58bc7b186a501e2d123645f0e55a3 | [
"Apache-2.0"
] | 13 | 2015-03-25T19:03:36.000Z | 2016-03-11T13:21:18.000Z | # Copyright 2016 Hewlett Packard Enterprise Development LP
#
# 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... | 42.716667 | 81 | 0.630901 |
import sys
from _restobject import RestObject
def ex17_mount_virtual_media_iso(restobj, iso_url, boot_on_next_server_reset):
sys.stdout.write("\nEXAMPLE 17: Mount iLO Virtual Media DVD ISO from URL\n")
instances = restobj.search_for_type("Manager.")
for instance in instan... | true | true |
7901379d9c793494228ad5ddf8e61c6d86d5ff2a | 117,457 | py | Python | python/paddle/tensor/linalg.py | DevilCarp/Paddle | 04325d2cbefb029a4478bdc069d3279cd566ac6a | [
"Apache-2.0"
] | 2 | 2022-03-30T09:55:45.000Z | 2022-03-30T09:55:49.000Z | python/paddle/tensor/linalg.py | DevilCarp/Paddle | 04325d2cbefb029a4478bdc069d3279cd566ac6a | [
"Apache-2.0"
] | null | null | null | python/paddle/tensor/linalg.py | DevilCarp/Paddle | 04325d2cbefb029a4478bdc069d3279cd566ac6a | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 39.074185 | 182 | 0.553913 |
import numpy as np
from ..fluid.layer_helper import LayerHelper
from ..framework import _varbase_creator, _dygraph_tracer
from ..fluid.data_feeder import check_variable_and_dtype, check_type, check_dtype
from ..static import Variable
from ..fluid.framework import _in_legacy_dygraph, in_dygraph_mode
from .... | true | true |
790137aeac521a7e1591dc80402f5641e9f47a43 | 944 | py | Python | libraries/botbuilder-dialogs/botbuilder/dialogs/memory/scopes/settings_memory_scope.py | Fl4v/botbuilder-python | 4003d713beb8fb986a01cfd11632eabc65858618 | [
"MIT"
] | 388 | 2019-05-07T15:53:21.000Z | 2022-03-28T20:29:46.000Z | libraries/botbuilder-dialogs/botbuilder/dialogs/memory/scopes/settings_memory_scope.py | Fl4v/botbuilder-python | 4003d713beb8fb986a01cfd11632eabc65858618 | [
"MIT"
] | 1,286 | 2019-05-07T23:38:19.000Z | 2022-03-31T10:44:16.000Z | libraries/botbuilder-dialogs/botbuilder/dialogs/memory/scopes/settings_memory_scope.py | Fl4v/botbuilder-python | 4003d713beb8fb986a01cfd11632eabc65858618 | [
"MIT"
] | 168 | 2019-05-14T20:23:25.000Z | 2022-03-16T06:49:14.000Z | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from botbuilder.dialogs.memory import scope_path
from .memory_scope import MemoryScope
class SettingsMemoryScope(MemoryScope):
def __init__(self):
super().__init__(scope_path.SETTINGS)
self._empty_setti... | 29.5 | 77 | 0.680085 |
from botbuilder.dialogs.memory import scope_path
from .memory_scope import MemoryScope
class SettingsMemoryScope(MemoryScope):
def __init__(self):
super().__init__(scope_path.SETTINGS)
self._empty_settings = {}
self.include_in_snapshot = False
def get_memory(self, dialog_context: ... | true | true |
79013a152deb5f66e4e3a2ee929bdbc26933be29 | 2,232 | py | Python | Samples/codes/matopt_review/add_objective.py | wilsongis/3DP_Experiments | da9bd3b4ba1d82bac7dcfa27d86634add59db087 | [
"MIT",
"Unlicense"
] | null | null | null | Samples/codes/matopt_review/add_objective.py | wilsongis/3DP_Experiments | da9bd3b4ba1d82bac7dcfa27d86634add59db087 | [
"MIT",
"Unlicense"
] | null | null | null | Samples/codes/matopt_review/add_objective.py | wilsongis/3DP_Experiments | da9bd3b4ba1d82bac7dcfa27d86634add59db087 | [
"MIT",
"Unlicense"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Copyright (c) 2021 Showa Denko Materials co., Ltd. All rights reserved.
This software is for non-profit use only.
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PU... | 34.875 | 121 | 0.673835 |
import time
import numpy as np
from GPyOpt.core.task.objective import Objective
class MultiObjective(Objective):
def __init__(self, func, n_obj, num_cores = 1, objective_name = 'no_name', batch_type = 'synchronous', space = None):
self.func = func
self.n_procs = num_cores
self.num_eval... | true | true |
79013ad6e0a2166ad422ee11f1165082ac96f88d | 2,155 | py | Python | greentest/test__core_stat.py | pubnub/gevent | e2ec8bb71fcccd01cee76fa97ca22bd467741a8b | [
"MIT"
] | 1 | 2020-03-21T05:34:18.000Z | 2020-03-21T05:34:18.000Z | greentest/test__core_stat.py | pubnub/gevent | e2ec8bb71fcccd01cee76fa97ca22bd467741a8b | [
"MIT"
] | null | null | null | greentest/test__core_stat.py | pubnub/gevent | e2ec8bb71fcccd01cee76fa97ca22bd467741a8b | [
"MIT"
] | 1 | 2021-01-13T11:20:12.000Z | 2021-01-13T11:20:12.000Z | from __future__ import print_function
import gevent
import gevent.core
import os
import time
filename = 'tmp.test__core_stat.%s' % os.getpid()
hub = gevent.get_hub()
DELAY = 0.5
EV_USE_INOTIFY = getattr(gevent.core, 'EV_USE_INOTIFY', None)
try:
open(filename, 'wb', buffering=0).close()
assert os.path.exis... | 31.691176 | 96 | 0.664501 | from __future__ import print_function
import gevent
import gevent.core
import os
import time
filename = 'tmp.test__core_stat.%s' % os.getpid()
hub = gevent.get_hub()
DELAY = 0.5
EV_USE_INOTIFY = getattr(gevent.core, 'EV_USE_INOTIFY', None)
try:
open(filename, 'wb', buffering=0).close()
assert os.path.exis... | true | true |
79013cc0569ba7b48a8c8143a6b1ddacf4ff6392 | 10,201 | py | Python | subset_selection/code/measures/contrastive/contrastive.py | JiwanChung/acav100m | 51cb948d5682da69334a8d05d2df631971b60215 | [
"MIT"
] | 27 | 2021-10-13T07:49:14.000Z | 2022-03-15T06:58:00.000Z | subset_selection/code/measures/contrastive/contrastive.py | JiwanChung/acav100m | 51cb948d5682da69334a8d05d2df631971b60215 | [
"MIT"
] | 3 | 2021-08-30T21:29:45.000Z | 2021-11-18T08:02:32.000Z | subset_selection/code/measures/contrastive/contrastive.py | JiwanChung/acav100m | 51cb948d5682da69334a8d05d2df631971b60215 | [
"MIT"
] | 6 | 2021-08-30T18:48:32.000Z | 2021-12-16T22:11:37.000Z | import csv
from pathlib import Path
import torch
import pandas
import numpy as np
from utils import peek, load_json, dump_json
from .module import ContrastiveModule
from mps import distributed as du
from save import format_rows
def get_penultimates(keys):
penultimates = {}
for key in keys:
view = ke... | 39.692607 | 121 | 0.605921 | import csv
from pathlib import Path
import torch
import pandas
import numpy as np
from utils import peek, load_json, dump_json
from .module import ContrastiveModule
from mps import distributed as du
from save import format_rows
def get_penultimates(keys):
penultimates = {}
for key in keys:
view = ke... | true | true |
79013db0531ce24e3ece32d8ed1fde8567c149f2 | 643 | py | Python | World 1/First attempts/ex010 - Real to Dollar.py | MiguelChichorro/PythonExercises | 3b2726e7d9ef92c1eb6b977088692c42a2a7b86e | [
"MIT"
] | 2 | 2021-04-23T19:18:06.000Z | 2021-05-15T17:45:21.000Z | World 1/First attempts/ex010 - Real to Dollar.py | MiguelChichorro/PythonExercises | 3b2726e7d9ef92c1eb6b977088692c42a2a7b86e | [
"MIT"
] | 1 | 2021-05-14T00:29:23.000Z | 2021-05-14T00:29:23.000Z | World 1/First attempts/ex010 - Real to Dollar.py | MiguelChichorro/PythonExercises | 3b2726e7d9ef92c1eb6b977088692c42a2a7b86e | [
"MIT"
] | 1 | 2021-05-14T00:19:33.000Z | 2021-05-14T00:19:33.000Z | colors = {"clean": "\033[m",
"red": "\033[31m",
"green": "\033[32m",
"yellow": "\033[33m",
"blue": "\033[34m",
"purple": "\033[35m",
"cian": "\033[36m"}
n1 = float(input("Enter how many money do you have in your wallet(in Real): R$"))
print("You have {}R${:.2f... | 42.866667 | 81 | 0.479005 | colors = {"clean": "\033[m",
"red": "\033[31m",
"green": "\033[32m",
"yellow": "\033[33m",
"blue": "\033[34m",
"purple": "\033[35m",
"cian": "\033[36m"}
n1 = float(input("Enter how many money do you have in your wallet(in Real): R$"))
print("You have {}R${:.2f... | true | true |
79013db42e504c5f46de3998836df5093f4d04a3 | 9,602 | py | Python | dnacentersdk/api/v1_3_1/clients.py | oboehmer/dnacentersdk | 25c4e99900640deee91a56aa886874d9cb0ca960 | [
"MIT"
] | 32 | 2019-09-05T05:16:56.000Z | 2022-03-22T09:50:38.000Z | dnacentersdk/api/v1_3_1/clients.py | oboehmer/dnacentersdk | 25c4e99900640deee91a56aa886874d9cb0ca960 | [
"MIT"
] | 35 | 2019-09-07T18:58:54.000Z | 2022-03-24T19:29:36.000Z | dnacentersdk/api/v1_3_1/clients.py | oboehmer/dnacentersdk | 25c4e99900640deee91a56aa886874d9cb0ca960 | [
"MIT"
] | 18 | 2019-09-09T11:07:21.000Z | 2022-03-25T08:49:59.000Z | # -*- coding: utf-8 -*-
"""Cisco DNA Center Clients API wrapper.
Copyright (c) 2019-2021 Cisco Systems.
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 limi... | 36.509506 | 108 | 0.614559 |
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals,
)
from builtins import *
from past.builtins import basestring
from ...restsession import RestSession
from ...utils import (
check_type,
dict_from_items_with_values,
apply_path_params,
dict_of_str,... | true | true |
79013dba763510046e4193907736efb522e1a25c | 17,668 | py | Python | src/dispatch/messaging.py | oliverzgy/dispatch | 1cb6199ab58bf9bda89f9a0430ea4933d27232dc | [
"Apache-2.0"
] | null | null | null | src/dispatch/messaging.py | oliverzgy/dispatch | 1cb6199ab58bf9bda89f9a0430ea4933d27232dc | [
"Apache-2.0"
] | null | null | null | src/dispatch/messaging.py | oliverzgy/dispatch | 1cb6199ab58bf9bda89f9a0430ea4933d27232dc | [
"Apache-2.0"
] | null | null | null | import copy
from enum import Enum
from jinja2 import Template
from typing import List
from dispatch.conversation.enums import ConversationButtonActions
from dispatch.incident.enums import IncidentStatus
from .config import (
DISPATCH_UI_URL,
INCIDENT_RESOURCE_CONVERSATION_REFERENCE_DOCUMENT,
INCIDENT_RE... | 33.210526 | 158 | 0.712305 | import copy
from enum import Enum
from jinja2 import Template
from typing import List
from dispatch.conversation.enums import ConversationButtonActions
from dispatch.incident.enums import IncidentStatus
from .config import (
DISPATCH_UI_URL,
INCIDENT_RESOURCE_CONVERSATION_REFERENCE_DOCUMENT,
INCIDENT_RE... | true | true |
79013df3b6da8fda656da7100801368f656631f3 | 8,946 | py | Python | qtum_electrum/plugins/hw_wallet/qt.py | mikehash/qtum-electrum | f6d9d8babd4a1468d8f0a289b3e2b533ac04d040 | [
"MIT"
] | null | null | null | qtum_electrum/plugins/hw_wallet/qt.py | mikehash/qtum-electrum | f6d9d8babd4a1468d8f0a289b3e2b533ac04d040 | [
"MIT"
] | null | null | null | qtum_electrum/plugins/hw_wallet/qt.py | mikehash/qtum-electrum | f6d9d8babd4a1468d8f0a289b3e2b533ac04d040 | [
"MIT"
] | null | null | null | #!/usr/bin/env python2
# -*- mode: python -*-
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2016 The Electrum developers
#
# 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... | 37.90678 | 100 | 0.666331 |
import threading
from PyQt5.QtWidgets import QVBoxLayout, QLabel
from qtum_electrum.gui.qt.password_dialog import PasswordLayout, PW_PASSPHRASE
from qtum_electrum.gui.qt.util import *
from qtum_electrum.i18n import _
from qtum_electrum.util import PrintError
class QtHandlerBase(QObject, P... | true | true |
79013fd897fcea8f2d6ff9c9d4ee59018a422948 | 696 | py | Python | models/model_canteen/serializers.py | SanjarbekSaminjonov/musofirlar.backend | 23b09e90cc4e3d153063ad1768b5ae1c18ff866d | [
"Apache-2.0"
] | 1 | 2021-12-23T12:43:17.000Z | 2021-12-23T12:43:17.000Z | models/model_canteen/serializers.py | SanjarbekSaminjonov/musofirlar.backend | 23b09e90cc4e3d153063ad1768b5ae1c18ff866d | [
"Apache-2.0"
] | null | null | null | models/model_canteen/serializers.py | SanjarbekSaminjonov/musofirlar.backend | 23b09e90cc4e3d153063ad1768b5ae1c18ff866d | [
"Apache-2.0"
] | null | null | null | from rest_framework import serializers
from .models import Canteen
from accounts.serializers import UserForSerializer
from model_location.serializers import CityViewSerializer
from model_media.serializers import MediaViewSerializer
# Canteen model serializer
class CanteenSerializer(serializers.ModelSerializer):
c... | 29 | 59 | 0.777299 | from rest_framework import serializers
from .models import Canteen
from accounts.serializers import UserForSerializer
from model_location.serializers import CityViewSerializer
from model_media.serializers import MediaViewSerializer
class CanteenSerializer(serializers.ModelSerializer):
class Meta:
model =... | true | true |
790140b0d712bb4a09b103664f2e674d3005dd79 | 4,637 | py | Python | autobuild/create-j2-confs.py | mastrip2/blockchain-configuration-files | 71e4df86220c85e768f9250ac8c2920ed525b21e | [
"MIT"
] | null | null | null | autobuild/create-j2-confs.py | mastrip2/blockchain-configuration-files | 71e4df86220c85e768f9250ac8c2920ed525b21e | [
"MIT"
] | null | null | null | autobuild/create-j2-confs.py | mastrip2/blockchain-configuration-files | 71e4df86220c85e768f9250ac8c2920ed525b21e | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import json
import os, sys, os.path
import string
from configparser import ConfigParser
J2_CONF_PATH='autobuild/configs/'
def write_file(filename, data):
with open(filename, "w") as fname:
json.dump(data, fname, indent = 4)
return
def get_wallet_conf(path):
wallet_conf_pars... | 45.460784 | 133 | 0.659694 |
import json
import os, sys, os.path
import string
from configparser import ConfigParser
J2_CONF_PATH='autobuild/configs/'
def write_file(filename, data):
with open(filename, "w") as fname:
json.dump(data, fname, indent = 4)
return
def get_wallet_conf(path):
wallet_conf_parser = ConfigParser()
... | true | true |
7901417a42ec3b2302ff2baee07aab0372416755 | 5,613 | py | Python | data/librispeech.py | vadimkantorov/deepspeech.pytorch | d59213e397e9df3e9dbf5b62932a28979ce28197 | [
"MIT"
] | null | null | null | data/librispeech.py | vadimkantorov/deepspeech.pytorch | d59213e397e9df3e9dbf5b62932a28979ce28197 | [
"MIT"
] | null | null | null | data/librispeech.py | vadimkantorov/deepspeech.pytorch | d59213e397e9df3e9dbf5b62932a28979ce28197 | [
"MIT"
] | null | null | null | import os
import wget
import tarfile
import argparse
import subprocess
from utils import create_manifest
from tqdm import tqdm
import shutil
parser = argparse.ArgumentParser(description='Processes and downloads LibriSpeech dataset.')
parser.add_argument("--target-dir", default='LibriSpeech_dataset/', type=str, help="D... | 49.236842 | 117 | 0.623018 | import os
import wget
import tarfile
import argparse
import subprocess
from utils import create_manifest
from tqdm import tqdm
import shutil
parser = argparse.ArgumentParser(description='Processes and downloads LibriSpeech dataset.')
parser.add_argument("--target-dir", default='LibriSpeech_dataset/', type=str, help="D... | true | true |
790141eeb0852216b33c0d0efb7f741677b338eb | 1,701 | py | Python | app/core/migrations/0001_initial.py | Huxteen/Django-recipe-app-API-Docker-TDD-CI-CD | dc610cd341477ddf2686fcb419e5ba9dda113c89 | [
"MIT"
] | 2 | 2020-12-09T08:27:03.000Z | 2021-02-13T12:39:53.000Z | app/core/migrations/0001_initial.py | Huxteen/Django-recipe-app-API-Docker-TDD-CI-CD | dc610cd341477ddf2686fcb419e5ba9dda113c89 | [
"MIT"
] | null | null | null | app/core/migrations/0001_initial.py | Huxteen/Django-recipe-app-API-Docker-TDD-CI-CD | dc610cd341477ddf2686fcb419e5ba9dda113c89 | [
"MIT"
] | null | null | null | # Generated by Django 2.2.2 on 2019-09-01 09:08
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
migrations.CreateModel(
name='User',
f... | 50.029412 | 266 | 0.637272 |
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField... | true | true |
790142b269f640eaae6cdf66f9c7a34c83d113b9 | 460 | py | Python | test/test_tiddler_fields_as_strings.py | funkyeah/tiddlyweb | 2346e6c05aa03ae9c8f2687d9ef9e46103267a8e | [
"BSD-3-Clause"
] | null | null | null | test/test_tiddler_fields_as_strings.py | funkyeah/tiddlyweb | 2346e6c05aa03ae9c8f2687d9ef9e46103267a8e | [
"BSD-3-Clause"
] | null | null | null | test/test_tiddler_fields_as_strings.py | funkyeah/tiddlyweb | 2346e6c05aa03ae9c8f2687d9ef9e46103267a8e | [
"BSD-3-Clause"
] | null | null | null | """
Make sure that tiddler fields which are not strings
are stringified, otherwise, the text serialization will
assplode.
"""
from tiddlyweb.serializer import Serializer
from tiddlyweb.model.tiddler import Tiddler
def setup_module(module):
pass
def test_float_field():
tiddler = Tiddler('foo', 'bar')
t... | 20.909091 | 56 | 0.719565 |
from tiddlyweb.serializer import Serializer
from tiddlyweb.model.tiddler import Tiddler
def setup_module(module):
pass
def test_float_field():
tiddler = Tiddler('foo', 'bar')
tiddler.fields['float'] = 100.5
serializer = Serializer('text')
serializer.object = tiddler
assert '100.5' in '%s' ... | true | true |
7901435434c7c8c085d66898465f595a7218f96f | 7,419 | py | Python | algorithms/hash/simhash.py | SylvanasSun/code-snippets | 8a393c50955a6a1ad0ca9809f3f7501faae52c51 | [
"MIT"
] | 1 | 2018-01-31T03:43:08.000Z | 2018-01-31T03:43:08.000Z | algorithms/hash/simhash.py | SylvanasSun/code-snippets | 8a393c50955a6a1ad0ca9809f3f7501faae52c51 | [
"MIT"
] | null | null | null | algorithms/hash/simhash.py | SylvanasSun/code-snippets | 8a393c50955a6a1ad0ca9809f3f7501faae52c51 | [
"MIT"
] | null | null | null | # Created by SylvanasSun in 2017.10.17
# !/usr/bin/python
# -*- coding: utf-8 -*-
import collections
import jieba
from jieba import analyse
# TODO: Change default hash algorithms to the other algorithms of high-performance.
def _default_hashfunc(content, hashbits):
"""
Default hash function is variable-lengt... | 36.190244 | 117 | 0.626365 |
import collections
import jieba
from jieba import analyse
def _default_hashfunc(content, hashbits):
if content == "":
return 0
x = ord(content[0]) << 7
m = 1000003
mask = 2 ** hashbits - 1
for c in content:
x = ((x * m) ^ ord(c)) & mask
x ^= len(content)
if x == -1:
... | true | true |
7901435b0febe6d85163a17baac50a97baf9102a | 8,086 | py | Python | Dev/Cpp/CreateHeader.py | Shockblast/Effekseer | bac86c0fc965f04a0f57c5863d37a9c2d5c3be97 | [
"Apache-2.0",
"BSD-3-Clause"
] | 1 | 2021-12-21T07:03:42.000Z | 2021-12-21T07:03:42.000Z | Dev/Cpp/CreateHeader.py | Shockblast/Effekseer | bac86c0fc965f04a0f57c5863d37a9c2d5c3be97 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | Dev/Cpp/CreateHeader.py | Shockblast/Effekseer | bac86c0fc965f04a0f57c5863d37a9c2d5c3be97 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | import os
import re
import codecs
def isValidLine(line):
if re.search('include \"', line) == None or line.find('.PSVita') != -1 or line.find('.PS4') != -1 or line.find('.Switch') != -1 or line.find('.XBoxOne') != -1:
return True
return False
class CreateHeader:
def __init__(self):
self.lines = []
def addLine... | 57.757143 | 160 | 0.852461 | import os
import re
import codecs
def isValidLine(line):
if re.search('include \"', line) == None or line.find('.PSVita') != -1 or line.find('.PS4') != -1 or line.find('.Switch') != -1 or line.find('.XBoxOne') != -1:
return True
return False
class CreateHeader:
def __init__(self):
self.lines = []
def addLine... | true | true |
7901444372c85a2b15f7dcba7de55b077aa0b721 | 7,836 | py | Python | contrib/bitrpc/bitrpc.py | iannkwon/sarnath | 634234991c0919b24ba22138ae5cd84323c119fa | [
"MIT"
] | null | null | null | contrib/bitrpc/bitrpc.py | iannkwon/sarnath | 634234991c0919b24ba22138ae5cd84323c119fa | [
"MIT"
] | null | null | null | contrib/bitrpc/bitrpc.py | iannkwon/sarnath | 634234991c0919b24ba22138ae5cd84323c119fa | [
"MIT"
] | null | null | null | from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:9332")
else:
access = Ser... | 24.110769 | 79 | 0.668198 | from jsonrpc import ServiceProxy
import sys
import string
rpcuser = ""
rpcpass = ""
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:9332")
else:
access = ServiceProxy("http://"+rpcuser+":"+rpcpass+"@127.0.0.1:9332")
cmd = sys.argv[1].lower()
if cmd == "backupwallet":
try:
path = raw_input("Enter d... | false | true |
790145a3f15acd1ed0115e580f9a967616d05789 | 4,622 | py | Python | chrome/common/extensions/docs/server2/render_servlet_test.py | SlimKatLegacy/android_external_chromium_org | ee480ef5039d7c561fc66ccf52169ead186f1bea | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2 | 2015-03-04T02:36:53.000Z | 2016-06-25T11:22:17.000Z | chrome/common/extensions/docs/server2/render_servlet_test.py | j4ckfrost/android_external_chromium_org | a1a3dad8b08d1fcf6b6b36c267158ed63217c780 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | chrome/common/extensions/docs/server2/render_servlet_test.py | j4ckfrost/android_external_chromium_org | a1a3dad8b08d1fcf6b6b36c267158ed63217c780 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 4 | 2015-02-09T08:49:30.000Z | 2017-08-26T02:03:34.000Z | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from extensions_paths import EXAMPLES, PUBLIC_TEMPLATES, STATIC_DOCS
from local_file_system import LocalFileSystem
fro... | 38.198347 | 79 | 0.706621 |
import unittest
from extensions_paths import EXAMPLES, PUBLIC_TEMPLATES, STATIC_DOCS
from local_file_system import LocalFileSystem
from render_servlet import RenderServlet
from server_instance import ServerInstance
from servlet import Request, Response
from test_util import ReadFile
class _RenderServletDelegate... | true | true |
7901468931f7270d19bbbb42637612296457425b | 2,036 | py | Python | src/helpers/api_handler.py | alejandrodlsp/grogu-bot | d35a504ee550fede4e8ea20e799079f8e8b2887b | [
"MIT"
] | 1 | 2021-04-15T13:47:32.000Z | 2021-04-15T13:47:32.000Z | src/helpers/api_handler.py | alejandrodlsp/razer-bot | d35a504ee550fede4e8ea20e799079f8e8b2887b | [
"MIT"
] | null | null | null | src/helpers/api_handler.py | alejandrodlsp/razer-bot | d35a504ee550fede4e8ea20e799079f8e8b2887b | [
"MIT"
] | null | null | null | import discord
import io
import aiohttp
from aiohttp import request, ClientSession
from src.embeds.image_embed import ImageEmbed
async def request_canvas_image(ctx, url, member: discord.Member = None, params={}, is_gif=False):
params_url = "&" + "&".join(["{}={}".format(k, v)
for k... | 40.72 | 129 | 0.556483 | import discord
import io
import aiohttp
from aiohttp import request, ClientSession
from src.embeds.image_embed import ImageEmbed
async def request_canvas_image(ctx, url, member: discord.Member = None, params={}, is_gif=False):
params_url = "&" + "&".join(["{}={}".format(k, v)
for k... | true | true |
790148793111aef084f8e513723e3e42a6349e6a | 2,408 | py | Python | 0-python-tutorial/25-dates05_strftime23_z.py | luis2ra/py3-00-w3schools | 6bb851837f8ef9520491d13fa2c909047c9b18cf | [
"MIT"
] | null | null | null | 0-python-tutorial/25-dates05_strftime23_z.py | luis2ra/py3-00-w3schools | 6bb851837f8ef9520491d13fa2c909047c9b18cf | [
"MIT"
] | null | null | null | 0-python-tutorial/25-dates05_strftime23_z.py | luis2ra/py3-00-w3schools | 6bb851837f8ef9520491d13fa2c909047c9b18cf | [
"MIT"
] | null | null | null | # 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 ... | 57.333333 | 111 | 0.354236 |
import datetime
x = datetime.datetime.now()
print(x)
print(x.strftime("%z")) | true | true |
790148d82deb5ee6e891b87a5fd4d5b8e5c875cf | 6,580 | py | Python | st2reactor/st2reactor/rules/tester.py | kkkanil/st2 | 07cd195d7a6e177a37dd019e5c9ab8329259d0fa | [
"Apache-2.0"
] | null | null | null | st2reactor/st2reactor/rules/tester.py | kkkanil/st2 | 07cd195d7a6e177a37dd019e5c9ab8329259d0fa | [
"Apache-2.0"
] | 15 | 2021-02-11T22:58:54.000Z | 2021-08-06T18:03:47.000Z | st2reactor/st2reactor/rules/tester.py | kkkanil/st2 | 07cd195d7a6e177a37dd019e5c9ab8329259d0fa | [
"Apache-2.0"
] | 1 | 2021-07-10T15:02:29.000Z | 2021-07-10T15:02:29.000Z | # Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | 41.125 | 99 | 0.658663 |
from __future__ import absolute_import
import os
import six
import mock
from jinja2.exceptions import UndefinedError
from st2common import log as logging
from st2common.content.loader import MetaLoader
from st2common.models.db.rule import RuleDB
from st2common.models.db.trigger import TriggerDB
from s... | true | true |
790148dd4299989881099779cd6bebf759687808 | 133 | py | Python | basics/math.py | augustoscher/python-excercises | 502fb3c15597033ba19e32f871be12d347a9aa2a | [
"MIT"
] | null | null | null | basics/math.py | augustoscher/python-excercises | 502fb3c15597033ba19e32f871be12d347a9aa2a | [
"MIT"
] | null | null | null | basics/math.py | augustoscher/python-excercises | 502fb3c15597033ba19e32f871be12d347a9aa2a | [
"MIT"
] | null | null | null | print()
print("--- Math ---")
print(1+1)
print(1*3)
print(1/2)
print(3**2)
print(4%2)
print(4%2 == 0)
print(type(1))
print(type(1.0)) | 13.3 | 21 | 0.586466 | print()
print("--- Math ---")
print(1+1)
print(1*3)
print(1/2)
print(3**2)
print(4%2)
print(4%2 == 0)
print(type(1))
print(type(1.0)) | true | true |
7901498ed94e775640b57a61992c701e7ec1f47f | 2,606 | py | Python | forOutput.py | laughingclouds/dt-mst-project | cec68a4d5065544b2de11268ced82ec4d9cc7aca | [
"MIT"
] | 1 | 2021-12-23T13:40:57.000Z | 2021-12-23T13:40:57.000Z | forOutput.py | laughingclouds/dt-mst-project | cec68a4d5065544b2de11268ced82ec4d9cc7aca | [
"MIT"
] | null | null | null | forOutput.py | laughingclouds/dt-mst-project | cec68a4d5065544b2de11268ced82ec4d9cc7aca | [
"MIT"
] | null | null | null | """Python 3.9.5"""
import cv2
import HandTrackingModule as htm
def thumbIncrementCheck(lmList: list[list[int]]) -> int:
"""Checks whether your thumb is up or not.
No matter what hand you use.
returns 1 if thumb is up else 0"""
count = 0
t_x = lmList[4][1]
p_x = lmList[17][1]
if t_x > p_x:... | 29.954023 | 94 | 0.506523 | import cv2
import HandTrackingModule as htm
def thumbIncrementCheck(lmList: list[list[int]]) -> int:
count = 0
t_x = lmList[4][1]
p_x = lmList[17][1]
if t_x > p_x:
if lmList[4][1] >= lmList[2][1]:
count += 1
else:
if lmList[4][1] <= lmList[2][1]:
count ... | true | true |
79014af2e7225e0cb519cbbac0773a3b3e85bd74 | 821 | py | Python | bot/src/utils/player.py | SlenderCylinder/pomoji | 50a11b969faff28d55b0d6aef48a7f0f2888b66a | [
"MIT"
] | 1 | 2021-10-02T18:27:07.000Z | 2021-10-02T18:27:07.000Z | bot/src/utils/player.py | SlenderCylinder/pomoji | 50a11b969faff28d55b0d6aef48a7f0f2888b66a | [
"MIT"
] | null | null | null | bot/src/utils/player.py | SlenderCylinder/pomoji | 50a11b969faff28d55b0d6aef48a7f0f2888b66a | [
"MIT"
] | null | null | null | from asyncio import sleep
from discord import FFmpegPCMAudio, PCMVolumeTransformer
from configs import bot_enum
from ..session.Session import Session
async def alert(session: Session):
vc = session.ctx.voice_client
if not vc:
return
path = bot_enum.AlertPath.POMO_END
if session.state == bot... | 29.321429 | 85 | 0.678441 | from asyncio import sleep
from discord import FFmpegPCMAudio, PCMVolumeTransformer
from configs import bot_enum
from ..session.Session import Session
async def alert(session: Session):
vc = session.ctx.voice_client
if not vc:
return
path = bot_enum.AlertPath.POMO_END
if session.state == bot... | true | true |
79014fb49be25fcd4e3e5a7e64bdb05ad9edbbd2 | 7,622 | py | Python | tools/calibration-96tof1/tof_calib/regwrite_generator.py | AkshayKurhade/aditof_sdk | dd6146e7cb65b56d4ce61e4fd771e94ea4976a89 | [
"BSD-3-Clause"
] | 53 | 2019-09-09T21:17:45.000Z | 2022-01-29T13:43:50.000Z | tools/calibration-96tof1/tof_calib/regwrite_generator.py | AkshayKurhade/aditof_sdk | dd6146e7cb65b56d4ce61e4fd771e94ea4976a89 | [
"BSD-3-Clause"
] | 352 | 2019-05-13T16:22:27.000Z | 2022-03-28T08:44:59.000Z | tools/calibration-96tof1/tof_calib/regwrite_generator.py | AkshayKurhade/aditof_sdk | dd6146e7cb65b56d4ce61e4fd771e94ea4976a89 | [
"BSD-3-Clause"
] | 52 | 2019-05-17T08:09:53.000Z | 2022-03-08T06:54:48.000Z | #
# BSD 3-Clause License
#
# Copyright (c) 2019, Analog Devices, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, ... | 34.963303 | 135 | 0.575571 |
import re
class regwrite_generator(object):
def __init__(self, seq_file):
self.code_dict = {}
self.data_dict = {}
self.seq_file = seq_file
def create_code_dict(self, text):
reg = re.compile(r'([0-9a-f]{4} [0-9a-f]{4})')
rawinfo = re... | true | true |
79014fb79c69546571e7d06f362eb01471029ddd | 5,941 | py | Python | treedb/backend/models.py | glottolog/treedb | 4aa735632d6add5c81cc1d7be42833446e2a447a | [
"MIT"
] | 4 | 2019-07-13T14:39:01.000Z | 2021-04-17T13:38:47.000Z | treedb/backend/models.py | glottolog/treedb | 4aa735632d6add5c81cc1d7be42833446e2a447a | [
"MIT"
] | 1 | 2020-12-02T12:02:47.000Z | 2020-12-02T15:05:25.000Z | treedb/backend/models.py | glottolog/treedb | 4aa735632d6add5c81cc1d7be42833446e2a447a | [
"MIT"
] | 2 | 2020-04-11T19:46:48.000Z | 2020-04-13T19:40:24.000Z | """Dataset, producer, and config metadata."""
import logging
import warnings
import sqlalchemy as sa
from .._globals import REGISTRY as registry
from .. import _tools
from .. import backend as _backend
__all__ = ['Dataset', 'Producer', 'Config']
log = logging.getLogger(__name__)
@registry.mapped
class Dataset:... | 38.083333 | 89 | 0.586265 |
import logging
import warnings
import sqlalchemy as sa
from .._globals import REGISTRY as registry
from .. import _tools
from .. import backend as _backend
__all__ = ['Dataset', 'Producer', 'Config']
log = logging.getLogger(__name__)
@registry.mapped
class Dataset:
__tablename__ = '__dataset__'
id = ... | true | true |
7901512d30d8703abdf0b24e4949e10e4f4a3655 | 1,443 | py | Python | zappa_boilerplate/user/forms.py | 402900550b/dtnewman2 | f0113c2835741185b9a71003d6340f97f5d6cc99 | [
"MIT"
] | 17 | 2017-01-30T03:22:47.000Z | 2019-07-25T15:15:46.000Z | zappa_boilerplate/user/forms.py | 402900550b/dtnewman2 | f0113c2835741185b9a71003d6340f97f5d6cc99 | [
"MIT"
] | 2 | 2017-09-16T01:01:45.000Z | 2020-10-28T18:13:18.000Z | zappa_boilerplate/user/forms.py | 402900550b/dtnewman2 | f0113c2835741185b9a71003d6340f97f5d6cc99 | [
"MIT"
] | 1 | 2017-09-29T05:04:24.000Z | 2017-09-29T05:04:24.000Z | # -*- coding: utf-8 -*-
from zappa_boilerplate.database import db_session
from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired, Email, EqualTo, Length
from .models import User
class RegisterForm(Form):
username = StringField('Username',
... | 40.083333 | 98 | 0.630631 |
from zappa_boilerplate.database import db_session
from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired, Email, EqualTo, Length
from .models import User
class RegisterForm(Form):
username = StringField('Username',
validat... | true | true |
790151e176bfd6fcb23347679865ca39841044c6 | 24 | py | Python | data/studio21_generated/introductory/3210/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/introductory/3210/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | data/studio21_generated/introductory/3210/starter_code.py | vijaykumawat256/Prompt-Summarization | 614f5911e2acd2933440d909de2b4f86653dc214 | [
"Apache-2.0"
] | null | null | null | def get_strings(city):
| 12 | 22 | 0.75 | def get_strings(city):
| false | true |
790151f0296ff43bb49f8d7c43dbacbf5f057c04 | 652 | py | Python | client/permissions.py | My-Garage/resourceideaapi | b872a6f15277989870572ba6e523c9dc378b7a24 | [
"MIT"
] | 1 | 2021-01-20T14:40:06.000Z | 2021-01-20T14:40:06.000Z | client/permissions.py | My-Garage/resourceideaapi | b872a6f15277989870572ba6e523c9dc378b7a24 | [
"MIT"
] | null | null | null | client/permissions.py | My-Garage/resourceideaapi | b872a6f15277989870572ba6e523c9dc378b7a24 | [
"MIT"
] | null | null | null | """Permissions for the client app"""
from rest_framework import permissions
class ClientPermissions(permissions.BasePermission):
"""Handles authorization of requests to the client app."""
def has_permission(self, request, view):
if view.action == 'create' \
and request.user.has_perm('c... | 34.315789 | 66 | 0.628834 | from rest_framework import permissions
class ClientPermissions(permissions.BasePermission):
def has_permission(self, request, view):
if view.action == 'create' \
and request.user.has_perm('client.add_client'):
return True
if view.action in ['update', 'partial_update'] ... | true | true |
7901527760d3dc547db45060c8ee8e9110e8f7a8 | 2,648 | py | Python | server/home.py | poke19962008/Source-Code-Classifier | a2ef331ee3d3f705588bad9c91397f9b2b46d12d | [
"MIT",
"Unlicense"
] | 1 | 2016-11-06T07:39:15.000Z | 2016-11-06T07:39:15.000Z | server/home.py | poke19962008/Source-Code-Classifier | a2ef331ee3d3f705588bad9c91397f9b2b46d12d | [
"MIT",
"Unlicense"
] | null | null | null | server/home.py | poke19962008/Source-Code-Classifier | a2ef331ee3d3f705588bad9c91397f9b2b46d12d | [
"MIT",
"Unlicense"
] | null | null | null | import time
from check_lang import check_py,check_rb,check_j,check_c,check_cpp
from flask import Flask, request, jsonify
from flask_cors import CORS, cross_origin
import subprocess
import json
from json import JSONEncoder
from main import predict
app = Flask(__name__)
CORS(app)
@app.route("/")
def hello():
return... | 28.473118 | 157 | 0.554003 | import time
from check_lang import check_py,check_rb,check_j,check_c,check_cpp
from flask import Flask, request, jsonify
from flask_cors import CORS, cross_origin
import subprocess
import json
from json import JSONEncoder
from main import predict
app = Flask(__name__)
CORS(app)
@app.route("/")
def hello():
return... | false | true |
790152d0f649115c5bffe92159f13e26fa8f9fc0 | 1,605 | py | Python | scalyr_agent/third_party/pysnmp/carrier/asyncore/dispatch.py | code-sauce/scalyr-agent-2 | 41023d5c1272186193dd02900782b150dda5f38e | [
"Apache-2.0"
] | 67 | 2015-02-03T00:35:33.000Z | 2022-03-23T10:14:26.000Z | scalyr_agent/third_party/pysnmp/carrier/asyncore/dispatch.py | code-sauce/scalyr-agent-2 | 41023d5c1272186193dd02900782b150dda5f38e | [
"Apache-2.0"
] | 578 | 2015-04-09T08:58:56.000Z | 2022-03-30T12:13:21.000Z | scalyr_agent/third_party/pysnmp/carrier/asyncore/dispatch.py | code-sauce/scalyr-agent-2 | 41023d5c1272186193dd02900782b150dda5f38e | [
"Apache-2.0"
] | 58 | 2015-01-15T22:00:43.000Z | 2022-02-18T15:48:31.000Z | # Implements I/O over asynchronous sockets
from time import time
from sys import exc_info
from traceback import format_exception
from asyncore import socket_map
from asyncore import loop
from pysnmp.carrier.base import AbstractTransportDispatcher
from pysnmp.error import PySnmpError
class AsyncoreDispatcher(AbstractTr... | 37.325581 | 93 | 0.685358 |
from time import time
from sys import exc_info
from traceback import format_exception
from asyncore import socket_map
from asyncore import loop
from pysnmp.carrier.base import AbstractTransportDispatcher
from pysnmp.error import PySnmpError
class AsyncoreDispatcher(AbstractTransportDispatcher):
def __init__(self)... | true | true |
7901540d8570ef9a1bfd9dec9917f2c247c1890c | 3,382 | py | Python | app/user/tests/test_user_api.py | reallyusefulengine/django_rest_recipe | 49943404bfe4b6a84c3b4f6d8332f952982b3281 | [
"MIT"
] | null | null | null | app/user/tests/test_user_api.py | reallyusefulengine/django_rest_recipe | 49943404bfe4b6a84c3b4f6d8332f952982b3281 | [
"MIT"
] | null | null | null | app/user/tests/test_user_api.py | reallyusefulengine/django_rest_recipe | 49943404bfe4b6a84c3b4f6d8332f952982b3281 | [
"MIT"
] | null | null | null | from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
CREATE_USER_URL = reverse('user:create')
TOKEN_URL = reverse('user:token')
def create_user(**params):
return get_user_model(... | 37.577778 | 77 | 0.63631 | from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
CREATE_USER_URL = reverse('user:create')
TOKEN_URL = reverse('user:token')
def create_user(**params):
return get_user_model(... | true | true |
790154b62d7337a78a9bce3b537685b14b4ca1a2 | 13,300 | py | Python | oscar/lib/python2.7/site-packages/prompt_toolkit/contrib/telnet/server.py | sainjusajan/django-oscar | 466e8edc807be689b0a28c9e525c8323cc48b8e1 | [
"BSD-3-Clause"
] | null | null | null | oscar/lib/python2.7/site-packages/prompt_toolkit/contrib/telnet/server.py | sainjusajan/django-oscar | 466e8edc807be689b0a28c9e525c8323cc48b8e1 | [
"BSD-3-Clause"
] | null | null | null | oscar/lib/python2.7/site-packages/prompt_toolkit/contrib/telnet/server.py | sainjusajan/django-oscar | 466e8edc807be689b0a28c9e525c8323cc48b8e1 | [
"BSD-3-Clause"
] | null | null | null | """
Telnet server.
Example usage::
class MyTelnetApplication(TelnetApplication):
def client_connected(self, telnet_connection):
# Set CLI with simple prompt.
telnet_connection.set_application(
telnet_connection.create_prompt_application(...))
def... | 32.598039 | 98 | 0.60015 | from __future__ import unicode_literals
import socket
import select
import threading
import os
import fcntl
from six import int2byte, text_type, binary_type
from codecs import getincrementaldecoder
from prompt_toolkit.enums import DEFAULT_BUFFER
from prompt_toolkit.eventloop.base import EventLoop
from... | true | true |
790154c57657825a11f9b518ab6fbf9dc7d8e942 | 40,675 | py | Python | gem5/src/dev/arm/RealView.py | gem5-graphics/gem5-graphics | a5ce9f4e1e954f16524c431da64ac8c57b3e212e | [
"BSD-3-Clause"
] | 22 | 2018-07-03T16:46:51.000Z | 2022-03-22T08:29:36.000Z | gem5/src/dev/arm/RealView.py | gem5-graphics/gem5-graphics | a5ce9f4e1e954f16524c431da64ac8c57b3e212e | [
"BSD-3-Clause"
] | null | null | null | gem5/src/dev/arm/RealView.py | gem5-graphics/gem5-graphics | a5ce9f4e1e954f16524c431da64ac8c57b3e212e | [
"BSD-3-Clause"
] | 25 | 2017-12-02T00:46:04.000Z | 2022-02-18T19:28:53.000Z | # Copyright (c) 2009-2017 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functiona... | 41.76078 | 103 | 0.654309 |
from m5.params import *
from m5.proxy import *
from ClockDomain import ClockDomain
from VoltageDomain import VoltageDomain
from Device import BasicPioDevice, PioDevice, IsaFake, BadAddr, DmaDevice
from PciHost import *
from Ethernet import NSGigE, IGbE_igb, IGbE_e1000
from Ide ... | true | true |
790155575af3419dde73d20431a702991834c85d | 419 | py | Python | Collect/SRTM/__init__.py | HesamZamanpour/wapor | 553981e78164e7fd326be5f65a46bdd1dc80288a | [
"Apache-2.0"
] | 1 | 2021-05-24T08:12:03.000Z | 2021-05-24T08:12:03.000Z | Collect/SRTM/__init__.py | HesamZamanpour/wapor | 553981e78164e7fd326be5f65a46bdd1dc80288a | [
"Apache-2.0"
] | 2 | 2020-06-25T08:27:55.000Z | 2020-08-28T07:38:17.000Z | Collect/SRTM/__init__.py | HesamZamanpour/wapor | 553981e78164e7fd326be5f65a46bdd1dc80288a | [
"Apache-2.0"
] | 4 | 2020-09-23T09:51:59.000Z | 2021-08-10T08:59:14.000Z | # -*- coding: utf-8 -*-
"""
Authors: Tim Hessels
Module: Collect/SRTM
Description:
This module downloads DEM data from http://earlywarning.usgs.gov/hydrodata/.
Use the DEM functions to download and create DEM images in Gtiff format.
Examples:
from pyWAPOR.Collect import SRTM
SRTM.DEM(Dir='C:/TempDEM4/', latlim=[29, ... | 20.95 | 76 | 0.711217 |
from .DEM import main as DEM
__all__ = ['DEM']
__version__ = '0.1'
| true | true |
7901555a4670a44fad3948593f79d366e0f5e5e4 | 2,726 | py | Python | apps/trade/src/PositionsManager.py | kikei/btc-bot-ai | cb118fa1809ebef472a2025be697c9050e948009 | [
"Apache-2.0"
] | 1 | 2020-02-02T13:53:21.000Z | 2020-02-02T13:53:21.000Z | apps/trade/src/PositionsManager.py | kikei/btc-bot-ai | cb118fa1809ebef472a2025be697c9050e948009 | [
"Apache-2.0"
] | null | null | null | apps/trade/src/PositionsManager.py | kikei/btc-bot-ai | cb118fa1809ebef472a2025be697c9050e948009 | [
"Apache-2.0"
] | null | null | null | import logging
from Models import Values
from classes import PlayerActions, OnePosition
from ActionsDispatcher import Action
class PositionsManagerDBException(RuntimeError):
pass
class PositionsManager(object):
def __init__(self, models, accountId, logger=None):
self.models = models
self.accountId = accou... | 35.402597 | 79 | 0.657373 | import logging
from Models import Values
from classes import PlayerActions, OnePosition
from ActionsDispatcher import Action
class PositionsManagerDBException(RuntimeError):
pass
class PositionsManager(object):
def __init__(self, models, accountId, logger=None):
self.models = models
self.accountId = accou... | true | true |
790156f4fc37b1b2ef4e1a861aed52450c4fada5 | 680 | py | Python | project_name/users/models.py | Bereware/bedjango-starter | 9ba6ca928bf50c7f24e5f176fba0ac633c61709f | [
"MIT"
] | 58 | 2017-03-07T12:09:50.000Z | 2021-02-21T10:10:09.000Z | project_name/users/models.py | Bereware/bedjango-starter | 9ba6ca928bf50c7f24e5f176fba0ac633c61709f | [
"MIT"
] | 17 | 2017-03-09T16:13:52.000Z | 2018-02-18T20:55:12.000Z | project_name/users/models.py | Bereware/bedjango-starter | 9ba6ca928bf50c7f24e5f176fba0ac633c61709f | [
"MIT"
] | 27 | 2017-03-08T18:59:58.000Z | 2019-07-14T18:54:44.000Z | import uuid
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_countries.fields import CountryField
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
uuid = models.UUIDField(default=uuid.uuid4, editable=Fal... | 42.5 | 133 | 0.780882 | import uuid
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_countries.fields import CountryField
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
uuid = models.UUIDField(default=uuid.uuid4, editable=Fal... | true | true |
790157497ca36b676dd8b3e07c4315ae3df4075a | 8,410 | py | Python | asv_bench/benchmarks/categoricals.py | developing-coder/pandas | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | [
"BSD-3-Clause"
] | 1 | 2019-05-04T03:42:25.000Z | 2019-05-04T03:42:25.000Z | asv_bench/benchmarks/categoricals.py | developing-coder/pandas | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | [
"BSD-3-Clause"
] | null | null | null | asv_bench/benchmarks/categoricals.py | developing-coder/pandas | 9feb3ad92cc0397a04b665803a49299ee7aa1037 | [
"BSD-3-Clause"
] | 1 | 2020-01-02T14:28:17.000Z | 2020-01-02T14:28:17.000Z | import warnings
import numpy as np
import pandas as pd
import pandas.util.testing as tm
try:
from pandas.api.types import union_categoricals
except ImportError:
try:
from pandas.types.concat import union_categoricals
except ImportError:
pass
class Concat:
def setup(self):
N =... | 28.316498 | 77 | 0.592271 | import warnings
import numpy as np
import pandas as pd
import pandas.util.testing as tm
try:
from pandas.api.types import union_categoricals
except ImportError:
try:
from pandas.types.concat import union_categoricals
except ImportError:
pass
class Concat:
def setup(self):
N =... | true | true |
790157504976a4aa3070a39ca031dd015952fa19 | 9,976 | py | Python | numpy/array_api/__init__.py | yashasvimisra2798/numpy | b892ed2c7fa27b2e0d73c12d12ace4b4d4e12897 | [
"BSD-3-Clause"
] | 2 | 2021-08-25T11:22:49.000Z | 2021-08-28T05:35:46.000Z | numpy/array_api/__init__.py | yashasvimisra2798/numpy | b892ed2c7fa27b2e0d73c12d12ace4b4d4e12897 | [
"BSD-3-Clause"
] | 68 | 2021-08-30T05:08:25.000Z | 2022-03-28T05:11:42.000Z | numpy/array_api/__init__.py | yashasvimisra2798/numpy | b892ed2c7fa27b2e0d73c12d12ace4b4d4e12897 | [
"BSD-3-Clause"
] | null | null | null | """
A NumPy sub-namespace that conforms to the Python array API standard.
This submodule accompanies NEP 47, which proposes its inclusion in NumPy. It
is still considered experimental, and will issue a warning when imported.
This is a proof-of-concept namespace that wraps the corresponding NumPy
functions to give a c... | 26.889488 | 84 | 0.697775 |
import warnings
warnings.warn(
"The numpy.array_api submodule is still experimental. See NEP 47.", stacklevel=2
)
__all__ = []
from ._constants import e, inf, nan, pi
__all__ += ["e", "inf", "nan", "pi"]
from ._creation_functions import (
asarray,
arange,
empty,
empty_like,
eye,
from_d... | true | true |
79015799747a5054d9e7fa3a89e743e4be264ccb | 2,170 | py | Python | tests/conftest.py | IBM/castor-messaging | 1bf5001fab7c7479885ececaa58eba5ede9d4fb2 | [
"Apache-2.0"
] | 1 | 2019-05-13T10:35:53.000Z | 2019-05-13T10:35:53.000Z | tests/conftest.py | IBM/castor-messaging | 1bf5001fab7c7479885ececaa58eba5ede9d4fb2 | [
"Apache-2.0"
] | null | null | null | tests/conftest.py | IBM/castor-messaging | 1bf5001fab7c7479885ececaa58eba5ede9d4fb2 | [
"Apache-2.0"
] | 3 | 2019-05-07T16:26:10.000Z | 2019-05-22T13:09:04.000Z | #!/usr/bin/env python3
#author markpurcell@ie.ibm.com
"""RabbitMQ helper class.
/*
* 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 th... | 35 | 116 | 0.74424 |
import pytest
import json
def pytest_addoption(parser):
parser.addoption("--credentials", required=True)
parser.addoption("--feed_queue", required=False)
parser.addoption("--reply_queue", required=False)
@pytest.fixture
def credentials(request):
value = request.config.getoption('credentials')
... | true | true |
79015899e599f2aedca475e99bb3d434f58032e6 | 353 | py | Python | examples/service/fastweb_thrift_async/HelloService/ttypes.py | BSlience/fastweb | 2c1b956e9846c4205d0201d39d09891d088754e4 | [
"Apache-2.0"
] | 123 | 2017-06-06T04:59:07.000Z | 2019-07-11T10:20:35.000Z | examples/service/fastweb_thrift_async/HelloService/ttypes.py | BSlience/fastweb | 2c1b956e9846c4205d0201d39d09891d088754e4 | [
"Apache-2.0"
] | null | null | null | examples/service/fastweb_thrift_async/HelloService/ttypes.py | BSlience/fastweb | 2c1b956e9846c4205d0201d39d09891d088754e4 | [
"Apache-2.0"
] | 2 | 2017-06-28T05:58:39.000Z | 2018-09-25T00:18:33.000Z | #
# Autogenerated by Thrift Compiler (0.10.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py:tornado
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
import sys
from th... | 25.214286 | 93 | 0.798867 |
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
import sys
from thrift.transport import TTransport
| true | true |
7901589efe833a1d4d89f83225c112506102474a | 16,107 | py | Python | h/schemas/annotation.py | bibliotechie/h | 16e275f79ef7d1086971bd30ef403501c6b93beb | [
"BSD-2-Clause"
] | null | null | null | h/schemas/annotation.py | bibliotechie/h | 16e275f79ef7d1086971bd30ef403501c6b93beb | [
"BSD-2-Clause"
] | null | null | null | h/schemas/annotation.py | bibliotechie/h | 16e275f79ef7d1086971bd30ef403501c6b93beb | [
"BSD-2-Clause"
] | null | null | null | """Classes for validating data passed to the annotations API."""
import copy
import colander
from dateutil.parser import parse
from pyramid import i18n
from h.schemas.base import JSONSchema, ValidationError
from h.search.query import LIMIT_DEFAULT, LIMIT_MAX, OFFSET_MAX
from h.search.util import wildcard_uri_is_valid... | 35.168122 | 101 | 0.562488 | import copy
import colander
from dateutil.parser import parse
from pyramid import i18n
from h.schemas.base import JSONSchema, ValidationError
from h.search.query import LIMIT_DEFAULT, LIMIT_MAX, OFFSET_MAX
from h.search.util import wildcard_uri_is_valid
from h.util import document_claims
_ = i18n.TranslationStringFa... | true | true |
790158adb157be042965c36e6ffb3700aa6ba8fe | 528 | py | Python | examples/lsm303_accel_simpletest.py | adafruit/Adafruit_CircuitPython_LSM303AGR_Accel | 14a0708506f00d822e4da879a758362121265eb1 | [
"MIT",
"MIT-0",
"Unlicense"
] | 4 | 2019-12-27T19:51:02.000Z | 2022-01-21T00:00:25.000Z | examples/lsm303_accel_simpletest.py | adafruit/Adafruit_CircuitPython_LSM303AGR_Accel | 14a0708506f00d822e4da879a758362121265eb1 | [
"MIT",
"MIT-0",
"Unlicense"
] | 3 | 2019-10-24T18:15:36.000Z | 2021-09-27T16:46:19.000Z | examples/lsm303_accel_simpletest.py | adafruit/Adafruit_CircuitPython_LSM303AGR_Accel | 14a0708506f00d822e4da879a758362121265eb1 | [
"MIT",
"MIT-0",
"Unlicense"
] | 7 | 2019-12-06T20:04:41.000Z | 2021-07-22T19:13:46.000Z | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
""" Display accelerometer data once per second """
import time
import board
import adafruit_lsm303_accel
i2c = board.I2C() # uses board.SCL and board.SDA
sensor = adafruit_lsm303_accel.LSM303_Accel(i2c)
while True:
ac... | 22.956522 | 73 | 0.666667 |
import time
import board
import adafruit_lsm303_accel
i2c = board.I2C()
sensor = adafruit_lsm303_accel.LSM303_Accel(i2c)
while True:
acc_x, acc_y, acc_z = sensor.acceleration
print(
"Acceleration (m/s^2): ({0:10.3f}, {1:10.3f}, {2:10.3f})".format(
acc_x, acc_y, acc_z
)
)... | true | true |
790158e215a7dfe785db5ea59c5a4d103dc029a6 | 1,509 | py | Python | src/tt_bank/tt_bank/service.py | devapromix/the-tale | 2a10efd3270734f8cf482b4cfbc5353ef8f0494c | [
"BSD-3-Clause"
] | 1 | 2020-04-02T11:51:20.000Z | 2020-04-02T11:51:20.000Z | src/tt_bank/tt_bank/service.py | devapromix/the-tale | 2a10efd3270734f8cf482b4cfbc5353ef8f0494c | [
"BSD-3-Clause"
] | null | null | null | src/tt_bank/tt_bank/service.py | devapromix/the-tale | 2a10efd3270734f8cf482b4cfbc5353ef8f0494c | [
"BSD-3-Clause"
] | null | null | null |
import asyncio
from aiohttp import web
from tt_web import log
from tt_web import postgresql
async def initialize(config, loop):
await postgresql.initialize(config['database'], loop=loop)
async def deinitialize(config, loop):
await postgresql.deinitialize()
async def on_startup(app):
await initializ... | 22.522388 | 80 | 0.726972 |
import asyncio
from aiohttp import web
from tt_web import log
from tt_web import postgresql
async def initialize(config, loop):
await postgresql.initialize(config['database'], loop=loop)
async def deinitialize(config, loop):
await postgresql.deinitialize()
async def on_startup(app):
await initializ... | true | true |
7901597213c34a703821a6a2773bedfe1166770a | 6,588 | py | Python | sdk/python/pulumi_azure_nextgen/servicebus/list_topic_keys.py | pulumi/pulumi-azure-nextgen | 452736b0a1cf584c2d4c04666e017af6e9b2c15c | [
"Apache-2.0"
] | 31 | 2020-09-21T09:41:01.000Z | 2021-02-26T13:21:59.000Z | sdk/python/pulumi_azure_nextgen/servicebus/list_topic_keys.py | pulumi/pulumi-azure-nextgen | 452736b0a1cf584c2d4c04666e017af6e9b2c15c | [
"Apache-2.0"
] | 231 | 2020-09-21T09:38:45.000Z | 2021-03-01T11:16:03.000Z | sdk/python/pulumi_azure_nextgen/servicebus/list_topic_keys.py | pulumi/pulumi-azure-nextgen | 452736b0a1cf584c2d4c04666e017af6e9b2c15c | [
"Apache-2.0"
] | 4 | 2020-09-29T14:14:59.000Z | 2021-02-10T20:38:16.000Z | # 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
__al... | 43.629139 | 224 | 0.713418 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
__all__ = [
'ListTopicKeysResult',
'AwaitableListTopicKeysResult',
'list_topic_keys',
]
@pulumi.output_type
class ListTopicKeysResult:
def __init__(__se... | true | true |
790159f76508832a0f6aa45d9f513f167723094e | 7,570 | py | Python | Dict-search/__init__.py | what-is-me/WordListEnquiry | e80597d70a3f79e442149022df7e45d81a272057 | [
"Apache-2.0"
] | 4 | 2021-11-05T19:48:53.000Z | 2022-02-12T11:21:40.000Z | Dict-search/__init__.py | what-is-me/wordlisttranslate | e80597d70a3f79e442149022df7e45d81a272057 | [
"Apache-2.0"
] | null | null | null | Dict-search/__init__.py | what-is-me/wordlisttranslate | e80597d70a3f79e442149022df7e45d81a272057 | [
"Apache-2.0"
] | 3 | 2021-11-05T19:48:54.000Z | 2022-03-25T10:37:54.000Z | '''
Author: what-is-me
E-mail: nt_cqc@126.com
Github: https://github.com/what-is-me
LeetCode: https://leetcode-cn.com/u/what-is-me/
Date: 2021-05-17 23:22:14
LastEditors: what-is-me
LastEditTime: 2021-05-19 12:33:23
Description: 查询单个单词/词组意思
'''
import re
import urllib.parse
import requests
class getimg... | 31.410788 | 100 | 0.480713 | import re
import urllib.parse
import requests
class getimg:
def youdao(html):
html = html.split('</h2>')[-1]
html = html.split('<span>网络释义</span>')[0]
reg = r'<li>(.*?)</li>'
img = re.compile(reg)
img_list = re.findall(img, html)
result = ""
for... | true | true |
79015c12f6ea88bd8cfe5cd155f92eac2d63e612 | 6,206 | py | Python | semseg/models/bisenetv1.py | Genevievekim/semantic-segmentation-1 | f28b026e44cff80fe3ca4cac94cea27e4073821b | [
"BSD-3-Clause"
] | 196 | 2021-08-22T10:01:34.000Z | 2022-03-29T09:59:51.000Z | semseg/models/bisenetv1.py | Genevievekim/semantic-segmentation-1 | f28b026e44cff80fe3ca4cac94cea27e4073821b | [
"BSD-3-Clause"
] | 21 | 2021-08-22T09:59:02.000Z | 2022-03-29T15:22:46.000Z | semseg/models/bisenetv1.py | Genevievekim/semantic-segmentation-1 | f28b026e44cff80fe3ca4cac94cea27e4073821b | [
"BSD-3-Clause"
] | 36 | 2021-08-22T08:59:40.000Z | 2022-03-28T10:13:20.000Z | import torch
import math
from torch import nn, Tensor
from torch.nn import functional as F
from semseg.models.backbones import *
from semseg.models.modules.common import ConvModule
class SpatialPath(nn.Module):
def __init__(self, c1, c2) -> None:
super().__init__()
ch = 64
self.conv_7x7 =... | 36.940476 | 129 | 0.596197 | import torch
import math
from torch import nn, Tensor
from torch.nn import functional as F
from semseg.models.backbones import *
from semseg.models.modules.common import ConvModule
class SpatialPath(nn.Module):
def __init__(self, c1, c2) -> None:
super().__init__()
ch = 64
self.conv_7x7 =... | true | true |
79015ca13c31ca9be0283a0dc30c6ae249a98364 | 6,589 | py | Python | processor/processor/requests_processor.py | gabrielbazan/sate | ff160d7f024a0422f3cd279b92361ec6e7fd7420 | [
"MIT"
] | null | null | null | processor/processor/requests_processor.py | gabrielbazan/sate | ff160d7f024a0422f3cd279b92361ec6e7fd7420 | [
"MIT"
] | null | null | null | processor/processor/requests_processor.py | gabrielbazan/sate | ff160d7f024a0422f3cd279b92361ec6e7fd7420 | [
"MIT"
] | null | null | null | import json
from time import sleep
from uuid import uuid4
from datetime import datetime
import logging
from kafka import KafkaProducer, KafkaConsumer
from settings import (
KAFKA_BOOTSTRAP_SERVER,
KAFKA_VALUE_ENCODING,
KAFKA_INBOUND_TOPIC,
KAFKA_SUCCESS_OUTBOUND_TOPIC,
KAFKA_ERROR_OUTBOUND_TOPIC,
... | 34.317708 | 100 | 0.700562 | import json
from time import sleep
from uuid import uuid4
from datetime import datetime
import logging
from kafka import KafkaProducer, KafkaConsumer
from settings import (
KAFKA_BOOTSTRAP_SERVER,
KAFKA_VALUE_ENCODING,
KAFKA_INBOUND_TOPIC,
KAFKA_SUCCESS_OUTBOUND_TOPIC,
KAFKA_ERROR_OUTBOUND_TOPIC,
... | true | true |
79015cda1488556f4a202a89907d6ffe380ae288 | 7,660 | py | Python | bot/cogs/memes_cog/memes_cog.py | zepthro/ClemBot | c354cc9ed2a0749a1751a717347f4b5377c0b4b2 | [
"MIT"
] | null | null | null | bot/cogs/memes_cog/memes_cog.py | zepthro/ClemBot | c354cc9ed2a0749a1751a717347f4b5377c0b4b2 | [
"MIT"
] | null | null | null | bot/cogs/memes_cog/memes_cog.py | zepthro/ClemBot | c354cc9ed2a0749a1751a717347f4b5377c0b4b2 | [
"MIT"
] | null | null | null | import concurrent.futures
import datetime
import io
import logging
import os
import random
import time
import typing as t
import discord
import discord.ext.commands as commands
from PIL import Image, ImageDraw, ImageSequence, ImageFont
import bot.extensions as ext
from bot.consts import Colors
from bot... | 35.462963 | 147 | 0.565144 | import concurrent.futures
import datetime
import io
import logging
import os
import random
import time
import typing as t
import discord
import discord.ext.commands as commands
from PIL import Image, ImageDraw, ImageSequence, ImageFont
import bot.extensions as ext
from bot.consts import Colors
from bot... | true | true |
79015d18f178a6c66cd536772ba491841d5cbdf0 | 1,612 | py | Python | settings.py | pk0912/TweetEmotionsPredictor | 5325de8d6df6ea8e2d3627dc36eeb463b5c1ea92 | [
"MIT"
] | null | null | null | settings.py | pk0912/TweetEmotionsPredictor | 5325de8d6df6ea8e2d3627dc36eeb463b5c1ea92 | [
"MIT"
] | null | null | null | settings.py | pk0912/TweetEmotionsPredictor | 5325de8d6df6ea8e2d3627dc36eeb463b5c1ea92 | [
"MIT"
] | null | null | null | import os
LUCKY_SEED = 42
TRAIN_FILE_COUNT = 43
VAL_FILE_COUNT = 12
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
OBJECTS_DIR = os.path.join(ROOT_DIR, "objects")
OUTPUTS_DIR = os.path.join(ROOT_DIR, "outputs")
LOGS_DIR = os.path.join(ROOT_DIR, "logs")
DATA_DIR = os.path.join(ROOT_DIR, "data")
RAW_DATA_DIR =... | 34.297872 | 86 | 0.759926 | import os
LUCKY_SEED = 42
TRAIN_FILE_COUNT = 43
VAL_FILE_COUNT = 12
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
OBJECTS_DIR = os.path.join(ROOT_DIR, "objects")
OUTPUTS_DIR = os.path.join(ROOT_DIR, "outputs")
LOGS_DIR = os.path.join(ROOT_DIR, "logs")
DATA_DIR = os.path.join(ROOT_DIR, "data")
RAW_DATA_DIR =... | true | true |
79015d4d30a421b799f9697e7384e1bf9d8c9584 | 9,661 | py | Python | isi_sdk_8_1_0/isi_sdk_8_1_0/models/snapshot_schedule_extended.py | mohitjain97/isilon_sdk_python | a371f438f542568edb8cda35e929e6b300b1177c | [
"Unlicense"
] | 24 | 2018-06-22T14:13:23.000Z | 2022-03-23T01:21:26.000Z | isi_sdk_8_1_0/isi_sdk_8_1_0/models/snapshot_schedule_extended.py | mohitjain97/isilon_sdk_python | a371f438f542568edb8cda35e929e6b300b1177c | [
"Unlicense"
] | 46 | 2018-04-30T13:28:22.000Z | 2022-03-21T21:11:07.000Z | isi_sdk_8_1_0/isi_sdk_8_1_0/models/snapshot_schedule_extended.py | mohitjain97/isilon_sdk_python | a371f438f542568edb8cda35e929e6b300b1177c | [
"Unlicense"
] | 29 | 2018-06-19T00:14:04.000Z | 2022-02-08T17:51:19.000Z | # coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 5
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class SnapshotScheduleExtended(o... | 28.498525 | 159 | 0.589898 |
import pprint
import re
import six
class SnapshotScheduleExtended(object):
swagger_types = {
'alias': 'str',
'duration': 'int',
'id': 'int',
'name': 'str',
'next_run': 'int',
'next_snapshot': 'str',
'path': 'str',
'pattern': 'str',
's... | true | true |
79015dd33df11e36e24c400cef67799129d10ea4 | 6,026 | py | Python | pyg.py | luizperes/brain-online-repl | c563a311e0e441132bec59d0eab0e37fc1270b5c | [
"MIT"
] | 513 | 2015-01-06T17:06:41.000Z | 2018-06-22T10:50:16.000Z | pyg.py | luizperes/brain-online-repl | c563a311e0e441132bec59d0eab0e37fc1270b5c | [
"MIT"
] | 129 | 2015-01-21T07:50:58.000Z | 2017-12-21T22:46:55.000Z | pyg.py | luizperes/brain-online-repl | c563a311e0e441132bec59d0eab0e37fc1270b5c | [
"MIT"
] | 115 | 2015-01-15T01:05:57.000Z | 2018-05-30T17:55:05.000Z | #!/usr/bin/python2
import re, sys
from pygments import highlight
from pygments.lexers import get_lexer_by_name, JavascriptLexer, FactorLexer
from pygments.formatters import HtmlFormatter
from pygments.token import *
from pygments.lexer import RegexLexer
class UnlambdaLexer(RegexLexer):
name = 'Unlambda'
aliases =... | 30.744898 | 324 | 0.578659 |
import re, sys
from pygments import highlight
from pygments.lexers import get_lexer_by_name, JavascriptLexer, FactorLexer
from pygments.formatters import HtmlFormatter
from pygments.token import *
from pygments.lexer import RegexLexer
class UnlambdaLexer(RegexLexer):
name = 'Unlambda'
aliases = ['unlambda']
fi... | false | true |
79015e4b2c3c10da985bf6c8d20f322ef87441e3 | 11,975 | py | Python | scrapereads/scrape.py | arthurdjn/scrape-goodreads | be0d81ef0be09955599a3fae43648e9945923ff1 | [
"MIT"
] | 3 | 2021-02-10T10:32:48.000Z | 2021-08-06T23:53:22.000Z | scrapereads/scrape.py | arthurdjn/scrape-goodreads | be0d81ef0be09955599a3fae43648e9945923ff1 | [
"MIT"
] | 1 | 2022-03-14T09:33:41.000Z | 2022-03-14T09:33:41.000Z | scrapereads/scrape.py | arthurdjn/scrape-goodreads | be0d81ef0be09955599a3fae43648e9945923ff1 | [
"MIT"
] | null | null | null | """
Scrape quotes, books and authors from ``Good Reads`` website.
"""
import bs4
from .utils import *
def get_author_name(soup):
"""Get the author's name from its main page.
Args:
soup (bs4.element.Tag): connection to the author page.
Returns:
string: name of the author.
Examples::... | 30.470738 | 108 | 0.600585 |
import bs4
from .utils import *
def get_author_name(soup):
author_h1 = soup.find('h1', attrs={'class': 'authorName'})
return author_h1.find('span').text
def get_author_desc(soup):
author_info_desc = soup.find('div', attrs={'class': 'aboutAuthorInfo'})
author_info_long = author_info_desc.findAll('sp... | true | true |
79015e5f22aadae4239d79808c59dfde92ba7d2e | 4,427 | py | Python | tupelo/xmlrpc.py | jait/tupelo | fd6fd6c5c246c1ba3d2496a86cab087284c92af1 | [
"BSD-3-Clause"
] | null | null | null | tupelo/xmlrpc.py | jait/tupelo | fd6fd6c5c246c1ba3d2496a86cab087284c92af1 | [
"BSD-3-Clause"
] | null | null | null | tupelo/xmlrpc.py | jait/tupelo | fd6fd6c5c246c1ba3d2496a86cab087284c92af1 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# vim: set sts=4 sw=4 et:
import time
import xmlrpc.client
from . import players
from . import rpc
from .common import GameState, CardSet, GameError, RuleError, ProtocolError, simple_decorator
from .events import EventList, CardPlayedEvent, MessageEvent, TrickPlayedEvent, TurnEvent, StateChangedE... | 31.621429 | 108 | 0.63813 |
import time
import xmlrpc.client
from . import players
from . import rpc
from .common import GameState, CardSet, GameError, RuleError, ProtocolError, simple_decorator
from .events import EventList, CardPlayedEvent, MessageEvent, TrickPlayedEvent, TurnEvent, StateChangedEvent
@simple_decorator
def error2fault(func):... | true | true |
79015f55f04aee062f85e9234f10a50e4771d3b4 | 178 | py | Python | files/judgeFileType.py | sdyz5210/python | 78f9999f94d92d9ca7fde6f18acec7d3abd422ef | [
"BSD-3-Clause"
] | null | null | null | files/judgeFileType.py | sdyz5210/python | 78f9999f94d92d9ca7fde6f18acec7d3abd422ef | [
"BSD-3-Clause"
] | null | null | null | files/judgeFileType.py | sdyz5210/python | 78f9999f94d92d9ca7fde6f18acec7d3abd422ef | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/evn python
# -*- coding: utf-8 -*-
# python version 2.7.6
import magic
mime = magic.Magic(mime=True)
print mime.from_file("/Users/mac/Documents/data/fastq/8.fastq") | 19.777778 | 63 | 0.696629 |
import magic
mime = magic.Magic(mime=True)
print mime.from_file("/Users/mac/Documents/data/fastq/8.fastq") | false | true |
79016139e007b58d28b563bde3c2e6e9f8f7d9f4 | 838 | py | Python | setup.py | ebelter/upserve-analysis | b33a63eed4caa07ec282995de66e8821d38e7199 | [
"MIT"
] | null | null | null | setup.py | ebelter/upserve-analysis | b33a63eed4caa07ec282995de66e8821d38e7199 | [
"MIT"
] | null | null | null | setup.py | ebelter/upserve-analysis | b33a63eed4caa07ec282995de66e8821d38e7199 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
with open('VERSION.py') as f:
exec(f.read())
setup(
name='upsere analysis',
version=__version__,
description='10X Genomics CLI',
... | 22.648649 | 58 | 0.619332 |
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
with open('VERSION.py') as f:
exec(f.read())
setup(
name='upsere analysis',
version=__version__,
description='10X Genomics CLI',
long_description=rea... | true | true |
79016186edc6e6b1716101da45b246290da87e2b | 4,709 | py | Python | ichnaea/data/tests/test_monitor.py | BBOXX/ichnaea | 15362d5b4d2a45d28cdf4864a89c9d3fa62b8c28 | [
"Apache-2.0"
] | 1 | 2018-01-18T16:02:43.000Z | 2018-01-18T16:02:43.000Z | ichnaea/data/tests/test_monitor.py | BBOXX/ichnaea | 15362d5b4d2a45d28cdf4864a89c9d3fa62b8c28 | [
"Apache-2.0"
] | null | null | null | ichnaea/data/tests/test_monitor.py | BBOXX/ichnaea | 15362d5b4d2a45d28cdf4864a89c9d3fa62b8c28 | [
"Apache-2.0"
] | 1 | 2018-01-19T17:56:48.000Z | 2018-01-19T17:56:48.000Z | from datetime import timedelta
from random import randint
from ichnaea.data.tasks import (
monitor_api_key_limits,
monitor_api_users,
monitor_queue_size,
)
from ichnaea import util
class TestMonitor(object):
def test_monitor_api_keys_empty(self, celery, stats):
monitor_api_key_limits.delay()... | 36.223077 | 79 | 0.561478 | from datetime import timedelta
from random import randint
from ichnaea.data.tasks import (
monitor_api_key_limits,
monitor_api_users,
monitor_queue_size,
)
from ichnaea import util
class TestMonitor(object):
def test_monitor_api_keys_empty(self, celery, stats):
monitor_api_key_limits.delay()... | true | true |
79016261c216d8295176431c2d08472c6cc3482f | 7,009 | py | Python | data/p3BR/R2/benchmark/startQiskit_QC292.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p3BR/R2/benchmark/startQiskit_QC292.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p3BR/R2/benchmark/startQiskit_QC292.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=3
# total number=60
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from... | 31.572072 | 140 | 0.637466 |
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from qiskit.test.mock import FakeVigo... | true | true |
790162bf698c2529b1c8fdedeafe6193a2076e64 | 5,973 | py | Python | src/goodboy/types/numeric.py | andryunin/goodboy | 66ba803630e149d00bcb9c40a0aa0586c97ef48a | [
"MIT"
] | null | null | null | src/goodboy/types/numeric.py | andryunin/goodboy | 66ba803630e149d00bcb9c40a0aa0586c97ef48a | [
"MIT"
] | null | null | null | src/goodboy/types/numeric.py | andryunin/goodboy | 66ba803630e149d00bcb9c40a0aa0586c97ef48a | [
"MIT"
] | null | null | null | from __future__ import annotations
from abc import abstractmethod
from typing import Any, Generic, Optional, TypeVar
from goodboy.errors import Error
from goodboy.messages import DEFAULT_MESSAGES, MessageCollectionType, type_name
from goodboy.schema import Rule, SchemaWithUtils
N = TypeVar("N")
class NumericBase(G... | 34.929825 | 87 | 0.630169 | from __future__ import annotations
from abc import abstractmethod
from typing import Any, Generic, Optional, TypeVar
from goodboy.errors import Error
from goodboy.messages import DEFAULT_MESSAGES, MessageCollectionType, type_name
from goodboy.schema import Rule, SchemaWithUtils
N = TypeVar("N")
class NumericBase(G... | true | true |
7901644916c489ddc04eda403482d98c5cf0b446 | 1,667 | py | Python | azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/replication_status_py3.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 1 | 2021-09-07T18:36:04.000Z | 2021-09-07T18:36:04.000Z | azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/replication_status_py3.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 2 | 2019-10-02T23:37:38.000Z | 2020-10-02T01:17:31.000Z | azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/replication_status_py3.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 1 | 2019-06-17T22:18:23.000Z | 2019-06-17T22:18:23.000Z | # 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 ... | 37.044444 | 78 | 0.637672 |
from msrest.serialization import Model
class ReplicationStatus(Model):
_validation = {
'aggregated_state': {'readonly': True},
'summary': {'readonly': True},
}
_attribute_map = {
'aggregated_state': {'key': 'aggregatedState', 'type': 'str'},
'summary': {'key': ... | true | true |
790164e04235f1c5c08991bc08e0569374182c2b | 1,511 | py | Python | z3/dinner.py | Wikunia/hakank | 030bc928d2efe8dcbc5118bda3f8ae9575d0fd13 | [
"MIT"
] | 279 | 2015-01-10T09:55:35.000Z | 2022-03-28T02:34:03.000Z | z3/dinner.py | Wikunia/hakank | 030bc928d2efe8dcbc5118bda3f8ae9575d0fd13 | [
"MIT"
] | 10 | 2017-10-05T15:48:50.000Z | 2021-09-20T12:06:52.000Z | z3/dinner.py | Wikunia/hakank | 030bc928d2efe8dcbc5118bda3f8ae9575d0fd13 | [
"MIT"
] | 83 | 2015-01-20T03:44:00.000Z | 2022-03-13T23:53:06.000Z | #!/usr/bin/python -u
# -*- coding: latin-1 -*-
#
# Dinner problem in Z3
#
# From http://www.sellsbrothers.com/spout/#The_Logic_of_Logic
# """
# My son came to me the other day and said, "Dad, I need help with a
# math problem." The problem went like this:
#
# * We're going out to dinner taking 1-6 grandparents, 1-10 p... | 27.981481 | 88 | 0.68233 |
me the other day and said, "Dad, I need help with a
# math problem." The problem went like this:
#
# * We're going out to dinner taking 1-6 grandparents, 1-10 parents and/or 1-40 children
# * Grandparents cost $3 for dinner, parents $2 and children $0.50
# * There must be 20 total people at dinner and it must cost... | true | true |
7901653016a0a42cadc1dee37098fc4dc71fefa6 | 14,082 | py | Python | tensorboard/plugins/hparams/backend_context_test.py | aryaman4/tensorboard | 4da84884c77bb094c6d87a3d9df009d54d69af49 | [
"Apache-2.0"
] | 1 | 2021-04-05T21:16:16.000Z | 2021-04-05T21:16:16.000Z | tensorboard/plugins/hparams/backend_context_test.py | zalzala/tensorboard | 72a104edb0f8d83ef8889ebee7dd39be684461c1 | [
"Apache-2.0"
] | null | null | null | tensorboard/plugins/hparams/backend_context_test.py | zalzala/tensorboard | 72a104edb0f8d83ef8889ebee7dd39be684461c1 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 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... | 37.452128 | 84 | 0.569805 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import operator
try:
from unittest import mock
except ImportError:
import mock
import tensorflow as tf
from google.protobuf import text_format
from tensorboard import context
fro... | true | true |
790165724c4788d42311acba5d09690a8563157f | 147 | py | Python | tests/contract/test_contract_identidock.py | anirbanroydas/RChat-RabbitMQ-AMQP- | d4106357def0b36e1e803986c13c4fd84ec91e6a | [
"MIT"
] | 52 | 2016-07-26T08:57:44.000Z | 2022-03-30T06:50:07.000Z | tests/contract/test_contract_identidock.py | anirbanroydas/elaster | 08b5873d7a61d01905d059e08cc9ba533358e684 | [
"MIT"
] | 2 | 2016-05-18T22:45:44.000Z | 2017-09-19T03:55:22.000Z | tests/contract/test_contract_identidock.py | anirbanroydas/elaster | 08b5873d7a61d01905d059e08cc9ba533358e684 | [
"MIT"
] | 22 | 2017-11-26T22:04:43.000Z | 2022-02-10T04:21:23.000Z | # import unittest
import pytest
# from ci_testing_python.app.identidock import app
if __name__ == '__main__':
# unittest.main()
pytest.main()
| 14.7 | 50 | 0.741497 |
import pytest
if __name__ == '__main__':
pytest.main()
| true | true |
79016636207cea316bdee299c0f14bde4f689728 | 8,879 | py | Python | geoist/cattools/MapTools.py | wqqpp007/geoist | 116b674eae3da4ee706902ce7f5feae1f61f43a5 | [
"MIT"
] | 1 | 2020-06-04T01:09:24.000Z | 2020-06-04T01:09:24.000Z | geoist/cattools/MapTools.py | wqqpp007/geoist | 116b674eae3da4ee706902ce7f5feae1f61f43a5 | [
"MIT"
] | null | null | null | geoist/cattools/MapTools.py | wqqpp007/geoist | 116b674eae3da4ee706902ce7f5feae1f61f43a5 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
#-----------------------------------------------------------------------------------------
class GeoMap:
'''
INFO:
Map boundary edges order:
... | 30.937282 | 90 | 0.401847 |
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
class GeoMap:
def __init__(self, Cfg=[]):
if not Cfg:
self._cfg = {'Bounds': [7., 36., 19., 48.],
'FigSize': [6., 6.],
'Background': ... | true | true |
790166f632e8151a123c27d2c3e525232a3cc545 | 35,713 | py | Python | docstring_styles.py | dextreem/SublimeAutoDocstring | 2b986fe8754a36434b10da5f58b07f07da316685 | [
"MIT"
] | 60 | 2015-05-04T06:58:49.000Z | 2022-02-23T14:42:35.000Z | docstring_styles.py | dextreem/SublimeAutoDocstring | 2b986fe8754a36434b10da5f58b07f07da316685 | [
"MIT"
] | 48 | 2015-05-10T00:42:24.000Z | 2022-02-22T19:05:42.000Z | docstring_styles.py | dextreem/SublimeAutoDocstring | 2b986fe8754a36434b10da5f58b07f07da316685 | [
"MIT"
] | 14 | 2015-07-16T22:48:26.000Z | 2022-02-21T06:25:07.000Z | # -*- 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... | 35.641717 | 89 | 0.540895 |
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_types = str,
else:
string_types = basestring,
def make_docstring_obj(docstr, default="google", te... | true | true |
790167157a9a024c8a75e10f3de03b5d641fbd82 | 812 | py | Python | espaloma/nn/readout/node_typing.py | cschlick/espaloma | cae5664446d0c89025de5eb827f507d8af64e2d4 | [
"MIT"
] | 60 | 2020-05-15T13:21:55.000Z | 2022-03-29T17:53:17.000Z | espaloma/nn/readout/node_typing.py | cschlick/espaloma | cae5664446d0c89025de5eb827f507d8af64e2d4 | [
"MIT"
] | 72 | 2020-04-16T18:49:51.000Z | 2022-03-25T14:24:52.000Z | espaloma/nn/readout/node_typing.py | cschlick/espaloma | cae5664446d0c89025de5eb827f507d8af64e2d4 | [
"MIT"
] | 5 | 2020-11-13T19:24:09.000Z | 2022-01-19T20:49:08.000Z | # =============================================================================
# IMPORTS
# =============================================================================
import torch
from espaloma.nn.readout.base_readout import BaseReadout
# ===========================================================================... | 32.48 | 79 | 0.383005 |
import torch
from espaloma.nn.readout.base_readout import BaseReadout
class NodeTyping(BaseReadout):
def __init__(self, in_features, n_classes=100):
super(NodeTyping, self).__init__()
self.c = torch.nn.Linear(in_features, n_classes)
def forward(self, g):
g.apply_nodes(
... | true | true |
790167ae4a2f2af95da14362ccfeb3293564046d | 373 | py | Python | Lecture_notes/数据提取与验证码的识别(上)/code/jsonpath_test.py | littleturings/2021PythonWebCrawler | a9089a912affce4369cf50df3c22c55eb4ebf2d5 | [
"MIT"
] | 1 | 2021-02-03T08:28:16.000Z | 2021-02-03T08:28:16.000Z | Lecture_notes/数据提取与验证码的识别(上)/code/jsonpath_test.py | littleturings/2021PythonWebCrawler | a9089a912affce4369cf50df3c22c55eb4ebf2d5 | [
"MIT"
] | null | null | null | Lecture_notes/数据提取与验证码的识别(上)/code/jsonpath_test.py | littleturings/2021PythonWebCrawler | a9089a912affce4369cf50df3c22c55eb4ebf2d5 | [
"MIT"
] | null | null | null | from fake_useragent import UserAgent
import requests
from jsonpath import jsonpath
url = "https://www.lagou.com/lbs/getAllCitySearchLabels.json"
headers = {"User-Agent": UserAgent().chrome}
resp = requests.get(url, headers=headers)
ids = jsonpath(resp.json(), "$..id")
names = jsonpath(resp.json(), "$..name")
for i... | 23.3125 | 61 | 0.705094 | from fake_useragent import UserAgent
import requests
from jsonpath import jsonpath
url = "https://www.lagou.com/lbs/getAllCitySearchLabels.json"
headers = {"User-Agent": UserAgent().chrome}
resp = requests.get(url, headers=headers)
ids = jsonpath(resp.json(), "$..id")
names = jsonpath(resp.json(), "$..name")
for i... | true | true |
79016946767147d0fbaeddece8c5f2511d1e6b1d | 178 | py | Python | floris/tools/optimization/scipy/__init__.py | eirikur16/flrs | c98604593753def05086b54ce82f5551f01d2529 | [
"Apache-2.0"
] | 91 | 2019-06-04T08:56:29.000Z | 2022-03-13T17:39:22.000Z | floris/tools/optimization/scipy/__init__.py | eirikur16/flrs | c98604593753def05086b54ce82f5551f01d2529 | [
"Apache-2.0"
] | 224 | 2019-04-08T22:03:45.000Z | 2022-03-31T17:56:09.000Z | floris/tools/optimization/scipy/__init__.py | eirikur16/flrs | c98604593753def05086b54ce82f5551f01d2529 | [
"Apache-2.0"
] | 97 | 2019-04-23T20:48:20.000Z | 2022-03-29T08:17:02.000Z | from . import (
yaw,
layout,
base_COE,
optimization,
layout_height,
power_density,
yaw_wind_rose,
power_density_1D,
yaw_wind_rose_parallel,
)
| 14.833333 | 27 | 0.651685 | from . import (
yaw,
layout,
base_COE,
optimization,
layout_height,
power_density,
yaw_wind_rose,
power_density_1D,
yaw_wind_rose_parallel,
)
| true | true |
79016a2841defa9016d34e37abaa9b4dd8225e46 | 5,881 | py | Python | config.py | sdtaylor/scheduleCrossRef | d948308ed9e3eaf2ae4ecefab61d41754a435e90 | [
"MIT"
] | null | null | null | config.py | sdtaylor/scheduleCrossRef | d948308ed9e3eaf2ae4ecefab61d41754a435e90 | [
"MIT"
] | 8 | 2016-08-11T15:03:26.000Z | 2017-04-14T12:51:41.000Z | config.py | sdtaylor/scheduleCrossRef | d948308ed9e3eaf2ae4ecefab61d41754a435e90 | [
"MIT"
] | null | null | null | #The term schedule that gets displayed. Can do multiple terms in the case of displaying
#summer and fall at the same time. ie termNames ['2201','2208']
termNames=['2218']
majorTemplate='in/majorPage.html.mako'
#Add new majors here.
#Name: short name for the major
#classFile: the csv file containing all the classes in... | 57.097087 | 112 | 0.60857 |
termNames=['2218']
majorTemplate='in/majorPage.html.mako'
majors=[
{'name': 'SNRE', 'classFile': 'majorClassLists/SNREList.csv', 'asof': 'Oct 10,2015'},
{'name': 'WEC', 'classFile': 'majorClassLists/WECList.csv', 'asof': 'Oct 10,2015'}
]
terms=[
{'name' :'2218', 'prettyName':'Fall 202... | true | true |
79016add5752b9c41913c61c3c313c0dbeeea4a9 | 1,240 | py | Python | src/emmental/utils/seed.py | KeAWang/emmental | dae9f9fbba944f7c8404ab85aa9296545db1b82b | [
"MIT"
] | null | null | null | src/emmental/utils/seed.py | KeAWang/emmental | dae9f9fbba944f7c8404ab85aa9296545db1b82b | [
"MIT"
] | null | null | null | src/emmental/utils/seed.py | KeAWang/emmental | dae9f9fbba944f7c8404ab85aa9296545db1b82b | [
"MIT"
] | null | null | null | # Copyright (c) 2021 Sen Wu. All Rights Reserved.
"""Helper function to set random seed for reproducibility of models."""
import logging
import random
from typing import Optional
import numpy as np
import torch
logger = logging.getLogger(__name__)
def set_random_seed(seed: Optional[int] = None) -> None:
"""S... | 27.555556 | 87 | 0.664516 |
import logging
import random
from typing import Optional
import numpy as np
import torch
logger = logging.getLogger(__name__)
def set_random_seed(seed: Optional[int] = None) -> None:
max_value = np.iinfo(np.uint32).max
min_value = np.iinfo(np.uint32).min
try:
seed = int(seed)
logger... | true | true |
79016b82d35531de3a104ba9fd851f24783eea7a | 123 | py | Python | spotdl/command_line/exitcodes.py | khjxiaogu/spotify-downloader | a8dcb8d998da0769bbe210f2808d16b346453c23 | [
"MIT"
] | 4,698 | 2017-06-20T22:37:10.000Z | 2022-03-28T13:38:07.000Z | spotdl/command_line/exitcodes.py | Delgan/spotify-downloader | 8adf3e8d6b98269b1538dd91c9a44ed345c77545 | [
"MIT"
] | 690 | 2017-06-20T20:08:42.000Z | 2022-02-26T23:36:07.000Z | spotdl/command_line/exitcodes.py | Delgan/spotify-downloader | 8adf3e8d6b98269b1538dd91c9a44ed345c77545 | [
"MIT"
] | 741 | 2017-06-21T23:32:51.000Z | 2022-03-07T12:11:54.000Z | KEYBOARD_INTERRUPT = 1
ARGUMENT_ERROR = 2
# When playlists, albums, artists, users aren't found.
URI_NOT_FOUND_ERROR = 5
| 17.571429 | 54 | 0.772358 | KEYBOARD_INTERRUPT = 1
ARGUMENT_ERROR = 2
URI_NOT_FOUND_ERROR = 5
| true | true |
79016bb28f164d02030a50f9f09a1aa1410c864f | 553 | py | Python | jobs/migrations/0001_initial.py | muhammadh-s/web-portfolio | cd2c3d9bb0cc6e5f1a058fa20c52d2edcaf7c573 | [
"MIT"
] | null | null | null | jobs/migrations/0001_initial.py | muhammadh-s/web-portfolio | cd2c3d9bb0cc6e5f1a058fa20c52d2edcaf7c573 | [
"MIT"
] | 1 | 2019-02-08T14:09:06.000Z | 2019-02-08T14:09:06.000Z | jobs/migrations/0001_initial.py | muhammadh-s/web-portfolio | cd2c3d9bb0cc6e5f1a058fa20c52d2edcaf7c573 | [
"MIT"
] | null | null | null | # Generated by Django 2.1.3 on 2018-11-24 07:01
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Job',
fields=[
('id', models.AutoField(auto... | 24.043478 | 114 | 0.56962 |
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Job',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=Fals... | true | true |
79016be67214c4d6f1999c5b7a053e5a7b167e1f | 2,239 | py | Python | mmskeleton/utils/checkpoint.py | Trebua/mmskeleton | df2057e5d25ff19204ae60e710326bee72c625e1 | [
"Apache-2.0"
] | 1,347 | 2019-08-24T19:03:50.000Z | 2022-03-29T05:44:57.000Z | mmskeleton/utils/checkpoint.py | Trebua/mmskeleton | df2057e5d25ff19204ae60e710326bee72c625e1 | [
"Apache-2.0"
] | 246 | 2019-08-24T15:36:11.000Z | 2022-03-23T06:57:02.000Z | mmskeleton/utils/checkpoint.py | Trebua/mmskeleton | df2057e5d25ff19204ae60e710326bee72c625e1 | [
"Apache-2.0"
] | 335 | 2019-08-25T14:54:19.000Z | 2022-03-31T23:07:18.000Z | from mmcv.runner import load_checkpoint as mmcv_load_checkpoint
from mmcv.runner.checkpoint import load_url_dist
import urllib
mmskeleton_model_urls = {
'st_gcn/kinetics-skeleton': "https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmskeleton/models/st-gcn/st_gcn.kinetics-6fa43f73.pth",
'st_gcn/ntu-xsub': "h... | 47.638298 | 216 | 0.748995 | from mmcv.runner import load_checkpoint as mmcv_load_checkpoint
from mmcv.runner.checkpoint import load_url_dist
import urllib
mmskeleton_model_urls = {
'st_gcn/kinetics-skeleton': "https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmskeleton/models/st-gcn/st_gcn.kinetics-6fa43f73.pth",
'st_gcn/ntu-xsub': "h... | true | true |
79016c13be9e84ffa82e8022bf0d53d91829182f | 24,051 | py | Python | Python3/Tornado/apps/ExchangeWalletApi/ExWallet/bsv/handler.py | youngqqcn/QBlockChainNotes | 85122049024dc5555705bf016312491a51966621 | [
"MIT"
] | 24 | 2018-11-01T03:36:43.000Z | 2022-03-28T08:20:30.000Z | Python3/Tornado/apps/ExchangeWalletApi/ExWallet/bsv/handler.py | songning4/QBlockChainNotes | d65ede073f5a20f728f41cc6850409693820cdb1 | [
"MIT"
] | 57 | 2019-12-04T08:26:47.000Z | 2022-03-08T07:35:15.000Z | Python3/Tornado/apps/ExchangeWalletApi/ExWallet/bsv/handler.py | youngqqcn/QBlockChainNotes | 85122049024dc5555705bf016312491a51966621 | [
"MIT"
] | 11 | 2019-01-04T08:41:57.000Z | 2022-03-16T03:51:36.000Z | #coding:utf8
#authors : yqq
import logging
import json
from utils import decimal_default,get_linenumber
from base_handler import BaseHandler
from .proxy import AuthServiceProxy
from cashaddress import convert
import traceback
#设置精度
from decimal import Decimal
from decimal import getcontext
getcontext().prec = 8
f... | 43.808743 | 139 | 0.627541 |
import logging
import json
from utils import decimal_default,get_linenumber
from base_handler import BaseHandler
from .proxy import AuthServiceProxy
from cashaddress import convert
import traceback
from decimal import Decimal
from decimal import getcontext
getcontext().prec = 8
from constants import BSV_RPC_URL ... | true | true |
79016cd7b072ebe0a6633862ea0beada1a4ce8ca | 186 | py | Python | dataset_utils/general_utils.py | kareemjano/image_toolbox | ea9e1654142a1492e7e462b4f0a8245f4ee430ae | [
"Apache-2.0"
] | null | null | null | dataset_utils/general_utils.py | kareemjano/image_toolbox | ea9e1654142a1492e7e462b4f0a8245f4ee430ae | [
"Apache-2.0"
] | null | null | null | dataset_utils/general_utils.py | kareemjano/image_toolbox | ea9e1654142a1492e7e462b4f0a8245f4ee430ae | [
"Apache-2.0"
] | null | null | null | from collections import defaultdict
def list_to_map(Xs, ys):
labels_map = defaultdict(list)
for x, y in list(zip(Xs, ys)):
labels_map[y].append(x)
return labels_map | 23.25 | 35 | 0.682796 | from collections import defaultdict
def list_to_map(Xs, ys):
labels_map = defaultdict(list)
for x, y in list(zip(Xs, ys)):
labels_map[y].append(x)
return labels_map | true | true |
79016cdb695b3d6ba5c0c673abce73f037ff232b | 217 | py | Python | Config.py | sjsafranek/pomegranate | 8965a7cc2fe8b6981f3961fa8cd6e8b1bdff8ccf | [
"MIT"
] | null | null | null | Config.py | sjsafranek/pomegranate | 8965a7cc2fe8b6981f3961fa8cd6e8b1bdff8ccf | [
"MIT"
] | 1 | 2017-01-19T02:02:15.000Z | 2017-01-19T02:38:58.000Z | Config.py | sjsafranek/pomegranate | 8965a7cc2fe8b6981f3961fa8cd6e8b1bdff8ccf | [
"MIT"
] | null | null | null | #!/usr/bin/python
import os
import json
def get_db_config():
# read config file and return data
data = {}
with open('config.json', 'r') as infile:
data = json.loads(infile.read())
return data
| 19.727273 | 44 | 0.631336 |
import os
import json
def get_db_config():
data = {}
with open('config.json', 'r') as infile:
data = json.loads(infile.read())
return data
| true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.