index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
12,501 | theparadoxer02/koinex | refs/heads/master | /accounts/models.py | from django.db import models
from django.contrib.auth.models import User
from django import forms
class Account(models.Model):
" Accounts "
status_option = (
('Submitted', 'Submitted'),
('Verified', 'Verified',),
('Rejected', 'Rejected'),
)
user = models.OneToOneField(User, on_delete=models.CASCADE)
first_... | {"/accounts/admin.py": ["/accounts/models.py"], "/accounts/api/serializers.py": ["/accounts/models.py"], "/accounts/api/views.py": ["/accounts/api/serializers.py"], "/accounts/api/urls.py": ["/accounts/api/views.py"]} |
12,510 | igpg/htcap | refs/heads/master | /scripts/htmlreport.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
HTCAP - beta 1
Author: filippo.cavallarin@wearesegment.com
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (... | {"/core/crawl/lib/probe.py": ["/core/lib/request.py"]} |
12,511 | igpg/htcap | refs/heads/master | /htcap.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
HTCAP - beta 1
Author: filippo.cavallarin@wearesegment.com
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (a... | {"/core/crawl/lib/probe.py": ["/core/lib/request.py"]} |
12,512 | igpg/htcap | refs/heads/master | /core/crawl/crawler_thread.py | # -*- coding: utf-8 -*-
"""
HTCAP - beta 1
Author: filippo.cavallarin@wearesegment.com
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
... | {"/core/crawl/lib/probe.py": ["/core/lib/request.py"]} |
12,513 | igpg/htcap | refs/heads/master | /core/crawl/lib/probe.py | # -*- coding: utf-8 -*-
"""
HTCAP - beta 1
Author: filippo.cavallarin@wearesegment.com
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any lat... | {"/core/crawl/lib/probe.py": ["/core/lib/request.py"]} |
12,514 | igpg/htcap | refs/heads/master | /scripts/ajax.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import sqlite3
import json
import getopt
import os
reload(sys)
sys.setdefaultencoding('utf8')
qry = """
SELECT r.id, r.url as page, r.referer, a.method, a.url,a.data,a.trigger
FROM request r inner join request a on r.id=a.id_parent
WHERE (a.type='xhr')
... | {"/core/crawl/lib/probe.py": ["/core/lib/request.py"]} |
12,515 | igpg/htcap | refs/heads/master | /scripts/vulns.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import sqlite3
import json
reload(sys)
sys.setdefaultencoding('utf8')
qry = """
SELECT scanner,start_date,end_date,id_request,type,description FROM assessment a
INNER JOIN vulnerability av ON a.id=av.id_assessment
WHERE
%s
"""
if len(sys.argv) < 2:
pr... | {"/core/crawl/lib/probe.py": ["/core/lib/request.py"]} |
12,516 | igpg/htcap | refs/heads/master | /core/lib/request.py | # -*- coding: utf-8 -*-
"""
HTCAP - beta 1
Author: filippo.cavallarin@wearesegment.com
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any lat... | {"/core/crawl/lib/probe.py": ["/core/lib/request.py"]} |
12,517 | igpg/htcap | refs/heads/master | /scripts/curl.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import sqlite3
import json
reload(sys)
sys.setdefaultencoding('utf8')
qry = "SELECT method, url, data, referer, cookies FROM request WHERE %s"
if len(sys.argv) < 2:
print "usage: %s <dbfile> [<final_part_of_query>]\n base query: %s" % (sys.argv[0], qry)... | {"/core/crawl/lib/probe.py": ["/core/lib/request.py"]} |
12,518 | Py-Lambdas/office-hours-django | refs/heads/main | /tasks/migrations/0001_initial.py | # Generated by Django 3.1.3 on 2020-11-03 04:19
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Project',
fiel... | {"/tasks/admin.py": ["/tasks/models.py"]} |
12,519 | Py-Lambdas/office-hours-django | refs/heads/main | /tasks/admin.py | from django.contrib import admin
from .models import Task, Project
admin.site.register(Task)
admin.site.register(Project) | {"/tasks/admin.py": ["/tasks/models.py"]} |
12,520 | Py-Lambdas/office-hours-django | refs/heads/main | /tasks/models.py | import uuid
from django.db import models
class Task(models.Model):
class TaskPriority(models.TextChoices):
URGENT = "U", "Urgent"
HIGH = "H", "High"
MEDIUM = "M", "Medium"
LOW = "L", "Low"
id = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4)
name = ... | {"/tasks/admin.py": ["/tasks/models.py"]} |
12,556 | n-miyamoto/multvariable_lstm | refs/heads/master | /train.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from make_data import *
from stacked_lstm import *
import numpy as np
from chainer import optimizers, cuda
import time
import sys
import _pickle as cPickle
IN_UNITS = 5
HIDDEN_UNITS_L1 = 80
HIDDEN_UNITS_L2 = 80
OUT_UNITS = 5
TRAINING_EPOCHS = 4000
DISPLAY_EPOCH = 10
MINI_BATC... | {"/train.py": ["/make_data.py"], "/predict.py": ["/make_data.py"]} |
12,557 | n-miyamoto/multvariable_lstm | refs/heads/master | /make_data.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import numpy as np
import math
import random
import pandas as pd
ROW_SIZE = 5
TRAINING_START = 0
TRAINING_SIGNAL_LENGTH = 100000
random.seed(0)
class DataMaker(object):
def __init__(self, steps_per_cycle, number_of_cycles):
#self.steps_per_cycl... | {"/train.py": ["/make_data.py"], "/predict.py": ["/make_data.py"]} |
12,558 | n-miyamoto/multvariable_lstm | refs/heads/master | /predict.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import _pickle as cPickle
import numpy as np
from chainer import optimizers, cuda
import chainer
from make_data import *
MODEL_PATH = "./model.pkl"
PREDICTION_LENGTH = 75
PREDICTION_PATH = "./prediction.txt"
INITIAL_PATH = "./initial.txt"
MINI_BATCH_SIZE = 100
LENGTH... | {"/train.py": ["/make_data.py"], "/predict.py": ["/make_data.py"]} |
12,581 | gazeti/aleph | refs/heads/master | /aleph/logic/permissions.py | import logging
from flask import render_template
from aleph.core import db, app_url, app_title
from aleph.notify import notify_role
from aleph.model import Permission
log = logging.getLogger(__name__)
def update_permission(role, collection, read, write):
"""Update a roles permission to access a given collection... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,582 | gazeti/aleph | refs/heads/master | /aleph/tests/test_models.py | from aleph.core import db
from aleph.model import Collection, Entity
from aleph.logic import delete_pending
from aleph.tests.factories.models import EntityFactory, CollectionFactory
from aleph.tests.util import TestCase
class EntityModelTest(TestCase):
def setUp(self):
super(EntityModelTest, self).setUp(... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,583 | gazeti/aleph | refs/heads/master | /aleph/analyze/polyglot_entity.py | from __future__ import absolute_import
import logging
from polyglot.text import Text
from aleph.analyze.analyzer import Analyzer
from aleph.model import DocumentTag, DocumentTagCollector
log = logging.getLogger(__name__)
class PolyglotEntityAnalyzer(Analyzer):
ORIGIN = 'polyglot'
MIN_LENGTH = 100
TYPES... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,584 | gazeti/aleph | refs/heads/master | /aleph/search/leads.py | import logging
from aleph.core import es, es_index
from aleph.index import TYPE_LEAD, TYPE_ENTITY
from aleph.search.util import execute_basic
from aleph.search.fragments import filter_query, authz_filter, aggregate
from aleph.search.entities import facet_collections
from aleph.search.facet import parse_facet_result
l... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,585 | gazeti/aleph | refs/heads/master | /aleph/views/search_api.py | from flask import Blueprint, request
from apikit import jsonify
from aleph.core import url_for
from aleph.views.cache import enable_cache
from aleph.events import log_event
from aleph.search import QueryState
from aleph.search import documents_query
from aleph.search.util import next_params
blueprint = Blueprint('se... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,586 | gazeti/aleph | refs/heads/master | /aleph/model/validate.py | import os
import json
from dalet import is_country_code, is_partial_date, is_language_code
from dalet import is_domain, is_url
from jsonschema import Draft4Validator, FormatChecker, RefResolver
from aleph.core import get_config
resolver = RefResolver('core.json#', {})
SCHEMA_DIR = os.path.join(os.path.dirname(__file... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,587 | gazeti/aleph | refs/heads/master | /aleph/views/crawlers_api.py | from flask import Blueprint, request
from apikit import request_data, jsonify, Pager
from aleph.crawlers import get_exposed_crawlers, execute_crawler
blueprint = Blueprint('crawlers_api', __name__)
@blueprint.route('/api/1/crawlers', methods=['GET'])
def index():
request.authz.require(request.authz.is_admin)
... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,588 | gazeti/aleph | refs/heads/master | /aleph/views/entities_api.py | from flask import Blueprint, request
from werkzeug.exceptions import BadRequest
from apikit import obj_or_404, jsonify, request_data, arg_bool
from aleph.core import db, schemata
from aleph.model import Entity, Collection
from aleph.logic import update_entity, delete_entity, combined_entity
from aleph.events import lo... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,589 | gazeti/aleph | refs/heads/master | /aleph/model/entity_identity.py | import logging
from aleph.core import db
from aleph.model.common import IdModel, DatedModel
log = logging.getLogger(__name__)
class EntityIdentity(db.Model, IdModel, DatedModel):
CONFIRMED = 1
REJECTED = 2
UNDECIDED = 3
JUDGEMENTS = [1, 2, 3]
entity_id = db.Column(db.String(32), db.ForeignKey(... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,590 | gazeti/aleph | refs/heads/master | /aleph/model/entity.py | import logging
from datetime import datetime
from sqlalchemy import func
from sqlalchemy.orm import joinedload
from sqlalchemy.dialects.postgresql import JSONB, ARRAY
from aleph.core import db, schemata
from aleph.text import match_form, string_value
from aleph.util import ensure_list
from aleph.model.collection impor... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,591 | gazeti/aleph | refs/heads/master | /aleph/datasets/mapper.py | import logging
import fingerprints
from hashlib import sha1
from pprint import pprint # noqa
from aleph.core import schemata
from aleph.schema import Schema
from aleph.util import dict_list, unique_list
from aleph.text import string_value
from aleph.datasets.formatting import Formatter
from aleph.datasets.util import... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,592 | gazeti/aleph | refs/heads/master | /aleph/model/cache.py | from aleph.core import db
class Cache(db.Model):
"""Store OCR computation results."""
__tablename__ = 'cache'
id = db.Column(db.BigInteger, primary_key=True)
key = db.Column(db.Unicode, index=True)
value = db.Column(db.Unicode)
@classmethod
def get_cache(cls, key):
q = db.session... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,593 | gazeti/aleph | refs/heads/master | /aleph/logic/leads.py | # Lead generator
import logging
from aleph.authz import Authz
from aleph.core import db
from aleph.index import delete_entity_leads, index_lead
from aleph.search import QueryState
from aleph.search.entities import load_entity, similar_entities
from aleph.model import EntityIdentity
from aleph.logic.distance import ent... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,594 | gazeti/aleph | refs/heads/master | /aleph/ingest/result.py | import logging
from collections import OrderedDict
from ingestors import Result
from normality import stringify
from aleph.core import db
from aleph.model import Document, DocumentRecord
from aleph.model import DocumentTag, DocumentTagCollector
log = logging.getLogger(__name__)
class DocumentResult(Result):
"""... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,595 | gazeti/aleph | refs/heads/master | /aleph/logic/alerts.py | import logging
from urllib import quote_plus
from flask import render_template, current_app
from aleph.authz import Authz
from aleph.core import app_title, app_url, db, celery
from aleph.model import Role, Alert, Collection
from aleph.notify import notify_role
from aleph.search import QueryState, documents_query
log ... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,596 | gazeti/aleph | refs/heads/master | /aleph/schema/__init__.py | from aleph.util import dict_list, ensure_list
from aleph.text import string_value
from aleph.schema.types import resolve_type
class SchemaValidationException(Exception):
"""Schema validation errors will be caught by the API."""
def __init__(self, errors):
self.errors = errors
super(SchemaVali... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,597 | gazeti/aleph | refs/heads/master | /aleph/logic/collections.py | import logging
from datetime import datetime
from aleph.core import db, celery
from aleph.model import Collection, Entity
from aleph.index.collections import delete_collection as index_delete
from aleph.analyze import analyze_documents
from aleph.logic.entities import delete_entity
from aleph.logic.entities import upd... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,598 | gazeti/aleph | refs/heads/master | /aleph/datasets/formatting.py | import re
import six
from normality import collapse_spaces
FORMAT_PATTERN = re.compile('{{([^(}})]*)}}')
class Formatter(object):
def __init__(self, template):
self.template = six.text_type(template)
self.refs = []
self.replacements = {}
for ref in FORMAT_PATTERN.findall(self.tem... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,599 | gazeti/aleph | refs/heads/master | /aleph/tests/test_role_model.py | import ldap
from flexmock import flexmock
from aleph.core import db
from aleph.model import Role
from aleph.tests.factories.models import RoleFactory
from aleph.core import get_config
from aleph.model.role import LDAPException
from aleph.tests.util import TestCase
class RoleModelTest(TestCase):
def setUp(self)... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,600 | gazeti/aleph | refs/heads/master | /aleph/tests/test_sessions_api.py | from aleph.tests.util import TestCase
from aleph.tests.factories.models import RoleFactory
class SessionsApiTestCase(TestCase):
def setUp(self):
super(SessionsApiTestCase, self).setUp()
self.role = RoleFactory.create()
def test_status_get_with_password_registration_enabled(self):
re... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,601 | gazeti/aleph | refs/heads/master | /aleph/views/datasets_api.py | import logging
from collections import defaultdict
from werkzeug.exceptions import NotFound
from flask import Blueprint, request
from apikit import jsonify
from dalet import COUNTRY_NAMES
from aleph.core import datasets, get_config
from aleph.search import QueryState, entities_query
from aleph.views.cache import enabl... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,602 | gazeti/aleph | refs/heads/master | /aleph/index/records.py | import six
import time
import logging
from elasticsearch.helpers import BulkIndexError
from aleph.core import es_index, db
from aleph.index.mapping import TYPE_RECORD
from aleph.model import DocumentRecord
from aleph.index.util import bulk_op, query_delete
from aleph.text import index_form
log = logging.getLogger(__n... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,603 | gazeti/aleph | refs/heads/master | /aleph/index/leads.py | from __future__ import absolute_import
import logging
from hashlib import sha1
from aleph.core import es, es_index
from aleph.index.mapping import TYPE_LEAD
from aleph.index.util import query_delete
log = logging.getLogger(__name__)
def delete_entity_leads(entity_id):
"""Delete all entity-related leads from th... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,604 | gazeti/aleph | refs/heads/master | /aleph/views/leads_api.py | from flask import Blueprint, request
from apikit import obj_or_404, jsonify, request_data
from werkzeug.exceptions import BadRequest
from aleph.model import Collection, EntityIdentity
from aleph.search import QueryState
from aleph.search.leads import leads_query
from aleph.logic import update_entity, update_lead
from ... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,605 | gazeti/aleph | refs/heads/master | /aleph/oauth.py | import jwt
import logging
from flask_oauthlib.client import OAuth
from flask import session
from aleph import signals
oauth = OAuth()
log = logging.getLogger(__name__)
def get_oauth_token():
if 'oauth' in session:
sig = session.get('oauth')
return (sig.get('access_token'), '')
def setup_provid... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,606 | gazeti/aleph | refs/heads/master | /aleph/datasets/__init__.py | import six
import logging
from aleph.authz import get_public_roles
from aleph.util import dict_list
from aleph.model import Role
from aleph.datasets.query import DBQuery, CSVQuery
log = logging.getLogger(__name__)
class Dataset(object):
"""A dataset describes one set of data to be loaded."""
def __init__(s... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,607 | gazeti/aleph | refs/heads/master | /aleph/search/links.py | from pprint import pprint # noqa
from aleph.index import TYPE_LINK
from aleph.search.util import execute_basic
from aleph.search.fragments import match_all, filter_query, authz_filter
from aleph.search.fragments import add_filter, aggregate
from aleph.search.facet import parse_facet_result
DEFAULT_FIELDS = ['roles',... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,608 | gazeti/aleph | refs/heads/master | /aleph/analyze/regex.py | import re
import logging
from dalet import parse_phone
from aleph.analyze.analyzer import Analyzer
from aleph.model import DocumentTag, DocumentTagCollector
log = logging.getLogger(__name__)
# URLs:
# https://gist.github.com/uogbuji/705383
# REGEX = ur'(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,609 | gazeti/aleph | refs/heads/master | /aleph/views/documents_api.py | import logging
from werkzeug.exceptions import BadRequest, NotFound
from flask import Blueprint, redirect, send_file, request
from apikit import jsonify, Pager, request_data
from aleph.core import archive, url_for, db
from aleph.model import Document, DocumentRecord, Entity, Reference
from aleph.logic import update_do... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,610 | gazeti/aleph | refs/heads/master | /aleph/search/__init__.py | import logging
from aleph.index.mapping import TYPE_DOCUMENT, TYPE_RECORD # noqa
from aleph.search.query import QueryState # noqa
from aleph.search.documents import documents_query, documents_iter # noqa
from aleph.search.documents import entity_documents # noqa
from aleph.search.entities import entities_query # ... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,611 | gazeti/aleph | refs/heads/master | /aleph/authz.py | from werkzeug.exceptions import Forbidden
from aleph.core import db, get_config
from aleph.model import Collection, Role, Permission
from aleph.util import ensure_list
def get_public_roles():
"""Roles which make a collection to be considered public."""
return [
Role.load_id(Role.SYSTEM_GUEST),
... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,612 | gazeti/aleph | refs/heads/master | /aleph/logic/datasets.py | import logging
from aleph.index import index_items
log = logging.getLogger(__name__)
PAGE = 1000
def load_rows(dataset, query, rows):
"""Load a single batch of QUEUE_PAGE rows from the given query."""
entities = {}
links = []
for row in rows:
entity_map = {}
for entity in query.entit... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,613 | gazeti/aleph | refs/heads/master | /aleph/model/document.py | import logging
from datetime import datetime, timedelta
from normality import ascii_text
from sqlalchemy import func
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.orm.attributes import flag_modified
from aleph.core import db
from aleph.model.metadata import Metadata
from aleph.model.validate import ... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,614 | gazeti/aleph | refs/heads/master | /aleph/index/collections.py | from aleph.index.util import query_delete
def delete_collection(collection_id):
"""Delete all documents from a particular collection."""
query_delete({'term': {'collection_id': collection_id}})
query_delete({'term': {'entity_collection_id': collection_id}})
| {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,615 | gazeti/aleph | refs/heads/master | /aleph/tests/test_view_util.py | from flask import Request
from aleph.views.util import extract_next_url
from aleph.tests.util import TestCase
class ViewUtilTest(TestCase):
def setUp(self):
super(ViewUtilTest, self).setUp()
def test_extract_next_url_blank(self):
req = Request.from_values('')
self.assertEqual('/', ... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,616 | gazeti/aleph | refs/heads/master | /aleph/views/ingest_api.py | import os
import json
from flask import Blueprint, request
from werkzeug import secure_filename
from werkzeug.exceptions import BadRequest
from apikit import obj_or_404, jsonify
from aleph.core import upload_folder
from aleph.events import log_event
from aleph.ingest import ingest_document
from aleph.model import Coll... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,617 | gazeti/aleph | refs/heads/master | /aleph/views/collections_api.py | from flask import Blueprint, request
from apikit import obj_or_404, jsonify, Pager, request_data
from normality import ascii_text
from dalet import COUNTRY_NAMES
from aleph.core import USER_QUEUE, USER_ROUTING_KEY, get_config, db
from aleph.model import Collection
from aleph.search import QueryState, lead_count
from a... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,618 | gazeti/aleph | refs/heads/master | /aleph/search/records.py | from elasticsearch.helpers import scan
from aleph.core import es, es_index
from aleph.index import TYPE_RECORD
from aleph.util import ensure_list
from aleph.search.fragments import text_query_string
from aleph.search.util import execute_basic
from aleph.search.fragments import match_all, filter_query
from aleph.model ... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,619 | gazeti/aleph | refs/heads/master | /aleph/ingest/manager.py | import os
import logging
from ingestors import Manager
from ingestors.util import decode_path
from aleph.core import db
from aleph.model import Document, Cache
from aleph.analyze import analyze_document
from aleph.ingest.result import DocumentResult
from aleph.util import checksum
log = logging.getLogger(__name__)
... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,620 | gazeti/aleph | refs/heads/master | /aleph/tests/test_export_api.py | from aleph.tests.util import TestCase
class ExportApiTestCase(TestCase):
def setUp(self):
super(ExportApiTestCase, self).setUp()
self.load_fixtures('docs.yaml')
def test_smoke_comes_out(self):
self.login(is_admin=True)
res = self.client.get('/api/1/query/export')
asse... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,621 | gazeti/aleph | refs/heads/master | /aleph/text.py | # coding: utf-8
import six
import logging
from normality import normalize, stringify, latinize_text, collapse_spaces
from normality import slugify # noqa
from normality.cleaning import decompose_nfkd, remove_control_chars
log = logging.getLogger(__name__)
INDEX_MAX_LEN = 1024 * 1024 * 100
def index_form(texts):
... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,622 | gazeti/aleph | refs/heads/master | /aleph/index/__init__.py | from aleph.index.admin import init_search, upgrade_search # noqa
from aleph.index.admin import delete_index, flush_index # noqa
from aleph.index.entities import index_entity, delete_entity # noqa
from aleph.index.documents import index_document, index_document_id # noqa
from aleph.index.documents import delete_docu... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,623 | gazeti/aleph | refs/heads/master | /aleph/logic/distance.py | from itertools import product
from Levenshtein import jaro_winkler
from pprint import pprint # noqa
SUPER_SCIENTIFIC_WEIGHTINGS = {
'names': 0.3,
'fp_distance': 0.3,
'fp_tokens': 0.2,
'countries': 0.1,
'dates': 0.1,
'addresses_distance': 0.1,
'addresses_tokens': 0.1,
'emails': 0.3,
... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,624 | gazeti/aleph | refs/heads/master | /aleph/schema/types.py | import re
import fingerprints
from normality import ascii_text, stringify, collapse_spaces
from dalet import is_partial_date, parse_date
from dalet import parse_phone, parse_country, parse_email
from aleph.util import ensure_list
class StringProperty(object):
index_invert = None
def __init__(self):
... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,625 | gazeti/aleph | refs/heads/master | /aleph/tests/test_base_api.py | from aleph.tests.util import TestCase
class BaseApiTestCase(TestCase):
def setUp(self):
super(BaseApiTestCase, self).setUp()
def test_index(self):
res = self.client.get('/')
assert res.status_code == 200, res
assert '<title>' in res.data, res.data
assert 'ng-view' in ... | {"/aleph/search/leads.py": ["/aleph/index/__init__.py"], "/aleph/views/search_api.py": ["/aleph/search/__init__.py"], "/aleph/views/entities_api.py": ["/aleph/search/__init__.py"], "/aleph/model/entity.py": ["/aleph/text.py", "/aleph/model/entity_identity.py"], "/aleph/datasets/mapper.py": ["/aleph/schema/__init__.py",... |
12,649 | yenlt6/learningpython | refs/heads/main | /Day18UnitTest2310/testing/test_todos.py | import requests
from unittest.mock import Mock, patch
from services import get_todos, get_uncompleted_todos
# 3
def test_request_response():
# 1
response = requests.get('http://jsonplaceholder.typicode.com/todos')
# response = get_todos()
# Confirm that the request-response cycle completed successfull... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,650 | yenlt6/learningpython | refs/heads/main | /Day16Exam2_TEMP/card_game/player.py | import card
class Player(card):
'''
Class đại diện cho mỗi người chơi
Người chơi chỉ cần lưu tên, và các lá bài người chơi có
'''
def __init__(self,name,card):
self.name=name
self.card=card # mỗi người chơi được 3 quân bài, có nghĩa là nó phải chứa kiểu list Card?
def _... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,651 | yenlt6/learningpython | refs/heads/main | /Day16Exam2_TEMP/card_game/deck copy.py | from card import Card
import random
class Deck:
def __init__(self):
self.list_card=self.build()
'''
Class đại diện cho bộ bài, bao gồm 36 lá
'''
# ('A', 2, 3, 4, 5, 6, 7, 8, 9) và suit ('G', 'H', 'J', 'K')
'''Tạo bộ bài: tạo 1 list, mỗi phần tử của list là 1 lá bài gồm 9*4=36 lá bài'''... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,652 | yenlt6/learningpython | refs/heads/main | /day_8_temp/homework8.py | #Bài 3: Regex - ApacheLog
import sys
import re
def readfile_regex_image(filename):
f = open(filename, encoding='utf-8-sig')
content = f.read()
data_find = re.findall("GET (.*\.jpg)", content, re.MULTILINE)
if(data_find):
domain = get_domain(filename)
#loại bỏ image trùng
data =... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,653 | yenlt6/learningpython | refs/heads/main | /Day20FileHandling0611/file_handling/file_handling/writeCV.py | from docx import Document
def xin_tang_luong(ho_ten, luong_hien_tai):
doc = Document()
doc.add_heading('Don xin tang luong', level=0)
doc.add_paragraph(f'Xin chao chi quan ly, em ten la {ho_ten}, em muon tang luong, vi luong hien tai {luong_hien_tai} nhu nay la qua thap')
doc.save('don_xin_tang_luong.do... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,654 | yenlt6/learningpython | refs/heads/main | /Date16Exam2Date1610/game.py | import deck as dec
import player as pla
import card as ca
class Game:
'''
Class chứa các chức năng chính của game
Game chứa danh sách người chơi, và bộ bài
'''
def __init__(self,lisNguoi=[]):
self.lisNguoi=lisNguoi
self.boBai= dec.Deck()
def setup(self):
print("chào mư... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,655 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/vingroup/vinmec.py | def time_city():
print('[vinmec] time_city()')
class VinMec:
pass | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,656 | yenlt6/learningpython | refs/heads/main | /Day102509/bank_account_property.py | class BankAccount:
def __init__(self, account_number, account_name, balance=0):
self._account_number = account_number
self._account_name = account_name
self.balance = balance # gọi @balance.setter
@property
def account_number(self):
return self._account_numb... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,657 | yenlt6/learningpython | refs/heads/main | /Date16Exam2Date1610/player.py | import card as ca
class Player:
'''
Class đại diện cho mỗi người chơi
Người chơi chỉ cần lưu tên, và các lá bài người chơi có
'''
def __init__(self,name): # dễ
self.name=name
self.listBai=[]
@property
def point(self): # trung bình
sum=self.listBai[0].rank+self.l... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,658 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/exception/app.py | from random import randint
class Error(Exception):
"""Base Class"""
pass
class ValueOutOfRangeError(Error):
"""Lỗi khi số đoán đoán nằm ngoài phạm vi"""
pass
class SmallValueError(Error):
"""Lỗi số đoán nhỏ hơn kết quả"""
pass
class LargeValueError(Error):
"""Lỗi số đoán lớn hơn kết ... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,659 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/card_game/db.py | from pymysql import connect, cursors, Error
import sys
# Tạo CSDL vs file game_log.sql, khởi chạy CSDL trước
config = {
'host': 'localhost',
'user': 'root',
'password': '123456',
'database': 'game_log',
'cursorclass': cursors.DictCursor
}
try:
cnx = connect(**config)
cur = cnx.cursor()
exc... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,660 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/vingroup/payments/__init__.py | print(f'Gọi __init__.py cho {__name__}')
A = ['quux', 'corge', 'grault'] | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,661 | yenlt6/learningpython | refs/heads/main | /Day6Date1409/wordcount.py | #!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Quang Le - Techmaster.vn - 09/2021
########
"""Wordcount exercise
Hàm main() đã được định nghĩa hoàn chỉnh ở dưới. Bạn phải viết hàm print_words()
và print_top() mà sẽ đượ... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,662 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/oop/solutions/bank_account_advance.py | from datetime import datetime
class Customer:
def __init__(self, name, dob, email, phone):
self.name = name
self.dob = datetime.strptime(dob, "%d/%m/%Y").date()
self.email = email
self.phone = phone
def get_info(self):
print("Customer name:", self.name)
print("... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,663 | yenlt6/learningpython | refs/heads/main | /Day18UnitTest2310/testing/tests/test_real_server.py | from unittest import skipIf
# Local imports...
from constants import SKIP_TAGS
from services import get_users
@skipIf('real' in SKIP_TAGS, 'Skipping tests that hit the real API server.')
def test_request_response():
response = get_users()
assert 'Content-Type' in response.headers.keys()
assert response.h... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,664 | yenlt6/learningpython | refs/heads/main | /Day16Exam2_TEMP/card_game/deck.py | from Day16Exam2Date1510.card_game.card import Card
class Deck(Card):
'''
Class đại diện cho bộ bài, bao gồm 36 lá
'''
def build(self):
'''Tạo bộ bài: tạo 1 list, mỗi phần tử của list là 1 lá bài gồm 9*4=36 lá bài'''
pass
def shuffle_card(self):
'''Trộn bài, random(list)''... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,665 | yenlt6/learningpython | refs/heads/main | /Day6Date1409/hello.py | print("yenle") | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,666 | yenlt6/learningpython | refs/heads/main | /python4testers_student/testing/constants.py | import os
BASE_URL = 'http://jsonplaceholder.typicode.com'
SKIP_REAL = os.getenv('SKIP_REAL', False) # default là không skip
SKIP_TAGS = os.getenv('SKIP_TAGS', '').split() | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,667 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/card_game/player.py | class Player:
count = 1
auto = 1
def __init__(self, name):
if not name:
name = f'Nghiện nhưng còn ngại {Player.auto} 🦊'
Player.auto += 1
self._id = Player.count
self._name = name
self._cards = []
Player.count += 1
@property
def id(... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,668 | yenlt6/learningpython | refs/heads/main | /Day13Exception0510/factorial.py | class Error(Exception):
"""Base class cho các exception trong module"""
pass
class NotIntegerError(Error):
"""Ném ra khi giá trị đầu vào không phải integer"""
def __init__(self, value):
message = f"Không phải số nguyên: {value}"
self.value = value
self.message = message
class ... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,669 | yenlt6/learningpython | refs/heads/main | /Day20FileHandling0611/file_handling/file_handling/app.py | from docx import Document #thao tác mở nó lên ( nó: wordoffice ?)
from docx.shared import Cm
doc = Document()#=new: tạo mới documnet
# doc = docx.document.Document
# doc.add_picture('avatar.jpg', width=Cm(4))
doc.add_paragraph("Ba Nguyễn")
doc.add_paragraph("Mô tả bản thân...")
doc.add_paragraph("Thông tin liên hệ..."... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,670 | yenlt6/learningpython | refs/heads/main | /Date16Exam2Date1610/card.py | class Card:
'''
Class đại diện cho mỗi lá bài
Mỗi lá bài bao gồm rank ('A', 2, 3, 4, 5, 6, 7, 8, 9) và suit ('♠', '♣', '♦', '♥')
'''
def __init__(self,rank,suit):
self.setRank=rank
self.suit=suit
self.setsuitNumber=suit
self.setRankA=rank
@property
def getR... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,671 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/card_game/game.py | import os
import sys
import db
import error
from deck import Deck
from player import Player
class Game:
min_players = 2
max_players = 12
cards_per_player = 3
def __init__(self):
self.is_playing = False
self.is_dealt = False
self.is_flipped = False
self._deck = Deck()
... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,672 | yenlt6/learningpython | refs/heads/main | /Day16Exam2_TEMP/card_game/main.py | import card as c
import game as g
import deck as d
import player as p
def main():
list_player=[] # khó
'''Khởi tạo trò chơi, hiển thị menu và thực thi các chức năng tương ứng'''
print("Wellcome!!!\n chào mừng đến với game đánh bài 3 cây ( vui thôi nha)")
print(" Có bao nhiêu người muốn chơi:")
... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,673 | yenlt6/learningpython | refs/heads/main | /Day1Date2808/main.py | print("helo world")
print(4.5//3)
print(True + True) | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,674 | yenlt6/learningpython | refs/heads/main | /Day16Exam2_TEMP/card_game/db.py | '''Kết nối CSDL'''
# Kết nối đến MySQL
# from pymysql import connect, cursors
# config = {
# 'host': 'remotemysql.com',
# 'user': 'UyMDXcxEoz',
# 'password': 'lFJmWnNbEC',
# 'database': 'UyMDXcxEoz'
# }
# conn = connect(**config)
# conn.close()
# import the time module
import time
from datetime import d... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,675 | yenlt6/learningpython | refs/heads/main | /python4testers_student/testing/wallet/test_wallet.py | # test_wallet.py
import pytest
from wallet import Wallet, InsufficientAmount
@pytest.mark.ini
def test_default_initial_amount():
wallet = Wallet()
assert wallet.balance == 0
@pytest.mark.ini
def test_setting_initial_amount():
wallet = Wallet(100)
assert wallet.balance == 100
def test_wallet_add_cash... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,676 | yenlt6/learningpython | refs/heads/main | /Day18UnitTest2310/testing/tests/test_todos_extra.py | from unittest.mock import Mock, patch
from services import get_todos, get_uncompleted_todos
# 11
from unittest import skipIf
from constants import SKIP_REAL
class TestTodosExtra(object):
@classmethod
def setup_class(cls):
cls.mock_get_patcher = patch('services.requests.get')
cls.mock_get = cl... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,677 | yenlt6/learningpython | refs/heads/main | /Day16Exam2_TEMP/card_game/card.py | class Card:
'''
Class đại diện cho mỗi lá bài
Mỗi lá bài bao gồm rank ('A', 2, 3, 4, 5, 6, 7, 8, 9) và suit ('♠', '♣', '♦', '♥')
Mỗi lá bài bao gồm rank ('A', 2, 3, 4, 5, 6, 7, 8, 9) và suit ('G', 'H', 'J', 'K')
'''
def __init__(self,rank,suit):
self.rank=rank
self.suit=suit
... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,678 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/card_game/error.py | class Error(Exception):
'''Base class cho game error'''
pass
class MaximumPlayerError(Error):
'''Số lượng người chơi vượt quá mức quy định'''
message = 'Số lượng người chơi quá đông và nguy hiểm rồi :)\n'
def __init__(self, message=message):
self.message = message
class MinimumPlayerEr... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,679 | yenlt6/learningpython | refs/heads/main | /Date16Exam2Date1610/deck.py | import card as ca
import random
class Deck:
'''
Class đại diện cho bộ bài, bao gồm 36 lá
'''
def __init__(self):
self.liscard=self.build()
def build(self):
listRank=["A",2,3,4,5,6,7,8,9]
listSuit={'♠','♣','♦','♥'}
listCard=[]
for i in range (0, len(listRank)):... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,680 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/vingroup/payments/vinid.py | def id():
print("[vinid] id()")
from .. import products
print(products)
from ..products.vinfast import lux_sa
lux_sa() | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,681 | yenlt6/learningpython | refs/heads/main | /Day7Date1609/babynames_mshanh_thamkhao.py | #!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Python for Tester - OneMount Class
# Quang Le - quangdle@gmail.com - 09/2021
import sys
import re
import io
"""Baby Names exercise
Định nghĩa hàm extract_names() dưới đây và... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,682 | yenlt6/learningpython | refs/heads/main | /Day8Test1809/hackathon1_midterm/babynames.py | import sys
import re
import io
def extract_names(filename):
f = open(filename, encoding='utf-8-sig')
content = f.read()
year=re.findall("Popularity in \d+",content)
year=year[0]
year=year[14:]
name=re.findall('tr align="right"><td>(\d+)<\/td><td>(\w+)<\/td><td>(\w+)<',content)
rank_1=[... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,683 | yenlt6/learningpython | refs/heads/main | /Day6Date1409/thamkhao_mis_hanh.py | #Bài 1: Đảo ngược chuỗi trong python
def convert_string(s):
list_str= s.split(" ")
list_str.reverse()
str = " ".join(list_str)
new_str = ''
for i in str:
if i.isupper(): new_str += i.lower()
elif i.islower(): new_str += i.upper()
else: new_str += i
return new_str
s = "tH... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,684 | yenlt6/learningpython | refs/heads/main | /Day17_API_1910/main.py | import sys
from typing import Optional
from fastapi import FastAPI
from pydantic import BaseModel
from pymysql import connect, cursors, Error
class Todo(BaseModel):
id: Optional[int] = None
title: str
completed: Optional[bool] = False
config = {
"host": "10.124.60.67",
"user": "root",
"pass... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,685 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/oop/solutions/fraction.py | def hcf(x, y):
x, y = abs(x), abs(y)
hcf = x if x < y else y
while hcf > 0:
if x % hcf == 0 and y % hcf == 0:
break
hcf -= 1
return hcf if hcf > 0 else None
class Fraction:
def __init__(self, nr, dr=1):
if dr == 0:
raise ZeroDivisionError("Mẫu số ... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,686 | yenlt6/learningpython | refs/heads/main | /python4testers_student/testing/wallet/conftest.py | import pytest
from wallet import Wallet, InsufficientAmount
@pytest.fixture
def wallet100():
return Wallet(100) | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,687 | yenlt6/learningpython | refs/heads/main | /python4testers_student/code_along/oop/solutions/bank_account_data_hidding.py | class BankAccount:
def __init__(self, account_number, account_name, balance=0):
self._account_number = account_number
self._account_name = account_name
# Gọi set_balance để validate
# thay vì self._balance = balance
self.set_balance(balance)
def get_account_number(self)... | {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
12,688 | yenlt6/learningpython | refs/heads/main | /python4testers_student/testing/wallet/test_newwallet.py | import pytest
def test_assertFalse(wallet100):
print(wallet100)
assert wallet100.balance == 100
def assertTrue():
assert 1 == True
def testAssertTrue():
assert 2 < 3
| {"/python4testers_student/code_along/vingroup/payments/vinid.py": ["/python4testers_student/code_along/vingroup/products/vinfast.py"]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.