id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
4980848 | <filename>SRC/Chapter_13-Advanced-Iteration/01_read_csv.py
with open(
"/Users/arunab/myWork/myTutorials/myPython/HeadFirstPython/SRC/Chapter_13-Advanced-Iteration/buzzdata.csv"
) as raw_data:
print(raw_data.read())
| StarcoderdataPython |
6422079 | # -*- coding: utf-8 -*-
from typing import Union
from ink.sys.database.connector import BaseConnector
class NullConnector(BaseConnector):
def connect(self, connect_config: dict):
print('== NullConnector : connect ==')
def close(self):
print('== NullConnector : close ==')
def execute(s... | StarcoderdataPython |
277557 | from django.core.management.base import BaseCommand, CommandError
import time
from atlas.prodtask.hashtag import hashtag_request_to_tasks
class Command(BaseCommand):
args = '<request_id, request_id>'
help = 'Save hashtags from request to tasks'
def handle(self, *args, **options):
self.stdout.wri... | StarcoderdataPython |
9692746 | <reponame>sphuber/aiida-fleur
# -*- coding: utf-8 -*-
"""Tests for the `FleurinputgenCalculation` class."""
from __future__ import absolute_import
from __future__ import print_function
import os
import pytest
from aiida import orm
from aiida.common import datastructures
from aiida.engine import run_get_node
from aiida... | StarcoderdataPython |
6445056 | <filename>bareml/machinelearning/utils/misc.py
"""
Utility functions
Author: <NAME> <<EMAIL>>
References:
"""
import operator as op
from functools import reduce
import math
import numpy as np
def ncr(n, r):
"""
Calculates nCr in efficient manner.
This function is not my original code, but copied fro... | StarcoderdataPython |
6404639 | <gh_stars>0
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
from nltk.tokenize import PunktSentenceTokenizer
def tokenize_sentence(sentences):
sent_tokens = sent_tokenize(sentences)
return sent_tokens
def tokenize_words(text):
... | StarcoderdataPython |
1873917 | <filename>FEBDAQMULTx2/data_analysis/7_preamp_gain_analysis_and_charge_injection/injection_and_pedestal_peak_adc.py
#!/usr/bin/env python
'''
This script is the OOP version that finds the peak ADC position for a single channel.
The file names follow the convention such as:
"ch0.root" for charge injected to channel 0.
... | StarcoderdataPython |
6425080 | """
Initialise the two_qubit_simulator module.
Add import statements from auxiliary modules here.
"""
# testing soz | StarcoderdataPython |
6420074 | <reponame>project-origin/account-service<filename>src/origin/services/datahub/service.py
import json
import requests
import marshmallow
import marshmallow_dataclass as md
from origin.settings import (
PROJECT_URL,
DATAHUB_SERVICE_URL,
TOKEN_HEADER,
DEBUG,
WEBHOOK_SECRET,
)
from .models import (
... | StarcoderdataPython |
5129277 | # -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
# Copyright: Stateoftheart AI PBC 2021.
'''Alchemy's library wrapper.
Dataset information taken from: https://alchemy.cs.washington.edu/data/
'''
SOURCE_METADATA = {
'name': 'alchemy',
'original_name': 'Alchemy: Open Source AI',
'url': 'https://alchemy.cs... | StarcoderdataPython |
1859347 | <gh_stars>1-10
#link https://practice.geeksforgeeks.org/problems/common-elements1132/1#
class Solution:
def commonElements (self,A, B, C, n1, n2, n3):
# your code here
a=set(A)
b=set(B)
c=set(C)
lena=len(A)
lenb = len(B)
lenc = len(C)
lis=[]
f... | StarcoderdataPython |
9783058 | <reponame>OxfordHED/sunbear<filename>sunbear/math/__init__.py
"""
This module contains functions to calculate first and second derivatives of a
numpy.ndarray. The first derivatives are calculated with a central difference
scheme while the second derivatives are calculated using the central difference
as well.
The input... | StarcoderdataPython |
1620945 | <gh_stars>0
from pyglet import image
import os, sys
base = os.getcwd() + "/Assets/"
icon = image.load(base + 'icon.png')
mario_img = image.load(base + 'mario.png')
luigi_img = image.load(base + 'luigi.png')
| StarcoderdataPython |
3232943 | ###################################################################################
#
# Copyright (c) 2017-2019 MuK IT GmbH.
#
# This file is part of MuK Security
# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Gen... | StarcoderdataPython |
4919110 | <reponame>majeformation/JD-micro-services<filename>Chapter10/microservices/thoughts_backend/ThoughtsBackend/load_test_data.py
from thoughts_backend.app import create_app
from thoughts_backend.models import ThoughtModel
if __name__ == '__main__':
application = create_app(script=True)
application.app_context().... | StarcoderdataPython |
9741983 | import numpy as np
import pandas as pd
import indicators
import config
import util
import sys
from pathlib import Path
def get_algo_dataset(choose_set_num: int):
"""run_set = ['goldman', 'index', '^BVSP', '^TWII', '^IXIC', 'index_sampled']
Returns df_list, date_range, trend_list, stocks
"""
# Do not ch... | StarcoderdataPython |
8155247 | <gh_stars>1-10
"""
# SORT COLORS
Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue.
Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.
... | StarcoderdataPython |
12824328 | <gh_stars>1-10
r=6
pi=3.14
volume=(4*pi*6**3)/3
print("Volume of sphere=",volume)
| StarcoderdataPython |
1737255 | import unittest
import tempfile
import textwrap
import six
import conan.tools.qbs.qbstoolchain as qbs
from conans import tools
from conans.errors import ConanException
from conans.test.utils.mocks import MockConanfile, MockSettings, MockOptions
class RunnerMock(object):
class Expectation(object):
def _... | StarcoderdataPython |
5128027 | <reponame>jtauber/online-reader
from pysblgnt import morphgnt_rows
from . import ref
def rows_for_verse(verse):
book_num, chapter_num, verse_num = verse.tup
rows = []
for row in morphgnt_rows(book_num):
c = int(row["bcv"][2:4])
v = int(row["bcv"][4:6])
if (c, v) == (chapter_num... | StarcoderdataPython |
9786613 | x = input()
s = input()
print(s.replace(x, ''))
| StarcoderdataPython |
6665025 | import base64
import io
import mimetypes
from datetime import datetime
import pytz
from PIL import Image
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from django.conf import settings
from django.contrib.gis.geos import Point
from django.forms.models import model_to_dict
from django.shortcut... | StarcoderdataPython |
6656627 | <reponame>yakomaxa/micanpymol
import subprocess
import tempfile
import os
def mican(mobile, target, option=""):
#make temporary dir and do everything there
with tempfile.TemporaryDirectory() as dname:
# print tmp dir name
print("Temporary directory =" + dname)
# make sure you have mican i... | StarcoderdataPython |
6508147 | #!/usr/bin/python
from __future__ import print_function
import magic
import sys
import argparse
def detect_dicom(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument('filenames', nargs='*', help='Filenames to check')
args = parser.parse_args(argv)
dicom_files = []
for filename in ar... | StarcoderdataPython |
1920603 | <gh_stars>0
#!/usr/bin/env python
from __future__ import print_function
import six
from werkzeug.security import check_password_hash, generate_password_hash
if __name__ == '__main__':
password = six.moves.input("password: ")
password_hash = generate_password_hash(password)
password = six.moves.input("ve... | StarcoderdataPython |
1887221 | #!/usr/bin/env python
# #############################
# # GO stone camera detection #
# #############################
#
# Licensed under MIT License (MIT)
#
# Copyright (c) 2018 <NAME> | <EMAIL>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this soft... | StarcoderdataPython |
1600270 | import math
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
# from model.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d
from ..utils import build_norm_layer
'''
class IBN(nn.Module):
def __init__(self, planes):
super(IBN, self).__init__()
half1 = int(planes/2)
... | StarcoderdataPython |
4870900 | import os
import unittest
import pandas as pd
from set_up_grasp_models.set_up_models.manipulate_model import remove_spaces, reorder_reactions, rename_columns
class TestManipulateModel(unittest.TestCase):
def setUp(self):
this_dir, this_filename = os.path.split(__file__)
self.test_folder = os.pa... | StarcoderdataPython |
4872146 | for t in range(int(input())):
arr = list(map(int, input().split()))
n = len(arr)
maximum = -999999999999999999
newMax = maximum
maxsubsequence = 0
minimum = maximum
for i in range(n-1, -1, -1):
# print("Array: ",arr[i])
# print("SUm: ",arr[i]+maximum)
if ar... | StarcoderdataPython |
9604078 | <reponame>android-risc-v/external_webrtc
#!/usr/bin/env python
import json
import sys
# Set this to True to generate a default entry with all the flags and defines
# common to all the modules that needs to be curated by hand after it's
# generated. When set to False it prints the last curated version of the
# default... | StarcoderdataPython |
3564332 | # -*- encoding: utf-8 -*-
'''
-------------------------
@File : data_explore.ipynb
@Time : 2021/12/28 17:58:18
@Author : <NAME>
@Contact : <EMAIL>
@Desc : 此脚本用于将原始数据及导出的峰值坐标进行裁剪,输出json格式,用于后续打标训练用
-------------------------
'''
import json
import numpy as np
import matplotlib.pyplot as plt
import ra... | StarcoderdataPython |
3463166 | <filename>unified/models/vms.py
from sqlalchemy import PrimaryKeyConstraint
from . import db
class Instance(db.Model):
"""Monthly report of virtual machine instances produced by VRB vms report"""
server_id = db.Column(db.String(), nullable=False)
server = db.Column(db.String(), nullable=False)
core = ... | StarcoderdataPython |
4825001 | <filename>tests/integration/test_s3.py
import io
import os
import ssl
import boto3
import gzip
import json
import time
import uuid
import unittest
import datetime
import requests
from io import BytesIO
from pytz import timezone
from urllib.parse import parse_qs, quote
from botocore.exceptions import ClientError
from si... | StarcoderdataPython |
1827759 | <reponame>AlexanderBerx/NoiceUi
from setuptools import setup
setup(
name='NoiceUi',
version='0.1.0',
packages=['noiceui', 'bin'],
url='',
license='BSD 3',
author='<NAME>',
author_email='<EMAIL>',
description='noiceui, ui for Solidangles Arnold Noice tool',
requires=['qt.py']
)
| StarcoderdataPython |
277575 | import config
import gc
import json
import utime
import neopixel
from machine import Pin, I2C
from ina219 import INA219
from steppers import Stepper, Axis
from logging import ERROR
from letters import characters
from microWebSrv import MicroWebSrv
# lock
lock1 = False
# ina initialization
i2c = I2C(-1, Pin(config.de... | StarcoderdataPython |
6403980 | <gh_stars>0
from random import *
from words import wordlist
DEBUG = False
class HangMan(object):
def __init__(self, difficulty="easy", words = wordlist, game_id = 0):
self.number = game_id
self.word = words[randint(0,len(words) - 1)]
self.difficulty = difficulty
self.welcome_message = "[+] Welcome To HangMan... | StarcoderdataPython |
12804102 | <reponame>levilucio/SyVOLT<gh_stars>1-10
"""
__MapDistributable_MDL.py_____________________________________________________
Automatically generated AToM3 Model File (Do not modify directly)
Author: levi
Modified: Fri Aug 23 15:40:27 2013
______________________________________________________________________________
""... | StarcoderdataPython |
8018166 | # Author: <NAME> <<EMAIL>>
"""Command-line parsing library
This module is a argparse-inspired command-line parsing library that:
- customized man like help
- all parameters must be with -x or --xx format
- handles compression of short parameters. eg: -abcd -e
The following is a simple usage example tha... | StarcoderdataPython |
1697098 | from revibe.settings.base import *
ENV = 'TEST'
DEBUG = True
ALLOWED_HOSTS = [
'.elasticbeanstalk.com'
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': os.environ['RDS_DB_NAME'],
'USER': os.environ['RDS_USERNAME'],
'PASSWORD': os.environ['RDS_PASSWOR... | StarcoderdataPython |
335170 | <reponame>pombredanne/discipline
try:
from management.commands.discipline_migrate import Command
from south.signals import post_migrate
def command(app, *args, **kwargs):
print "Discipline detected a South migration, it will now save the new" \
" schema state automatically."
Co... | StarcoderdataPython |
6561282 | <reponame>lace/lacecore
from lacecore import shapes
import numpy as np
from vg.compat import v2 as vg
def test_vertex_centroid():
cube_at_origin = shapes.cube(np.zeros(3), 3.0)
np.testing.assert_array_almost_equal(
cube_at_origin.vertex_centroid, np.repeat(1.5, 3)
)
def test_bounding_box():
... | StarcoderdataPython |
47717 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2021-2022 CERN.
#
# Invenio-Vocabularies is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Base data stream."""
from .errors import ReaderError, TransformerError, WriterError
class Stream... | StarcoderdataPython |
3317552 | <gh_stars>0
from pathlib import Path
from logging import ERROR, INFO, DEBUG
# Paths
path_working_directory = Path(__file__).parent.parent
path_credentials_directory = path_working_directory / 'credentials'
path_credentials_directory.mkdir(parents=True, exist_ok=True)
path_data_directory = path_working_directory / 'd... | StarcoderdataPython |
72849 | <filename>grortir/externals/__init__.py<gh_stars>0
"""Package contains modified external modules."""
# pylint: skip-file
| StarcoderdataPython |
1895401 | # Author:
# <NAME> <<EMAIL>>
#
# License: BSD 3 clause
"""
cli
"""
from __future__ import print_function, division, absolute_import
import argparse
import splinart as spl
import numpy as np
def circle(img):
"""
circle
"""
def xs_func():
"""
xs function
"""
nsamples =... | StarcoderdataPython |
4987020 | # -*- coding: utf-8 -*-
__all__ = ["TimeSeriesKMeans", "TimeSeriesKMedoids"]
from sktime.clustering._k_means import TimeSeriesKMeans
from sktime.clustering._k_medoids import TimeSeriesKMedoids
| StarcoderdataPython |
8009716 | import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
from matplotlib.collections import PatchCollection
import numpy as np
num_of_paths=6
max_node_path=4
grid_size_y = complex(0, max_node_path)
grid_size_x = complex(0, num_of_paths)
x = 0
y = num_of_paths*0.2
grid = np.mgrid[x:y:grid_size_x, x:y:gri... | StarcoderdataPython |
3577545 | # !/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
from base import FileIO
from datagit.analyze.bp import GitHubAnalysisOrchestrator
from datagit.graph.svc import GraphSocialNetwork
from datagit.navigate.bp import GitHubNavigationAPI
def generate_output_path(issue_number_x, issue_number_y) -> str:
filena... | StarcoderdataPython |
3469286 | cont = -1
num = 0
num2 = 0
while num != 999:
num = int(input('Informe um numero inteiro ou [digite 999 para parar]:'))
cont+=1
#print('{} +'.format(num),end=' ')
if num != 999:
soma = num + num2
num2 = soma
print('A soma dos {} numeros digitados é {}'.format(cont,soma)) | StarcoderdataPython |
3492925 | <reponame>x06lan/mt
save={}
x=[int(i) for i in input().split()]
for i in range(x[0]):
tem=[int(i) for i in input().split()]
a=tem[0]
b=tem[1]
try:
save[a].append(b)
except:
save[a]=[]
save[a].append(b)
try:
save[b].append(a)
except:... | StarcoderdataPython |
8135018 | <reponame>mszhanyi/PyMultiprocessDemo
from multiprocessing import Process, Queue
def f(q):
q.put('hello world')
def run_mp():
q = Queue()
p = Process(target=f, args=[q])
p.start()
print (q.get())
p.join()
run_mp()
| StarcoderdataPython |
247729 | from random import random, randint
from sklearn.ensemble import RandomForestRegressor
import mlflow
import mlflow.sklearn
import os
os.environ['MLFLOW_S3_ENDPOINT_URL'] = "http://your.minio-or-s3.domain"
os.environ['AWS_ACCESS_KEY_ID'] = "yourAccessKeyOrMinioUser"
os.environ['AWS_SECRET_ACCESS_KEY'] = "yourSecretKeyOr... | StarcoderdataPython |
9682618 | import nltk, re
from sherlock_holmes import bohemia_ch1, bohemia_ch2, bohemia_ch3, boscombe_ch1, boscombe_ch2, boscombe_ch3
from preprocessing import preprocess_text
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.decomposition import LatentDirichletAllocation
# preparin... | StarcoderdataPython |
6460558 | <reponame>allenai/HyBayes
import logging
import pymc3 as pm
import theano.tensor as tt
from theano.compile.ops import as_op
import numpy as np
from scipy import stats
logger = logging.getLogger('root')
def add_exp_uniform_normal_t_model(hierarchical_model):
"""
A student-t model with normal, uniform, exp pri... | StarcoderdataPython |
1998371 | # --------------
# Importing header files
import numpy as np
import warnings
warnings.filterwarnings('ignore')
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Reading file
data = np.genfromtxt(path, delimiter=",", skip_header=1)
#Code starts here
census = np.concatenate((data,new_record),axi... | StarcoderdataPython |
1794265 | <filename>chap18-functions/functions_00.py
# This function takes no arguments
def make_noise() :
print("I am a noisy kid")
def feed_kid() :
print("Feed my favorite daughter Sonal.")
return "Sonal and Daddy are happy!!"
# This function takes one argument
def drive_kids() :
print("Get a van that can hol... | StarcoderdataPython |
1893091 | #coding: utf-8
from flask import Blueprint, request
from flask_restful import Resource, Api
from HTTPJsonRule.response import SaveResponse
API_VERSION_V1 = 1
API_VERSION = API_VERSION_V1
api_v1_bp = Blueprint('api_v1', __name__)
api_v1 = Api(api_v1_bp)
class HTTPSave(Resource):
def post(self):
... | StarcoderdataPython |
3329261 | <reponame>matchd-ch/matchd-backend
from django.contrib.auth.models import AnonymousUser
import pytest
from api.tests.helper.node_helper import assert_node_field, assert_node_id
@pytest.mark.django_db
def test_query(query_job_types, job_type_objects):
data, errors = query_job_types(AnonymousUser())
assert er... | StarcoderdataPython |
170568 | <gh_stars>0
# Copyright 2020 Netflix, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | StarcoderdataPython |
3425787 | # Copyright (C) 2010-2011 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distrib... | StarcoderdataPython |
99540 | <reponame>DoggiKong/deco3801-project
import random
import string
from django.db import models
from django.contrib.auth.models import AbstractUser, BaseUserManager
from django.core import validators
from django.utils.translation import gettext_lazy as _
from systemsdb.models import hrms_system, chromatography, analytica... | StarcoderdataPython |
6553611 | # Copyright 2020 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/LICENSE-2.0
#
# or in th... | StarcoderdataPython |
3582192 | """Define the Celery tasks."""
from celery import chain
from celery.schedules import crontab
from celery.utils.log import get_task_logger
from {{ cookiecutter.project_name }}.celery.celery import app
logger = get_task_logger(__name__)
@app.task
def add(x, y):
return x + y
| StarcoderdataPython |
8093846 | <gh_stars>1-10
"""Preprocess the Robot model
The model is available for download from
https://sketchfab.com/3d-models/uaeYu2fwakD1e1bWp5Cxu3XAqrt
The Python Imaging Library is required
pip install pillow
"""
from __future__ import print_function
import json
import os
import zipfile
from PIL import Image
f... | StarcoderdataPython |
4810090 | __author__ = 'Mario'
omega1 = [[-5.01, -8.12, -3.68],
[-5.43, -3.48, -3.54],
[1.08, -5.52, 1.66],
[0.86, -3.78, -4.11],
[-2.67, 0.63, 7.39],
[4.94, 3.29, 2.08],
[-2.51, 2.09, -2.59],
[-2.25, -2.13, -6.94],
[5.56, 2.86, -2.26],
[1... | StarcoderdataPython |
9632976 | import tensorflow as tf
from tensorflow.keras.layers import Dense
from tensorflow.keras import Model
class Actor(Model):
def __init__(self,
action_dim,
action_lb=None,
action_ub=None,
hidden_size=(400, 300),
name='Actor'):
... | StarcoderdataPython |
9684613 | #!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License");... | StarcoderdataPython |
4886593 | <filename>test_unidecode.py
from unidecode import unidecode
print(unidecode("\u5317\u4EB0"))
print(unidecode("\u0c13\u0c35\u0c46\u0c28\u0c4d\u200c\u0c28\u0c3f"))
print(unidecode("సంతోషంగా"))
print("\u0c13\u0c35\u0c46\u0c28\u0c4d\u200c\u0c28\u0c3f")
| StarcoderdataPython |
1708074 | import azure.mgmt.batchai as batchai
from azure.storage.file import FileService
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.resource import ResourceManagementClient
from datetime import datetime
import os
def setup_bai(
aad_client_id: str = None,
aad_secret: str = None,
... | StarcoderdataPython |
234476 | <gh_stars>0
from flask import Flask, render_template, flash, redirect, url_for
from app import app
from flask_cors import CORS, cross_origin
import random
# public API, allow all requests *
cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
from app.utils.general import sanitize_input, convert_array_to_return... | StarcoderdataPython |
8112385 | <reponame>RaghuSpaceRajan/bsuite-mdpp-merge
# python3
# pylint: disable=g-bad-file-header
# Copyright 2019 DeepMind Technologies Limited. 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... | StarcoderdataPython |
3321148 | # #####################################################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | StarcoderdataPython |
372199 | from django.conf.urls import include, url
from . import views
urlpatterns = [
url(r'^$', views.recipesView),
]
| StarcoderdataPython |
1614529 | <filename>tests/seq2seq_model_tests.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reservedimport unittest
import unittest
import torch
from pytext.common.constants import Stage
from pytext.data import Batcher
from pytext.data.data import Data
from pytext.data.sources.data_sour... | StarcoderdataPython |
3220550 | #!/usr/bin/env python
#
# Copyright 2009, Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | StarcoderdataPython |
1751271 | <reponame>taushifkhan/plv-DecoySearch<filename>cs_modules/pdbHearParser.py
#!/usr/bin/python
helpDoc = """
PDB header parser. get formatted information from a PDB
file of annotation related to a PDB Id.
"""
import urllib
import os
class pdbHeader():
def __init__(self,pdbHeader):
self.header={'HEADER':'','TITLE':''... | StarcoderdataPython |
1975843 | from splitrule import SplitRule
import numpy as np
import math
def get_labels(ys):
labels = {}
for y in ys:
if y in labels:
labels[y] += 1
else:
labels[y] = 1
return labels
def split(x_sorted, j):
return (x_sorted[: j + 1], x_sorted[j + 1 :])
def H(label_cou... | StarcoderdataPython |
3391597 | import sqlalchemy.types as types
import json
def _decode(o):
# Note the "unicode" part is only for python2
if isinstance(o, str):
try:
return int(o)
except ValueError:
return o
elif isinstance(o, dict):
return {k: _decode(v) for k, v in o.items()}
elif i... | StarcoderdataPython |
6605536 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Z:\wwalker\maya\python\gui\weight_tools\ui\main_window.ui'
#
# Created by: PyQt5 UI code generator 5.7.1
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore, QtGui, QtWidgets
class Ui_MainWind... | StarcoderdataPython |
1698694 | class Solution:
def addBoldTag(self, s: str, words: List[str]) -> str: tag = [False] * len(s)
tag = [False] * len(s)
for w in words:
i = s.find(w)
while i != -1:
for k in range(i, i + len(w)):
tag[k] = True
i = s.find... | StarcoderdataPython |
11393377 | import pygame
import time
from engine.keycodes import KeyCodes
app = None
# EXPORT
class Application(object):
def __init__(self, res=(640, 480), scale=1.0):
global app
app = self
self.res = res
self.screen = pygame.display.set_mode(res)
self.fps = 30
self.keys = []... | StarcoderdataPython |
12803732 | <reponame>roboDocs/RoboChrome
from base64 import b64encode
from xml.sax.saxutils import escape
from .command import moveto, lineto, quadto, curveto, closepath
from .misc import dump
from .text import placedtext, placedoutlines
import re
def parsepath(data):
tokens = re.compile(br'|'.join((
br'([+-]?(?:\... | StarcoderdataPython |
3352877 | from pyramid.view import view_config
from pyramid.renderers import render
from pyramid.response import Response
from pyramid.exceptions import NotFound
from pyramid.httpexceptions import HTTPBadRequest, HTTPNotFound
from datetime import datetime
import calendar
import pymongo
import logging
log = logging.getLogger(... | StarcoderdataPython |
1760809 | from setuptools import setup, find_packages
install_requires = [
'torch>=1.9.0',
'torchvision>=0.10.0',
'tqdm'
]
setup(
name='anatome',
version='0.0.3',
description='Ἀνατομή is a PyTorch library to analyze representation of neural networks',
author='<NAME>',
author_email='<EMAIL>',
... | StarcoderdataPython |
8063664 | #!/usr/bin/env python
from __future__ import print_function
"""
pytrace.py
"""
import cStringIO
import os
import struct
import sys
# TODO: Two kinds of tracing?
# - FullTracer -> Chrome trace?
# - ReservoirSamplingTracer() -- flame graph that is deterministic?
# TODO: Check this in but just go ahead and fix wild.sh ... | StarcoderdataPython |
5101165 | # Example, do not modify!
print(5 / 8)
# Print the sum of 7 and 10
print(7+10)
# Division
print(5 / 8)
# Addition
print(7 + 10)
# Addition, subtraction
print(5 + 5)
print(5 - 5)
# Multiplication, division, modulo, and exponentiation
print(3 * 5)
print(10 / 2)
print(18 % 7)
print(4 ** 2)
... | StarcoderdataPython |
33965 | <filename>DialogCalibrate.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'DialogCalibrate.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_DialogCalibrate(object):
def se... | StarcoderdataPython |
5019274 | <gh_stars>10-100
# coding: utf-8
""" DSFP core file
.. module:: dsfp.dsfp
:platform: Linux, Windows, MacOS X
:synopsis: utils for routines
.. moduleauthor:: Tarvitz<<EMAIL>>
"""
import six
from unittest import TestCase
from dsfp import DSSaveFileParser
import bz2
__all__ = ['TestDSFPReader', ]
class TestDS... | StarcoderdataPython |
3436401 | <reponame>vinit2107/Data-Analysis
import mysql.connector
from mysql.connector import errorcode, cursor, Error, connection
from configparser import RawConfigParser
from Scripts.DDL.ddl_scripts import *
from Scripts.DML.dml_scripts import *
class MySQLHandler:
def create_connection(self, config: RawConfigParser):
... | StarcoderdataPython |
261138 | <reponame>themlphdstudent/pySIM
"""
author: <NAME>
email: <EMAIL>
Licence: BSD 2 clause
Description: Example of using Euclidean distance measure.
"""
import numpy as np
import os
import sys
# temporary solution for relative imports in case pyod is not installed
# if pysim is installed, no need to use ... | StarcoderdataPython |
5067441 | <filename>While Conditions/asterisk_condition.py
"""
Code to make the asterisk on the left side
according to the number of lines the user wants.
"""
#Declaring Variables
x = 1
#Asking for number of lines
lines = int(input("What is the number of lines you want: "))
#Initiating loop
while x <= lines:
print('*... | StarcoderdataPython |
362417 | from setuptools import setup, find_packages
from gitdl import __version__
setup(
name='gitdl',
version=__version__,
description='Download git repositories locally',
long_description="",
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=find_packages(),
install_require... | StarcoderdataPython |
5102514 | import argparse
import json
import subprocess
import tempfile
from glob import glob
from pathlib import Path
from typing import List, Union
from urllib import request
import platform
import os
project_root = Path(__file__).absolute().parent
def run_subprocess(command):
status, output = subprocess.getstatusoutput... | StarcoderdataPython |
4917583 | def compChooseWord(hand, wordList, n):
"""
Given a hand and a wordList, find the word that gives
the maximum value score, and return it.
This word should be calculated by considering all the words
in the wordList.
If no words in the wordList can be made from the hand, return None.
hand: dict... | StarcoderdataPython |
11215994 | """
artifact_downloader.py: Fetch artifacts into a location, where a Maven repository is being built given
a list of artifacts and a remote repository URL.
"""
import logging
import os
import re
import urlparse
from multiprocessing import Queue
from multiprocessing import Lock
from multiprocessing.pool import ThreadPo... | StarcoderdataPython |
5170195 | import time
import xml.etree.ElementTree as ET
def handleMessage(oriData):
xmldata = ET.fromstring(oriData)
fromUserName = xmldata.find("FromUserName").text
toUserName = xmldata.find("ToUserName").text
content = xmldata.find("Content").text
xmlDict = {"FromUserName": fromUserName,"ToUserName": toUs... | StarcoderdataPython |
4874931 | <gh_stars>1-10
from selenosis.settings import * # noqa
INSTALLED_APPS += ('tests',) # noqa
| StarcoderdataPython |
3468393 | # coding=utf-8
"""
__purpose__ = ...
__author__ = JeeysheLu [<EMAIL>] [https://www.lujianxin.com/] [2020/8/12 10:18]
Copyright (c) 2020 JeeysheLu
This software is licensed to you under the MIT License. Looking forward to making it better.
"""
import sys
if __name__ == '__main__':
arg = sys.argv
print(a... | StarcoderdataPython |
3343700 | import positron
positron.main_level = positron.LogLevel.DEBUG
log = positron.Logger('log', positron.LogLevel.IMPORTANT)
log.enable_file_logging()
log.debug('debug')
log.io('io')
log.info('info')
log.warning('warning')
log.error('error')
log.important('important')
log.critical('critical')
log.iochars = 'MSG'
log.io('ms... | StarcoderdataPython |
9793435 | # IANA registry
PROFILE = 'profile'
SELF = 'self'
# Local relations
_root = 'http://rels.registronavale.com/'
SHIP_OWNER = _root + 'ship-owner'
SEARCH_SHIPS = _root + 'search-ships'
SHIP_BY_IMO = _root + 'ship-by-imo'
OWNED_SHIPS = _root + 'owned-ships'
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.