id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
8185921 | <filename>pyqldb/cursor/stream_cursor.py
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://www.apache.org/licenses... | StarcoderdataPython |
1878358 | <reponame>bechtoldt/domainapi
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: ts=4 sw=4 et
from xml.etree import ElementTree as ET
#import pprint
import re
class Helper:
"""
Helper class providing useful methods
"""
@staticmethod
def convert_json2xml(doc, root):
children = ET.Element(ro... | StarcoderdataPython |
1861861 | import os
from bs4 import BeautifulSoup
import socket
import sys
import requests
import re
docIdList=[]
urlList=[]
graph={'':[]}
def generateDocIds():
with open("task1E_URLs.txt","r") as f:
for line in f:
urlList.append(line.replace('\n',''))
lineAr... | StarcoderdataPython |
12848628 | <filename>plugins/pattern_navigate.py
import sublime
import sublime_plugin
# Related Reading:
# https://forum.sublimetext.com/t/find-for-a-macro/57387/
#
# This example command allows you to jump the cursor to the next or previous
# location of a given pattern of text, which can be either a regex or not and
# case... | StarcoderdataPython |
6548281 | # (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from datadog_checks.scylla import ScyllaCheck
from .common import INSTANCE_DEFAULT_METRICS
@pytest.mark.e2e
def test_check_ok(dd_agent_check):
aggregator = dd_agent_check(rate=True)
... | StarcoderdataPython |
329981 | <reponame>xiaqi516/video-content-description-VCD
"""
VCD (Video Content Description) library v4.3.1
Project website: http://vcd.vicomtech.org
Copyright (C) 2021, Vicomtech (http://www.vicomtech.es/),
(Spain) all rights reserved.
VCD is a Python library to create and manage VCD content version 4.3.1.
VCD is distribut... | StarcoderdataPython |
1703129 | # emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ##... | StarcoderdataPython |
332472 | import numpy as np
from numpy import einsum
class Linear:
"""Class for generic linear transformation of the Wigner distribution"""
def __init__(self, matrix, name):
"""Initialize the element
Args:
matrix : numpy array
The matrix that represents this ge... | StarcoderdataPython |
12825830 | <reponame>MicroMedIAn/MicroMind
#!/usr/bin/env python
"""Provides Generic Classes to make an image analysis.
"""
from abc import ABC, abstractmethod
import pandas as pd
class InputData(ABC):
def __init__(self, data):
self._content = data
@abstractmethod
def read(self):
pass
class Coho... | StarcoderdataPython |
3505567 | <filename>lsh/build_table.py<gh_stars>0
#!/usr/bin/env python3
from __future__ import print_function
import argparse
import io
import random
import pickle
import sys
import os
import lsh
def main():
parser = argparse.ArgumentParser(
description="Generates a locality sensitive hashing table "
... | StarcoderdataPython |
89061 | <reponame>nahumj/CSE-431<gh_stars>0
import collections
import pprint
import copy
class Node:
def __init__(self, id_, data=None):
self.id_ = id_
self.data = data
def __eq__(self, other):
if isinstance(other, Node):
return self.id_ == other.id_
return False
... | StarcoderdataPython |
9709850 | <filename>mtml/toy/_echo_args.py<gh_stars>1-10
__doc__ = "Provides the ``echo_args`` function used in ``mtml.toy`` unit tests."
def echo_args(*args, **kwargs):
"""Returns a dict containng all positional and keyword arguments.
The dict has keys ``"args"`` and ``"kwargs"``, corresponding to positional
a... | StarcoderdataPython |
9690764 | import spacy
spacy.load('pt_core_news_sm')
from pyate import combo_basic, term_extractor, cvalues
# source: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1994795/
string = """Central to the development of cancer are genetic changes that endow these “cancer cells” with many of the
hallmarks of cancer, such as self-suff... | StarcoderdataPython |
117872 | #!/usr/bin/env python
import sys, os
import argparse
import numpy as np
#import atomsinmolecule as mol
import topology as topo
import math
import pandas as pd
class topologyDiff(object):
def __init__(self, molecule1, molecule2, covRadFactor=1.3):
errors = {}
requirements_for_comparison(molecule1, ... | StarcoderdataPython |
1808060 | <filename>wlauto/tests/test_agenda.py<gh_stars>1-10
# Copyright 2013-2015 ARM Limited
#
# 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
#
#... | StarcoderdataPython |
3500088 | <reponame>czbiohub/opencell-portal-pub
"""rename abundance table and columns
Revision ID: <KEY>
Revises: 14dc4c67ea56
Create Date: 2021-09-27 17:27:21.463837
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_... | StarcoderdataPython |
3492176 | from os import path
from pathlib import Path
from shutil import rmtree
from typing import Union
from pyspark.sql import DataFrame
from pyspark.sql import SparkSession
from pyspark.sql.types import DataType
from pyspark.sql.types import StructType
from spark_fhir_schemas.r4.resources.patient import PatientSchema
from t... | StarcoderdataPython |
1792271 | <filename>UserInfo.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Userinfo.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
import pymysql
from PyQt5.QtWidgets import QMessageBox
cla... | StarcoderdataPython |
3500200 | import math
class Reward:
def __init__(self, verbose=False):
self.first_racingpoint_index = None
self.verbose = verbose
def reward_function(self, params):
# Import package (needed for heading)
import math
################## HELPER FUNCTIONS ###################
... | StarcoderdataPython |
3406334 | import os
from dateutil.tz import gettz
from celery.schedules import crontab
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = '<PASSWORD>-<PASSWORD>-<PASSWORD>-to-be-<P... | StarcoderdataPython |
9658924 | import yaml
import math
import ray
import wandb
import itertools
import matplotlib.pyplot as plt
from collections import defaultdict
from utils.visualization import visualize_semantic_processed
class Logger:
def __init__(self, wandb_project, args):
# Read configs
with open(args.config_path... | StarcoderdataPython |
6792 | <reponame>hhdMrLion/mxshop-api<filename>apps/users/adminx.py
import xadmin
from users.models import VerifyCode
from xadmin import views
class BaseSetting(object):
# 添加主题功能
enable_themes = True
user_bootswatch = True
class GlobalSettings(object):
# 全局配置,后端管理标题和页脚
site_title = '天天生鲜后台... | StarcoderdataPython |
1730202 | import numpy as np
import scipy.sparse.linalg
import scipy.sparse as sparse
from time import time as tm
from einsum_tools import *
# a class to store the operators with the bottom and left indices,
# and bottom and right indices moved to the right for contraction
# while sparse
class SparseOperator():
... | StarcoderdataPython |
1808006 | <filename>cleverhans/utils.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from distutils.version import LooseVersion
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activat... | StarcoderdataPython |
1794183 | """
webpack is a module bundler for modern JavaScript applications.
Options:
* mode : str, None
: Enable production optimizations or development hints.
: values: development, production, none
: If not set it'd be inferred from environment variables.
* config_file : ... | StarcoderdataPython |
11252824 | #!/bin/python3
import sys
def cutTheSticks(arr):
out = []
while arr:
out.append(len(arr))
arr_min = min(arr)
arr = list(map(lambda x: x - arr_min, arr))
arr = list(filter(lambda x: x > 0, arr))
return out
if __name__ == "__main__":
n = int(input(... | StarcoderdataPython |
4931198 | import requests
def test_get_entries():
r = requests.get('https://deco3801.wisebaldone.com/api/entry')
assert r.status_code == 200
data = r.json()
assert 'signed_in' in data
assert 'signed_out' in data
assert 'entries' in data
def test_get_entry_query():
send = {'id': 0, 'lower': '1/1/2018', 'upper': '... | StarcoderdataPython |
5142695 | import sys
import os
import tempfile
import logging
from distributed.cli import dask_scheduler, dask_worker
def help_info():
print('Available commands:')
print('remote.worker, remote.scheduler')
if __name__ == '__main__':
if len(sys.argv) <= 1:
print('No command\n')
help_info()
... | StarcoderdataPython |
3462262 | # coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from openapi_server.models.base_model_ import Model
from openapi_server import util
class TestArtifact(Model):
"""NOTE: This class is auto generated by OpenAPI Ge... | StarcoderdataPython |
6527179 | <gh_stars>0
# Deploy Script
# ---------------------------------
# ./run.sh kaiser/deployAPI.py --from 70x_wppdev1.fed --to HINT2_API --deploy
# ./run.sh kaiser/deployAPI.py --from HINT1_API --to HINT2_API --save --deploy
# Imports
from __future__ import with_statement
import ConfigParser, getpass, os, sys
from com.vo... | StarcoderdataPython |
1666761 | from datetime import datetime
from multiprocessing import Queue
from threading import Semaphore, Thread, Lock
from undine.utils.system import System
from undine.utils import logging
from time import sleep
import subprocess
class TaskThread:
def __init__(self):
self._state = None
self._result = 'E... | StarcoderdataPython |
3982 | #MenuTitle: Copy Layer to Layer
# -*- coding: utf-8 -*-
__doc__="""
Copies one master to another master in selected glyphs.
"""
import GlyphsApp
import vanilla
import math
def getComponentScaleX_scaleY_rotation( self ):
a = self.transform[0]
b = self.transform[1]
c = self.transform[2]
d = self.transform[3]
... | StarcoderdataPython |
12817292 | import numpy
import math
_EPS = numpy.finfo(float).eps * 4.0
# Downloaded on 6 August, 2013 from
# http://www.lfd.uci.edu/~gohlke/code/transformations.py
#
# Author: <NAME>
# License: BSD
def quaternion_matrix(quaternion):
"""Return homogeneous rotation matrix from quaternion.
>>> M = quaternion_matrix(... | StarcoderdataPython |
94583 | <filename>transforms/__init__.py<gh_stars>1-10
from .normalize import Normalize
from .transforms import Transforms
from .random_flips import RandomHorizontalFlip,RandomVerticalFlip
from .resize import Resize
from .color_shift import ColorShift | StarcoderdataPython |
1633178 | # Dedicated to the public domain under CC0: https://creativecommons.org/publicdomain/zero/1.0/.
'''
`craft-py-ext` is an experimental tool for generating the boilerplate to build simple CPython extensions.
It should be considered a work in progress.
To use it, you write a `.pyi` type declaration file, and then genera... | StarcoderdataPython |
11287962 | <filename>msl/qt/io.py
"""
I/O helper functions.
"""
import os
import sys
import fnmatch
from . import QtWidgets, QtGui, QtCore, application, prompt
__all__ = (
'get_drag_enter_paths',
'get_icon',
'icon_to_base64',
'rescale_icon'
)
def get_icon(obj, size=None, mode=QtCore.Qt.KeepAspectRatio):
""... | StarcoderdataPython |
3358974 | <gh_stars>0
from .centerline import centerline
import numpy as np
import vtk
from vtk.util import numpy_support
import matplotlib.pyplot as plt
class COGridGen():
def __init__(self, cl_geom, nx, ny, width, tension=10.0):
self.cl_geom = cl_geom
self.tension = tension
self.width =... | StarcoderdataPython |
3491027 | <reponame>ARQtty/parqser
from .base_session import BaseSession
from .empty_session import EmptySession
| StarcoderdataPython |
6446910 | <reponame>hpgl/hpgl<filename>src/geo_testing/test_scripts/psgs_test_regions.py
#
#
# Copyright 2009 HPGL Team
#
# This file is part of HPGL (High Perfomance Geostatistics Library).
#
# HPGL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as publis... | StarcoderdataPython |
1666057 | <filename>kerrokantasi/settings/util.py
import copy
import os
from importlib.util import find_spec
def load_local_settings(settings, module_name):
"""
Load local settings from `module_name`.
Search for a `local_settings` module, load its code and execute it in the
`settings` dict. All of the setting... | StarcoderdataPython |
85799 | from flask_marshmallow import Schema
from marshmallow import ValidationError
from .models import EnumUploadFileType
from .models import FileField
from app.models.enum_field import EnumField
def file_validate(file):
if file.mimetype not in ['image/jpeg', 'image/png']:
raise ValidationError('File format no... | StarcoderdataPython |
3337316 | <gh_stars>1-10
import nearest_n
import numpy as np
import pandas as pd
def test_NP_removal():
customer = pd.DataFrame(
data={'LoadEntering': [6200.0],
'Longitude': [17.0],
'Latitude': [47.0],
'NRemoval': [True],
'PRemoval': [True]})
df_NP = neare... | StarcoderdataPython |
8193773 | <reponame>towadroid/t3f<gh_stars>100-1000
import numpy as np
import tensorflow as tf
tf.compat.v1.enable_eager_execution()
from t3f import variables
from t3f import ops
from t3f import initializers
class _VariablesTest():
def testAttributes(self):
# Test that after converting an initializer into a variable al... | StarcoderdataPython |
9761680 | <reponame>abarnert/floatliteralhack
import ast
import importlib
import importlib.machinery
import decimal
import sys
def _call_with_frames_removed(f, *args, **kwargs):
return f(*args, **kwargs)
class FloatLiteral(float):
def __new__(cls, *args):
obj = super().__new__(cls, *args)
if args and le... | StarcoderdataPython |
3526574 | <gh_stars>1-10
import ruamel.yaml
import os
BASIC_DIRS=["tensorboard", "exps", "conf", "data", "decoded"]
def load_yaml_config(config_path):
with open(config_path, 'r') as f:
config = ruamel.yaml.safe_load(f)
check_validation(config)
return config
def check_validation(input):
assert os.path.is... | StarcoderdataPython |
1835061 | import sys
write = sys.stdout.write
def print_table(data, schema, titles = None):
'''Prints a list of dictionaries as a table
params: data: The list / tuple of dictionaries / lists / tuples (of dictionaries / lists / tuples ...)
schema: A list or a set that describes how to iterate in d
titles: Col... | StarcoderdataPython |
241595 | import os
import six
import pytest
import pdf_hunter
if six.PY2:
import mock
else:
from unittest import mock
TEST_URL = "https://github.com/EbookFoundation/free-programming-books/blob/master/free-programming-books.md" # noqa: E501
def test_url_transforms():
pdf_url = "https://github.com/.../blob/maste... | StarcoderdataPython |
1895712 | <filename>retic/services/general/json.py<gh_stars>1-10
# Json
from json import dumps, loads
# Retic
from retic.services.exceptions import get_file_error_exception
def jsonify(object: any):
"""Convert a object to a JSON string.
:param object: is the client response object, if the object is str,
it retur... | StarcoderdataPython |
4933118 | from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
import urllib.request
import time
from... | StarcoderdataPython |
1637456 | # data __init__.py
__author__ = ", ".join(["<NAME>"])
__email__ = ", ".join(["<EMAIL>",])
from ._data_tools._data_loader_utils import _create_data_cache as create_data_cache
# from .load_EMT_simulation import load_EMT_simulation
# from .load_LARRY import load_LARRY
# from .load_share_seq import load_share_seq
| StarcoderdataPython |
3323991 | <reponame>staghuntrpg/rpg
#!/usr/bin/env python
import copy
import glob
import os
import time
import numpy as np
from pathlib import Path
import torch
import torch.nn as nn
import torch.nn.functional as F
from tensorboardX import SummaryWriter
from envs import GridWorldAdaptiveEnv, MGAdaptiveEnv
from algorithm.ppo i... | StarcoderdataPython |
12806158 | #!/usr/bin/env python3
#
# astro_demo_common.py - <NAME> - 2019-07-26
#
# Utility functions shared by Python demo programs.
#
import sys
import re
import astronomy
def ParseArgs(args):
if len(args) not in [3, 4]:
print('USAGE: {} latitude longitude [yyyy-mm-ddThh:mm:ssZ]'.format(args[0]))
s... | StarcoderdataPython |
4945125 | #textos.py
import dao.mysql_connect as myc
class Textos(object):
id_narrativa =int
id_usuario = int
texto_narrativa = str
tempo_gasto = str
fase =str
def __init__(self):
id_narrativa =-1
id_usuario = -1
texto_narrativa = ""
tempo_gasto = ""
fase =""
... | StarcoderdataPython |
3294583 | <reponame>ErikMC10/PyBioMed<gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017, <NAME>, <NAME> and <NAME>
# All rights reserved.
# This file is part of the PyBioMed.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the PyBi... | StarcoderdataPython |
1974783 | <reponame>kul-forbes/nmpc-codegen<filename>tst/python/trailer/trailer_simple_controller.py
import sys
sys.path.insert(0, '../../../src_python')
import nmpccodegen as nmpc
import nmpccodegen.tools as tools
import nmpccodegen.models as models
import nmpccodegen.controller as controller
import nmpccodegen.Cfunctions as cf... | StarcoderdataPython |
8053328 | # Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import argparse
from mo.graph.graph import Graph
from mo.pipeline.common import get_ir_version
from mo.utils import class_registration
def unified_pipeline(argv: argparse.Namespace):
graph = Graph(cmd_params=argv, name=argv.model_... | StarcoderdataPython |
8043748 | <filename>sumatra/recordstore/serialization.py<gh_stars>100-1000
"""
Handles serialization/deserialization of record store contents to/from JSON.
:copyright: Copyright 2006-2015 by the Sumatra team, see doc/authors.txt
:license: BSD 2-clause, see LICENSE for details.
"""
from __future__ import unicode_literals
from b... | StarcoderdataPython |
4851370 | import copy
import random
from functools import wraps
import numpy as np
from deap.gp import PrimitiveTree, compile, cxOnePoint, mutUniform
from scipy.special import softmax
class MultipleGeneGP():
def __init__(self, content, gene_num):
self.gene = []
self.gene_num = gene_num
for i in ran... | StarcoderdataPython |
11331538 | <gh_stars>1-10
from compas_cloud import Proxy
import time
proxy = Proxy()
dot = proxy.function('numpy.dot')
a = [[1, 0], [0, 1]]
b = [['a']]
dot(a, b)
"""
This should raise an error:
Exception: ValueError:shapes (2,2) and (1,1) not aligned: 2 (dim 1) != 1 (dim 0)
"""
| StarcoderdataPython |
1601993 | """
Module containing classes, methods and functions related to queries to the ZAMG datahub.
"""
import pandas as pd
class ZAMGdatahubQuery:
"""
Attributes:
"""
def __init__(self,dataset,params,gridboxlabel,lat_min,lat_max,lon_min,lon_max,output="netcdf"):
dataset = dataset.uppe... | StarcoderdataPython |
5007780 |
from account.tests.factories import OrgaoFactory, ProfileFactory
from core.models import AssuntoAdministrativo
from core.tests.factories import AssuntoAdministrativoFactory
from django.contrib.auth.models import Group, Permission
from django.test import Client
assunto_adm = AssuntoAdministrativo.objects.all()
assunto... | StarcoderdataPython |
1779300 | <reponame>psh0502/packtpub-crawler
from logs import *
import requests
class Join(object):
"""
"""
def __init__(self, config, packpub_info, upload_info):
self.__config = config
self.__packpub_info = packpub_info
def send(self):
url = "https://joinjoaomgcd.appspot.com/_ah/api/me... | StarcoderdataPython |
6451600 | # Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | StarcoderdataPython |
6461608 | <reponame>ParkJonghyeon/tor_hs_archive_web
from django.db import models
class Date_info(models.Model):
date = models.CharField(max_length=10)
| StarcoderdataPython |
190714 | """
**Flask App Configuration Settings**
*Python Version 3.8 and above*
Used to setup environment variables for python flask app
"""
__developer__ = "mobius-crypt"
__email__ = "<EMAIL>"
__twitter__ = "@blueitserver"
__github_repo__ = "https://github.com/freelancing-solutions/memberships-and-affiliate-api"
_... | StarcoderdataPython |
12809790 | """
Test visuel d'un générateur et solveur de labyrinthe.
Author: Dalker
Date: 2021-04-10
"""
import logging as log
# import concurrent.futures as cf
import matplotlib.pyplot as plt
import generateur_ab as ab
# import solveur_astar_naif as astar
import solveur_astar_heapq as astar_v2
import solveur_astar_v3 as asta... | StarcoderdataPython |
12845412 | # coding: utf-8
import datetime
import random
from unittest.mock import Mock
from django.db import reset_queries
import pytest
from src.domain.exchange_rate import CurrencyEntity, CurrencyExchangeRateEntity
from src.usecases.exchange_rate import CurrencyInteractor, CurrencyExchangeRateInteractor
from tests.fixtures ... | StarcoderdataPython |
228508 | # Generated by Django 3.1.7 on 2021-02-22 19:13
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("modeemintternet", "0036_auto_20210222_2111"),
]
operations = [
migrations.AlterField(
model_name="... | StarcoderdataPython |
11251347 | # -*- coding: utf-8 -*-
# Copyright (c) 2021, TEAMPRO and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
# import datetime
# from frappe.utils import today
class OTApproval(Document):
def get_default_d... | StarcoderdataPython |
5026455 |
import pymysql
con = pymysql.connect(host = '192.168.93.128',user = 'biguser',password = '<PASSWORD>', db = 'userDB') #호스트번호(또는 연결번호)
cur = con.cursor() #연결 통로 생성(쿼리문을 날릴 통로=cursor)
try :
sql = "create table userTable2(userID char(10), userName char(5), userAge int);"
cur.... | StarcoderdataPython |
1807791 | """Clean Code in Python - Chapter 6: Descriptors
> A Pythonic Implementation
Tests for src/descriptors_pythonic_{1,2}.py
"""
import unittest
from descriptors_pythonic_1 import Traveler as TravelerNaiveImplementation
from descriptors_pythonic_2 import Traveler as TravelerWithDescriptor
class TestDescriptorTraceabil... | StarcoderdataPython |
9743395 | from Resources.default_resource import DefaultResource
from .asignatura_query import AsignaturaQuery
import Utils.messages_constants as mc
class Asignatura(DefaultResource):
def __init__(self):
self.query = AsignaturaQuery()
super().__init__()
def get(self):
try:
data = s... | StarcoderdataPython |
1844958 | db_connection = "postgresql:///tsintegration.db" | StarcoderdataPython |
1790953 | from Point_t import Point_t
class WPT(Point_t):
"""Classe définissant les waypoints"""
def __init__(self, coo_tulpe, description, id):
self._waypoint = description #description sous forme de string du waypoints : 'waypoint', 'node standard'...
self._id = id #identifiant numerique du way... | StarcoderdataPython |
3218434 | from manmandon.provider import MMDChapterListProvider, MMDChapterProvider
from pathlib import Path
import json
import click
class CopyMangaChapters(MMDChapterListProvider):
patterns = [
r"^https://(www.)?copymanga.com/comic/[a-z]+/?$"
]
def resolve(self, uri):
self.driver.get(uri)
... | StarcoderdataPython |
1750716 | <gh_stars>0
# Labeling tool for creating the hand tracking dataset for Dranimate
#
#
# Program reads images from a given directory and lets the user draw points on
# the image with their mouse. These selected (x,y) coordinates are then saved
# into a text file in a user specified output directory. The program stores al... | StarcoderdataPython |
9623971 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
# author:junyili
# datetime:20-1-16 下午6:12
import json
def get_queue(target, server):
return "{}_feed_queue_{}".format(target, server.replace(":", "__").replace(".", "_"))
def get_server(target, queue):
return queue.replace("{}_feed_queue_".format(target), "").repla... | StarcoderdataPython |
11246936 | <gh_stars>1-10
from lolacli import __version__
def test_version():
assert __version__=='0.2.4' | StarcoderdataPython |
3565986 | <reponame>gsq7474741/Quantum<gh_stars>1-10
# Copyright (c) 2021 Institute for Quantum Computing, Baidu Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:/... | StarcoderdataPython |
3404963 | <reponame>detrout/trackhub
from trackhub import upload
import os
import unittest
from trackhub import Hub, GenomesFile, Genome, Track, CompositeTrack, \
TrackDb, ViewTrack, SuperTrack, AggregateTrack
class TestUpload(object):
def setup(self):
self.hub = Hub(
hub='example_hub',
... | StarcoderdataPython |
3498085 | # encoding: utf-8
"""
circstat.py -- Circular statistics functions
Exported namespace: mean, std, var
Note: all functions take an array of radian-angle values on [0, 2*pi] as input.
Written by <NAME>, 4/17/2007
Center for Theoretical Neuroscience
Copyright (c) 2007 Columbia University. All rights reserved.
This so... | StarcoderdataPython |
11376428 | # !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2020/1/13 15:41
# @author : Mo
# @function:
import tensorflow as tf
def serving_input_receiver_fn():
serialized_tf_example = tf.placeholder(dtype=tf.string, shape=[None], name='input_tensors')
receiver_tensors = {"predictor_inputs": serialized_tf... | StarcoderdataPython |
11365897 | <filename>crawler/TwitterScrapy/items.py<gh_stars>1-10
# -*- coding: utf-8 -*-
from scrapy import Item, Field
class TwitterItem(Item):
ID = Field() # tweet id
url = Field() # tweet url
datetime = Field() # post time
text = Field() # text content
user_id = Field() # user id
... | StarcoderdataPython |
1815633 | <reponame>imall100/mrec
"""
Brute-force k-nearest neighbour recommenders
intended to provide evaluation baselines.
"""
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
from recommender import ItemSimilarityRecommender
class KNNRecommender(ItemSimilarityRecommender):
"""
Abstract base ... | StarcoderdataPython |
5065374 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://docs.python.org/3/library/secrets.html
from secrets import choice
import string
def generate_password(length=8) -> str:
# Generate a ten-character alphanumeric password with at least one lowercase char... | StarcoderdataPython |
1985801 | def is_palindrome(input_string):
new_string = ""
reverse_string = ""
input_string = input_string.lower()
for i in input_string:
if i != " ":
new_string = new_string + i
reverse_string = i + reverse_string
if new_string == reverse_string:
return True
retu... | StarcoderdataPython |
3384309 | #! /bin/env python
'''Rerun a collection's stored enrichments
'''
import sys
import argparse
from harvester.post_processing.couchdb_runner import CouchDBJobEnqueue
from harvester.collection_registry_client import Collection
import harvester.post_processing.enrich_existing_couch_doc
def main(args):
parser = argpar... | StarcoderdataPython |
1952581 | import CradlepointAPIClient
import unittest
import os
import json
username = os.environ.get('USERNAME')
password = <PASSWORD>('PASSWORD')
def run_full_test():
client = CradlepointAPIClient.Client(api_version='v2', verify=True)
print(f'***** Testing: Login '.ljust(60, '*'))
client.connect(x_cp_api_id='',... | StarcoderdataPython |
1667466 | <filename>app/blueprints/admin/organisation.py<gh_stars>0
from datetime import datetime
from flask import Blueprint, render_template, redirect, url_for, flash, abort, request
from flask_login import login_required, current_user
import commonmark
from app import db
from app.decorators import admin_required
from app.mode... | StarcoderdataPython |
1873773 | from social.backends.oauth import BaseOAuth2
class BattleNetOAuth2(BaseOAuth2):
""" battle.net Oauth2 backend"""
name = 'battlenet-oauth2'
ID_KEY = 'accountId'
REDIRECT_STATE = False
AUTHORIZATION_URL = 'https://eu.battle.net/oauth/authorize'
ACCESS_TOKEN_URL = 'https://eu.battle.net/oauth/tok... | StarcoderdataPython |
265416 | <filename>cf-security-group-update.py<gh_stars>1-10
import os
import boto3
from botocore.vendored import requests
def get_cloudflare_ip_list():
""" Call the CloudFlare API and return a list of IPs """
response = requests.get('https://api.cloudflare.com/client/v4/ips')
temp = response.json()
if 'result... | StarcoderdataPython |
4955554 | from __future__ import print_function
import io
import sys
import unittest
import collections
import yaml
from ..modules import cli
from ..modules import helpers
from ..modules import service
from ..modules.aux_services import Postgres, Redis
from ..modules.elastic_stack import ApmServer, Elasticsearch
from ..modules... | StarcoderdataPython |
8045238 | #!/usr/bin/env python
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Licens... | StarcoderdataPython |
48266 | <reponame>Fiware/ops.Maintenance-calendar
from flask import json
from maintenance_calendar.parser.json.json_parser import JSONParser
class JSONNodeCollectionParser(JSONParser):
def __init__(self):
super(JSONNodeCollectionParser, self).__init__() | StarcoderdataPython |
4850877 | <gh_stars>0
import sys
import os
print(sys.argv,os.path.join("","/"),os.path.join('','index.html'),os.path.join('','param'),os.path.join('','param/bar')) | StarcoderdataPython |
1910338 | # importing the necessory library
import numpy as np
import pandas as pd
# defining the function to read the box boundry
def dimension(file):
f = open(file,'r')
content = f.readlines()
# stroring the each vertext point on the data list
data = []
v_info = []
vertices_data =[]
# ... | StarcoderdataPython |
5007762 | <filename>data_utils/process_manifest.py
#!/usr/bin/env python
# coding=utf-8
""" Data pre-process """
import json
from collections import Counter
def get_path_trans(manifest_path="data/aishell/manifest.train" ):
'''Get path_to_wav and transcript list from data/manifest.{train,dev,test}
:param manifest_pat... | StarcoderdataPython |
3208936 | """Module to download METAR's and TAF's from Ogimet.com"""
import re
from calendar import monthrange
from datetime import datetime
from bs4 import BeautifulSoup
from requests import get
from .console import console
from .logger import logger
from .sanitize import sanitize_metar, sanitize_taf
TODAY = datetime.now()
... | StarcoderdataPython |
3300944 | <reponame>lubosz/universe
#!/usr/bin/python2
#coding: UTF-8
import sys, os, operator, subprocess
def shell(command):
output = ""
try:
output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True)
except subprocess.CalledProcessError:
#print(colors['red']+command + " has no output"+ col... | StarcoderdataPython |
6442756 | import datetime
from dateutil.relativedelta import relativedelta
import pytz
from pytz import timezone
import urllib2
from bs4 import BeautifulSoup
import numpy as np
from random import randint
# Makes a matrix with 1 in ij if ij in same group and 0 otherwise
def CnxtnMtrx(X,A):
# X is the connection matrix
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.