id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1761518 | """Tests for patchwork.
There aren't many yet. Execute them like this::
$ cd <patchwork repo root>
$ python3.6 -m unittest discover
"""
| StarcoderdataPython |
1609775 | <gh_stars>0
from google.cloud import bigquery
from pathlib import Path
import json
import os
from datetime import date, timedelta
bigquery_client = bigquery.Client()
schema_file = 'dtsession.bq.schema.json'
TABLE_ID = os.getenv('TABLE_ID')
def _get_field_schema(field):
name = field['name']
field_type = fie... | StarcoderdataPython |
3244265 | """
Модуль леса
"""
import math
from pygame.draw import *
from random import *
from apple import Apple
from house import House
from tree import Tree
from village import Village
from stick import Stick
class Forest(object):
"""
Описывает лес
"""
def __init__(self, game):
"""
Парамет... | StarcoderdataPython |
1708129 | # proxy module
from pyface.ui.wx.workbench.workbench_window_layout import *
| StarcoderdataPython |
3373694 | # -*- coding: utf-8 -*-
from typing import AnyStr
from typing import Dict
import dataiku
from dataiku.customrecipe import get_recipe_config
from dataiku.customrecipe import get_input_names_for_role
from dataiku.customrecipe import get_output_names_for_role
from dkulib.dku_io_utils import set_column_descriptions
from ... | StarcoderdataPython |
3364041 | <reponame>herrphon/Algorithms_Example<gh_stars>100-1000
def bubble_sort(list):
swaped = True
while swaped:
swaped = False
for j in range(0, len(list) - 1):
if list[j] > list[j + 1]:
swap(list, j, j + 1)
swaped = True
return list
def swap(list, i... | StarcoderdataPython |
1769898 | def getCombinations(chars, m):
print('getCombinations(%s, %s)' % (chars, m))
if m == 0:
# BASE CASE
return ['']
elif chars == '':
# BASE CASE
return [] # TODO - add blank string here to get all possible combinations of chars.
else:
# RECURSIVE CASE
result ... | StarcoderdataPython |
4814842 | <filename>trackservice.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
RESTful API of GPS tracks information
"""
import os
import sys
import logging.config
import json
LOGGING_CONF_FILE = 'logging.json'
DEFAULT_LOGGING_LVL = logging.INFO
path = LOGGING_CONF_FILE
value = os.getenv('LOG_CFG', None)
i... | StarcoderdataPython |
4837433 | <reponame>Bjwebb/detecting-clouds<gh_stars>1-10
#!/usr/bin/env python
import pyfits
import numpy
import datetime, dateutil.parser, math
from operator import add
from functools import partial
import scipy.misc.pilutil as smp
import sys, os, shutil, subprocess
import json, tempfile
import errno
from django.core.manageme... | StarcoderdataPython |
3393764 | <filename>neuro-cli/tests/unit/test_shell_completion.py
import logging
import os
import shlex
import sys
from dataclasses import replace
from datetime import datetime, timedelta, timezone
from decimal import Decimal
from pathlib import Path
from typing import (
Any,
AsyncIterator,
Callable,
Iterable,
... | StarcoderdataPython |
1793157 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | StarcoderdataPython |
172800 | <gh_stars>10-100
import linear
import theano
import theano.tensor as T
from utils import get_dropout_noise, shared_zeros
from theano.ifelse import ifelse
def model(inputs, _is_training, params, batch_size, hidden_size, drop_i, drop_s, init_scale, init_H_bias, tied_noise, _theano_rng):
noise_i_for_i = get_dropout_n... | StarcoderdataPython |
1683185 | from __future__ import division
import math
import sys
from functools import wraps
from PIL import Image
class ImageSizeError(Exception):
def __init__(self, actual_size, required_size):
self.message = 'Image is too small, Image size : %s, Required size : %s' % (
actual_size, required_size)
... | StarcoderdataPython |
169422 | from torch import nn
import numpy as np
import torch
import os
from networks.Autoencoder import Encoder, Decoder
from dataLoader import data_load
######################
# Create the Model #
######################
class Model(nn.Module):
def __init__(self, c):
super(Model, self).__init__()
self.... | StarcoderdataPython |
36185 | <reponame>dswistowski/svarog
from dataclasses import dataclass
from dataclasses import field
from enum import Enum
from typing import Any
from typing import ClassVar
from typing import Literal
from typing import Mapping
from typing import Optional
from typing import Sequence
from typing import Union
from uuid import UU... | StarcoderdataPython |
3398587 | from pydantic import BaseModel
class ConsumerResponse(BaseModel):
topic: str
timestamp: str
product_name: str
product_id: int
success: bool
| StarcoderdataPython |
9189 | import re
# regex for a user or channel mention at the beginning of a message
# example matches: " <@UJQ07L30Q> ", "<#C010P8N1ABB|interns>"
# interactive playground: https://regex101.com/r/2Z7eun/2
MENTION_PATTERN = r"(?:^\s?<@(.*?)>\s?)|(?:^\s?<#(.*?)\|.*?>\s?)"
def get_set_element(_set):
"""get the element fr... | StarcoderdataPython |
1693878 | <gh_stars>0
from __future__ import annotations
from typing import cast, Tuple, Union
from typeguard import typechecked
from arkouda.client import generic_msg
from arkouda.pdarrayclass import pdarray, create_pdarray
from arkouda.logger import getArkoudaLogger
import numpy as np
from arkouda.dtypes import npstr as akstr... | StarcoderdataPython |
1735733 | import pdb
import numpy as np
import theano as th
import theano.tensor as T
from objective import kld
import distributions
mu = th.shared(value = 15.0, name='mu', borrow=True) # Initial value of mu
sigma = th.shared(value = 2.0, name='sigma', borrow=True) # Initial value of sigma
learning_rate = 0.01
X = np.linspa... | StarcoderdataPython |
3240508 | #!/usr/bin/env python3
import argparse
import json
import os
import re
import subprocess
import sys
import requests
import urllib3
if(sys.version_info[0] < 3 or sys.version_info[1] < 6):
print("This script requires python version 3.6 and above. Please make sure to run with the proper version. Aborting...")
s... | StarcoderdataPython |
1736685 | import unittest
import robotide
class ArgumentParsingTestCase(unittest.TestCase):
def test_no_args(self):
self.assertEqual((False, None), robotide._parse_args([]))
def test_path_to_data(self):
self.assertEqual((False, 'data'), robotide._parse_args(['data']))
def test_noupdatecheck(self)... | StarcoderdataPython |
1643919 | import os
from conans import ConanFile, AutoToolsBuildEnvironment, tools
from conans.errors import ConanInvalidConfiguration
class OdbcConan(ConanFile):
name = 'odbc'
description = 'Package providing unixODBC'
url = 'https://github.com/conan-io/conan-center-index'
homepage = "http://www.unixodbc.org"
... | StarcoderdataPython |
3246336 | # Copyright 2014 Midokura SARL
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | StarcoderdataPython |
1706922 | """
MIT License
Copyright (c) 2018 <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, distri... | StarcoderdataPython |
137524 | <filename>test/python/quantum_info/operators/test_measures.py<gh_stars>0
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at htt... | StarcoderdataPython |
3369718 | <filename>api/controllers/incident_controller.py
"""
Module to handle incident CRUD operations
"""
import os
from api import app
import logging
from datetime import datetime
from api.models.user_model import User
from werkzeug.utils import secure_filename
from api.database.engine import DbConnection
from api.models.inc... | StarcoderdataPython |
1724749 | <gh_stars>0
from config.provider import SettingsKeys
def clear_services(config, mysql_service, rabbitmq_service):
mysql_service.execute_query("truncate {};".format(config[SettingsKeys.mysql][SettingsKeys.order_table]))
rabbitmq_service.purge_queue("red")
rabbitmq_service.purge_queue("green")
rabb... | StarcoderdataPython |
36106 | <gh_stars>1-10
import os
import cv2
from ReceiptGenerator.draw_receipt import create_crnn_sample
NUM_OF_TRAINING_IMAGES = 3000
NUM_OF_TEST_IMAGES = 1000
TEXT_TYPES = ['word', 'word_column', 'word_bracket', 'int', 'float', 'price_left', 'price_right', 'percentage']
# TEXT_TYPES = ['word']
with open('./ReceiptProcess... | StarcoderdataPython |
1602014 | import numpy as np
import gym
from gym.spaces import Box
import pdb
class AtariPreprocessing(gym.Wrapper):
r"""Atari 2600 preprocessings.
This class follows the guidelines in
Machado et al. (2018), "Revisiting the Arcade Learning Environment:
Evaluation Protocols and Open Problems for General Agents... | StarcoderdataPython |
1606023 | <filename>euler/002.py
from functools import lru_cache
@lru_cache
def fib(n):
return n if n < 2 else fib(n - 1) + fib(n - 2)
print(sum(filter(lambda x: x % 2 == 0, map(lambda x: fib(x), range(34)))))
| StarcoderdataPython |
1752451 | #!/usr/bin/env python
#
# Template for MVVM applications.
#
from __future__ import generators, unicode_literals
import sys
if sys.version_info[0] < 3:
str = unicode
import Tkinter as tkinter
import ttk
import tkFileDialog as filedialog
import tkSimpleDialog as simpledialog
else:
import tkinter
... | StarcoderdataPython |
58755 | <gh_stars>0
from django import forms
from scouts.models import Scout
class ScoutForm(forms.ModelForm):
class Meta:
model = Scout
fields = ['person', 'robot_number', 'match_number', 'hatches_secured']
| StarcoderdataPython |
4804414 | import os
import clik
import numpy as np
### Some important variables ###
clik_root = os.environ.get('PLANCK_2018_DATA')
if clik_root == None:
raise ValueError('The environment variable PLANCK_2018_DATA is not set.')
### Planck 2018 lensing CMB-dependent
lens_CMBdep = clik.clik_lensing(clik_root + '/lensing/smica... | StarcoderdataPython |
3312744 | """A utility layer that returns a particular element from the previous layer."""
from torch import nn, Tensor
from typing import Iterable, Any
class Selector(nn.Module):
"""Utility layer that selects and returns a particular element out of
a tuple. It is useful to select a particular output from the previous... | StarcoderdataPython |
3214389 | #!/usr/bin/env python
# coding: utf-8
"""
Utilities for handling the Graphic Unit Interface.
.. todo::
Switch to Ttk instead of Tk for a better look of the GUI
"""
try:
import tkinter
from tkinter.filedialog import askopenfilename
except ImportError:
import Tkinter as tkinter
from tkFileDialog i... | StarcoderdataPython |
3292403 | <gh_stars>1-10
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ---------------------------------... | StarcoderdataPython |
174371 | <filename>gnuradio-3.7.13.4/gr-digital/python/digital/qa_simple_framer.py<gh_stars>1-10
#!/usr/bin/env python
#
# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Gen... | StarcoderdataPython |
1622163 | # Copyright 2020-2022 OpenDR European Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | StarcoderdataPython |
1628131 | import pytest
from tests.utils import resource_file
from owslib.wps import WebProcessingService, WPSExecution, Process, is_reference
from owslib.etree import etree
@pytest.fixture
def wps():
'''Returns a WPS instance'''
# Initialize WPS client
wps = WebProcessingService('http://example.org/wps', skip_ca... | StarcoderdataPython |
155518 |
import os
import random
import argparse
import json
import torch
import torch.utils.data
from utils.audio_processor import WrapperAudioProcessor as AudioProcessor
from utils.generic_utils import load_config
if __name__ == "__main__":
# Get defaults so it can work with no Sacred
parser = argparse.ArgumentParse... | StarcoderdataPython |
1645783 | <reponame>russelljjarvis/numba_reduced_neuronal_models
import unittest
#import nose as nt
import nose.tools as nt
from nose.plugins.attrib import attr
import jithub
from jithub.models import model_classes
import quantities as pq
import numpy as np
#import matplotlib.pyplot as plt
import collections
import quantities as... | StarcoderdataPython |
3330062 | <gh_stars>0
from django.contrib import admin
from smart_filter.models import WhitelistEntry
admin.site.register(WhitelistEntry)
| StarcoderdataPython |
4836589 | from .block import Block
class NeuralNet(Block):
r"""Construct a neural network with several blocks.
The neural network is just a wrapper of blocks and some training variables.
It helps to serialize them more conveniently. It is not in charge of
connecting them. The connection can be non-sequential.... | StarcoderdataPython |
1638007 | from .base_column_profilers import BaseColumnProfiler
from .numerical_column_stats import NumericStatsMixin
from .datetime_column_profile import DateTimeColumn
from .int_column_profile import IntColumn
from .float_column_profile import FloatColumn
from .text_column_profile import TextColumn
from .categorical_column_pr... | StarcoderdataPython |
4816330 | # (c) 2022 <NAME> MOPFPPP
# This code is licensed under the MIT license (see LICENSE.txt for details)
"""
Add traversing links to the nodes in the tree
"""
def tree_add_links(tree):
"""
TO DO: docstring this
"""
return _tree_adjust_links(4, tuple(map(_tree_set_first_links(
tuple(map(_t... | StarcoderdataPython |
27792 | <filename>scripts/compute_lengths.py<gh_stars>10-100
#! /usr/bin/python3
import sys
import numpy
import argparse
import logging
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--output", type=str, help="Where to save numpy array of lengths.", required=True)
args = parser.parse... | StarcoderdataPython |
1662323 | <filename>FlaskWebpage.py
from flask import Flask, jsonify, request, render_template
import numpy as np
import joblib
import cv2
import traceback
from Box_Character import Box_Character
from equationClass import equation
from TrainCNN import loadModel
app = Flask(__name__)
model = None
@app.route('/')
def main():
... | StarcoderdataPython |
1713291 | #coding=utf-8
from PIL import Image
import os
import os.path
import glob
def rename(rename_path,outer_path,folderlist):
#列举文件夹
for folder in folderlist:
if os.path.basename(folder)=='bus':
foldnum = 0
elif os.path.basename(folder)=='taxi':
foldnum = 1
elif os.path.b... | StarcoderdataPython |
3250549 | import torch
import torch.nn as nn
class PointNet(nn.Module):
def __init__(self):
super(PointNet, self).__init__()
self.local_layers = nn.ModuleList([
nn.Conv1d(in_channels=3, out_channels=64, kernel_size=1),
nn.BatchNorm1d(64),
nn.ReLU(),
nn.Conv1d... | StarcoderdataPython |
1665835 | class AbstractFeatureSelectionModel:
_X=None
_y=None
_verbose=None
_params=None
_code=None
def __init__(self,code, X, y, params, verbose):
self._code=code
self._X=X
self._y=y
self._params=params
self._verbose=verbose
def execute(self):
... | StarcoderdataPython |
185466 | # moosic.server.support.py - classes and functions that support moosicd
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, comm... | StarcoderdataPython |
3225188 | <reponame>moriarty/fetch_demos<filename>fetch_demos_common/bin/point_head.py
#! /usr/bin/env python
import rospy
from fetch_demos_common import fetch_api
if __name__ == '__main__':
rospy.init_node("fetch_api")
head_action = fetch_api.PointHeadClient()
while not rospy.is_shutdown():
# send the point... | StarcoderdataPython |
155109 | import numpy as np
from flask import request
from chatbot.common.Debug import flush
from chatbot.common.Talk import parse, get_ml_vars, get_ml_model, create_input
from chatbot.api.helpers.responses.Talk import TalkResponse
from chatbot.models.TalkLog import TalkLogModel
from chatbot.api.domain.repositories.TalkLogRepos... | StarcoderdataPython |
3283617 | <reponame>mnlevy1981/CESM_catalog<gh_stars>0
#!/usr/bin/env python3
""" Top-level module for cesmcatalog. """
from pkg_resources import DistributionNotFound, get_distribution
try:
__version__ = get_distribution(__name__).version # noqa: F401
except DistributionNotFound: # noqa: F401
__version__ = '0.0.0' # ... | StarcoderdataPython |
3211388 | from .config_provider import ConfigProvider
from .iconfig_provider import IConfigProvider
from .mute_cleanup_processor import MuteCleanupProcessor
from .warn_cleanup_processor import WarnCleanupProcessor
| StarcoderdataPython |
3394223 | from __future__ import absolute_import
from django.apps import AppConfig
class Config(AppConfig):
name = "sentry.plugins.sentry_interface_types"
def ready(self):
from .models import InterfaceTypePlugin
from sentry.plugins.base import register
register(InterfaceTypePlugin)
| StarcoderdataPython |
1660677 | def qsort3(alist,low,up):
print(alist)
if low >= up:
return
pivot = alist[low]
left, right = low + 1, up
while left <= right:
while left <= right and alist[left] < pivot:
left += 1
while left <= right and alist[left] > pivot:
right -= 1
... | StarcoderdataPython |
1642856 | <reponame>chrwm/otoole
"""Creates a datapackage from a collection of CSV files of OSeMOSYS input data
- Uses Frictionless Data datapackage concept to build a JSON schema of the dataset
- Enforces relations between sets and indices in parameter files
"""
import logging
import os
import sys
from datapackage import Pac... | StarcoderdataPython |
144800 | <reponame>18F/cloud-marketplace-prototype<filename>marketplace/management/commands/seeddb.py
import random
from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
from django.contrib.auth.models import User
from marketplace.models import Product, LicenseRequest... | StarcoderdataPython |
67442 | #################### Random Forest SemEval evaluation ####################
import pandas as pd
import numpy as np
from joblib import dump, load
from sklearn.metrics import f1_score, accuracy_score, precision_score, recall_score
### Loading SemEval 2019 variables
character_variables = np.load(f'non_dl_semeval_character... | StarcoderdataPython |
18941 | from src.commons.big_query.copy_job_async.result_check.result_check_request import \
ResultCheckRequest
from src.commons.big_query.copy_job_async.task_creator import TaskCreator
class BigQueryJobReference(object):
def __init__(self, project_id, job_id, location):
self.project_id = project_id
s... | StarcoderdataPython |
1654913 | #!/usr/bin/env python
import substitution
import grille | StarcoderdataPython |
1779122 | #!/usr/bin/env python
import sys, time, os, os.path, sqlite3, json
prefix = os.path.dirname(sys.argv[0]) or '.'
f = open(prefix + '/vis.min.js')
js = f.read()
f.close()
f = open(prefix + '/vis.min.css')
css = f.read()
f.close()
f = open('mprofile.html', 'w')
print >> f, """<!doctype html>
<html>
<head>
<style>
%s
</s... | StarcoderdataPython |
1611380 | # %%
# Third party libraries
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
# Import local module
from multyscale import utils, filterbank
# %% Load example stimulus
stimulus = np.asarray(Image.open("example_stimulus.png").convert("L"))
# %% Parameters of image
shape = stimulus.shape # fil... | StarcoderdataPython |
1168 | # coding: UTF-8
import time
import torch
import numpy as np
from train_eval import train, init_network
from importlib import import_module
import argparse
parser = argparse.ArgumentParser(description='Chinese Text Classification')
parser.add_argument('--model', type=str, required=True, help='choose a model: TextCNN')
... | StarcoderdataPython |
1670097 | from bs4 import BeautifulSoup
import requests
from datetime import datetime
from selenium import webdriver
from time import sleep
from dateutil.parser import parse
__author__ = '<NAME>'
class Tracker(object):
'''
This class contains the common features of each of the below trackers
Each has the following Attribu... | StarcoderdataPython |
1776709 | while True:
try:
nums = input().split()[1:]
nums = list(map(int, nums))
print("no" if (sum(nums) > 59*len(nums)) else "yes")
except:
break
| StarcoderdataPython |
1644980 | <reponame>yang-neu/env_probe
#!/usr/bin/env python3
import time
import datetime
import pymysql.cursors
import logging
import sys
class env_db():
def __init__(self):
try:
self.internalEnvTable = "dht11_sensor"
self.externalEnvTable = "bme280_sensor"
self.logLevel = log... | StarcoderdataPython |
1755324 | <filename>Python/Id_pass_practice.py
ID=str(input("kullanıcı adı giriniz : "))
PSS=str(input("sifre giriniz : "))
print("kullanıcı adi ve parola {} karakterden olusuyor".format(len(ID)+len(PSS)))
if len(ID)+len(PSS)<=40:
print("kullanıcı adi ve sifre uygundur")
else :
print("kullanıcı adi ve sifre uygun değildir") | StarcoderdataPython |
1722127 | <reponame>cloose/ray-tracer-challenge<filename>shapes/triangle.py
from core import Intersection, add, subtract, multiply, cross, dot, normalize
from .shape import Shape
class Triangle(Shape):
def __init__(self, p1, p2, p3, n1=None, n2=None, n3=None):
super().__init__()
self.p1 = p1
self.p2... | StarcoderdataPython |
1765484 | <gh_stars>0
password="<PASSWORD>(1<PASSWORD>,20,sha512)$bfa1857b77b4dd50$ab2d8e19c3a4822e88e6bd480656b8b51d31a7a4"
| StarcoderdataPython |
3307189 | <filename>hail-elasticsearch-pipelines/loftee/src/loftee_utils.py
__author__ = 'konradjk'
from operator import itemgetter
import re
import sys
# Note that this is the current as of v81 with some included for backwards compatibility (VEP <= 75)
csq_order = ["transcript_ablation",
"splice_acceptor_variant",
"splice_dono... | StarcoderdataPython |
1699718 | <reponame>cdlaimin/pity
import smtplib
from email.header import Header
from email.mime.text import MIMEText
from email.utils import make_msgid
from jinja2.environment import Template
from app.core.configuration import SystemConfiguration
from app.core.msg.notification import Notification
from config import Config
c... | StarcoderdataPython |
111143 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import math
def arguments():
# Handle command line arguments
parser = argparse.ArgumentParser(description='Adventofcode.')
parser.add_argument('-f', '--file', required=True)
args = parser.parse_args()
return args
class TobogganTrajector... | StarcoderdataPython |
1703826 | import pandas as pd
import numpy as np
from os import path
import time
import subprocess
from subprocess import PIPE
import ast
###################DataFrames:#####################################
#Read File of all the unique userids of the bots that tweeted messages regarding to the 2016 elections.
dfn = pd.read_csv("... | StarcoderdataPython |
3304197 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.utils.timezone import utc
from django.conf import settings
import datetime
class Migration(migrations.Migration):
dependencies = [
('votes', '0001_initial'),
]
operations = [
... | StarcoderdataPython |
54735 | # Example of embedding hiplot into dash
import dash
from dash import html
from dash import dcc
from dash.dependencies import Input, Output, State
import pandas as pd
import hiplot as hip
df = pd.read_csv('https://gist.githubusercontent.com/chriddyp/c78bf172206ce24f77d6363a2d754b59/raw/c353e8ef842413cae56ae3920b8fd784... | StarcoderdataPython |
1680843 | #!/usr/bin/env python
"""
Hashed Array Mapped Trie
Implementation based on the paper "Ideal Hash Trees" by <NAME>.
"""
__author__ = "<NAME>"
__contact__ = "<EMAIL>"
class BitmapHashTable(object):
def __init__(self, bitmap=0, values=[]):
self.bitmap = bitmap
self.values = values
def _idx(self, key):
"""
... | StarcoderdataPython |
55325 | <reponame>joshpetit/biblehub
class COLORS:
header = "\033[4m"
red = "\033[31m"
green = "\033[32m"
blue = "\033[34m"
normal = "\033[0m"
def format_verse(reference, text) -> str:
return "{blue}{reference}{normal} \n{verse}\n".format(
blue=COLORS.blue, reference=reference,
normal=... | StarcoderdataPython |
1753088 | #!/usr/bin/python
import pyCiscoSpark
import sys
#storing the Authentication token in a file in the OS vs. leaving in script
fat=open ("/usr/lib/cgi-bin/at.txt","r+")
accesstoken=fat.readline().rstrip()
accesstoken="Bearer "+accesstoken
fat.close
#opening a file to log each time the script acts
f=open ("/usr/lib/cgi-... | StarcoderdataPython |
4832364 | <gh_stars>0
"""A simple Telegram bot that sends random dog pictures.
This code declares a Telegram bot that will reply every message with
a random dog picture.
Every picture is fetched through the Dog API (https://dog.ceo/dog-api/).
@author <NAME> <<EMAIL>>
"""
import logging
import os
import random
import request... | StarcoderdataPython |
1791277 | <filename>src/core/api/sql_tuning.py
# -*- coding: UTF-8 -*-
import time
from core.utils.const import SQLTuning
import logging
from core.utils.engines import get_engine
from rest_framework.response import Response
from core.utils.sql_utils import extract_tables
CUSTOM_ERROR = logging.getLogger('SqlManager.core.sql_tun... | StarcoderdataPython |
1628612 |
__all__ = ['iterate_structure']
from oldowan.structure.parse import parse_structure
from oldowan.structure.parse import parse_structure_results
import re, StringIO
def iterate_structure(something, what='guess', raw=False):
"""Iterate through blocks of Structure format."""
if what == 'guess':
if type... | StarcoderdataPython |
3334224 | <gh_stars>0
digits_dict = {
" _ | ||_| ": "0",
" | | ": "1",
" _ _||_ ": "2",
" _ _| _| ": "3",
" |_| | ": "4",
" _ |_ _| ": "5",
" _ |_ |_| ": "6",
" _ | | ": "7",
" _ |_||_| ": "8",
" _ |_| _| ": "9"
}
def convert(input_grid):
if len(inpu... | StarcoderdataPython |
3211061 | <filename>weblogic/deployment/deploy_app.py
#!/usr/bin/env python
admin_server_listen_address = os.environ['ADMIN_SERVER_LISTEN_ADDRESS']
admin_server_listen_port = os.environ['ADMIN_SERVER_LISTEN_PORT']
admin_username = os.environ['ADMIN_USERNAME']
admin_password = os.environ['ADMIN_PASSWORD']
app_name = os.environ[... | StarcoderdataPython |
4830117 | import frappe
import json
from datetime import timedelta
from frappe import _
from frappe.utils import today, getdate, now
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
from erpnext.accounts.doctype.sales_invoice.sales_invoice import get_bank_cash_account
from toolz import pluck, parti... | StarcoderdataPython |
1605932 | """
Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. Yo... | StarcoderdataPython |
116592 | <reponame>xflr6/latexpages
#!/usr/bin/env python3
# clean-example.py
import latexpages
if __name__ == '__main__':
latexpages.clean('example/latexpages.ini')
| StarcoderdataPython |
1651250 | import numpy as np
from gym import spaces
from causal_world.utils.env_utils import clip
class TriFingerAction(object):
def __init__(self, action_mode="joint_positions", normalize_actions=True):
"""
This class is responsible for the robot action limits and its spaces.
:param action_mode: (... | StarcoderdataPython |
1609971 | '''
@author : jhhalls
'''
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from .datasets import make_wave
from .plot_helpers import cm2
def plot_linear_regression_wave():
X, y = make_wave(n_samples=60)
... | StarcoderdataPython |
3228573 | import pandas as pd
def load_data(data_path):
"""Reads model data. It must have columns named 'x' and 'y'.
:param data_path: path to the data.
:return: Tuple of length two. Design matrix and target vector.
"""
df = pd.read_csv(data_path)
X = df['x'].values.reshape(-1, 1)
y = df['y'].values... | StarcoderdataPython |
1715106 | <reponame>zstars/weblabdeusto
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions ma... | StarcoderdataPython |
1668333 | radios = float(input('input the radius: '))
calc = str(0.5*3.14*radios*radios)
print('your anser is '+calc) | StarcoderdataPython |
3316922 | <reponame>beeunstable6/Mask_RCNN<gh_stars>100-1000
import pandas
import math
import re
import datetime
import time
import numpy as np
import os
import sys
import skimage.io
import pandas as pd
# Root directory of the project
ROOT_DIR = os.path.abspath("../../")
# Import Mask RCNN
sys.path.append(ROOT_DIR) # To find l... | StarcoderdataPython |
1666455 | <gh_stars>0
# Copyright 2019 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | StarcoderdataPython |
3239297 | <reponame>neuralchen/Multi-Domain-Translation<gh_stars>0
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
#############################################################
# File: ActivatorTable.py
# Created Date: Thursday October 17th 2019
# Author: <NAME>
# Email: <EMAIL>
# Last Modified: Saturday, 2nd November 2019 8:33:4... | StarcoderdataPython |
1622570 | <reponame>Eugenelcc/Data-Structure-Algorithm-Assignments<filename>Part A/Topic 6 Advance sorting/merge_sort.py
#sort a python list in ascending order using the merge sort
#algorithm
def mergeSort( theList ):
# Check the base case - the list contains a single item
if len(theList) <= 1:
return theList
... | StarcoderdataPython |
15253 | <reponame>juanfec/juan_rueda_test
# check to strings that represent version numbers and finds the greatest,
# 'equals' if they are the same version or 'Invalid Format'
# example: “1.2” is greater than “1.1”.
# for reusability this function just returns the version number or the word equals
# if a more elaborated answ... | StarcoderdataPython |
4815085 | <reponame>LittleJake/nhk-boardcast-downloader
RSS_URL = "https://www.nhk.or.jp/r-news/podcast/nhkradionews.xml"
DOWNLOAD_DIR = "download/"
MOVE_DIR = ""
# MOVE_COMMAND = "rclone moveto {} OneDrive:/share/NHK/"
MOVE_COMMAND = ""
# COPY_COMMAND = "rclone copyto {} OneDrive:/share/NHK/{}"
COPY_COMMAND = ""
BASE_URL =... | StarcoderdataPython |
3370060 | from kivy.uix.label import Label
from kivy.graphics import Line, Color, Rectangle, Ellipse
from kivy.uix.relativelayout import RelativeLayout
from kivy.uix.gridlayout import GridLayout
from kivy.properties import ObjectProperty
class Graphic(RelativeLayout):
"""Graphic class to print requirements to canvas"""
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.