id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1711511 | <gh_stars>10-100
def binarysearch(arr, n):
low = 0
high = len(arr) - 1
mid = 0
while low <= high:
mid = (high + low) // 2
if arr[mid] < n:
low = mid + 1
elif arr[mid] > n:
high = mid - 1
else:
return mid
return "doesnt exist!"
if ... | StarcoderdataPython |
1717831 | <gh_stars>0
import pytest
from pytest_mock import MockerFixture
from ambramelin.util import sdk
from ambramelin.util.config import Config, Environment, User
from ambramelin.util.errors import NoEnvironmentSelectedError
from tests.conftest import DummyCredentialManager
class TestGetApi:
def test_success(
... | StarcoderdataPython |
1664049 | from webserver import app
from webserver.utils.decorators import connect_required
from flask import render_template
@app.route('/cheats/')
#@connect_required
def cheats():
return render_template('cheats.html') | StarcoderdataPython |
3312435 | from flask import Blueprint, jsonify, request, abort
import time
import logging
from ..model import WebUser, WatchedUser, WatchedVideo, Task, TaskStatus,\
ItemOnline, ItemVideoStat, ItemUpStat, ItemRegionActivity,\
TaskFailed,TotalWatchedUser,TotalWatchedVideo,TotalEnabledTask,\
... | StarcoderdataPython |
40899 | <reponame>llimonta/Alaska2014<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib.lines import Line2D
from scipy import interpolate
from scipy.integrate import trapz
from scipy.optimize import curve_fit
import itertools
#dictionary for plotting
color_line = {'Iron':'k','N... | StarcoderdataPython |
3387577 | from model.usr import User
import re
from selenium.webdriver.support.ui import Select
class ContactHelper:
def __init__(self, app):
self.app = app
def open_contact_page(self):
driver = self.app.driver
if not (driver.current_url.endswith("/index.php")):
driver.find_element... | StarcoderdataPython |
47625 | <reponame>kingspp/DS595-ReinforcementLearning<filename>project_3/resources/ptorch.py
#!/usr/bin/env python
"""
PyTorch implementation of DQN
Paper: https://www.cs.toronto.edu/~vmnih/docs/dqn.pdf
"""
import argparse
import gym
from gym import wrappers
import numpy as np
import pdb
import os
import random
import time
i... | StarcoderdataPython |
1733121 | """
This module implements the SSH connection to NETCONF servers TX and RX
Copyright (c) 2018 <NAME> <<EMAIL>>
"""
from ncclient import manager
def connect(host, port, login, password):
try:
connection = manager.connect(host=host, port=port, username=login, password=password, hostkey_verify=False,
... | StarcoderdataPython |
24897 | # coding: utf-8
from enum import Enum, unique
@unique
class FailureCategory(Enum):
TEMPORARY_ISSUE = "TEMPORARY_ISSUE"
INTERNAL = "INTERNAL"
END_USER = "END_USER"
CONFIGURATION = "CONFIGURATION"
DEVELOPER = "DEVELOPER"
| StarcoderdataPython |
3209736 | # coding=utf-8
"""Command line interface to add tasks to 2Doapp."""
import argparse
import sys
import subprocess
import twodolib
from . urlhelper import TwoDoTask
usage_description = """\
Program to create tasks in 2Do. The default behavior is to print the generated
URL to stdout. Please use the '-e' or '--execute''... | StarcoderdataPython |
150281 | <reponame>Americanwallace0/NMTGMinor-1<gh_stars>0
import argparse
import torch
from nmtg import custom_logging
from nmtg.average_checkpoints import average_checkpoints
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('checkpoints', nargs='+',
help='Whic... | StarcoderdataPython |
1704308 | from pudzu.charts import *
from pudzu.sandbox.bamboo import *
fg, bg="black", "white"
COLS = 5
default_img = "https://s-media-cache-ak0.pinimg.com/736x/0d/36/e7/0d36e7a476b06333d9fe9960572b66b9.jpg"
flags = pd.read_csv("datasets/countries.csv").split_columns(('nationality', 'tld', 'country'), "|").explode('cou... | StarcoderdataPython |
3226018 | <filename>payload/adsb/marcus/top_block.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Top Block
# Generated: Thu Feb 23 11:08:20 2017
##################################################
if __name__ == '__main__':
import ct... | StarcoderdataPython |
59553 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/networking/platform/requests/client_telemetry_request.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as ... | StarcoderdataPython |
173109 | <reponame>IBM/covid19-india-data
from .bulletin import Bulletin
from bs4 import BeautifulSoup
class Kerala(Bulletin):
def __init__(self, basedir):
statename = 'KL'
super().__init__(basedir, statename)
self.bulletin_page_url = u'https://dhs.kerala.gov.in/%e0%b4%a1%e0%b5%86%e0%b4%af%e0%b4... | StarcoderdataPython |
122592 | <gh_stars>0
from gym_duckhunt.envs.duckhunt_env import DuckHuntEnv
| StarcoderdataPython |
1790638 | # -*- coding: utf-8 -*-
# Copyright (c) 2012, <NAME>
# 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 |
1686048 | <reponame>semitro/Raspberry-rider<gh_stars>0
# coding: utf-8
import cv2 as cv
import numpy as np
from vision.classifier import Classifier, Arrow
class DspUtil:
# TODO: optimize this shit
@staticmethod
def clear_circle(img, x, y, radius):
r2 = radius ** 2
for i in range(len(img)):
... | StarcoderdataPython |
3244720 | # -*- coding: utf-8 -*-
# Copyright (C) 2009-2010 Mag. <NAME>. All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. <EMAIL>
# ****************************************************************************
# This package is part of the package _MOM.
#
# This module is licensed under the terms of the BSD 3-Clause... | StarcoderdataPython |
132859 | <gh_stars>10-100
import os
from typing import Optional
from sxm_player.models import PlayerState
from sxm_player.queue import EventMessage, EventTypes
from sxm_player.runner import Runner, Worker
from sxm_player.workers import (
ArchiveWorker,
CLIPlayerWorker,
HLSWorker,
ProcessorWorker,
ServerWork... | StarcoderdataPython |
1725677 | def _js_devserver(ctx):
files = depset()
for d in ctx.attr.deps:
if hasattr(d, "node_sources"):
files = depset(transitive=[d.node_sources, files])
elif hasattr(d, "files"):
files = depset(transitive=[d.files, files])
if ctx.label.workspace_root:
# We need the... | StarcoderdataPython |
1630255 | import uuid
import pytest
from supriya.patterns.events import CompositeEvent, NodeFreeEvent, NullEvent, Priority
id_ = uuid.uuid4()
@pytest.mark.parametrize(
"event, offset, expected",
[
(
CompositeEvent([NullEvent(delta=0.25), NodeFreeEvent(id_, delta=0.0)]),
0.0,
... | StarcoderdataPython |
1617806 | #!/usr/bin/env python
"""
Example from https://github.com/awslabs/cdk8s/blob/master/docs/getting-started/python.md
reinvisioned with slightly differnt API
"""
import pdk8s
import pdk8s.chart_cli
from pdk8s import k8s
# Name of the chart
name = "hello_world"
# This is the chart version. This version number should be... | StarcoderdataPython |
192017 | <gh_stars>0
__author__ = 'seanhendryx'
# This script extracts Solar Radiation in watts/square meter from the wunderground API within specified date range and saves to csv:
# 1st column is date stamp in yearmonthdayhourminute, 2nd column is solar radiation in watts per square meter
# Example url to query API: http://a... | StarcoderdataPython |
3204467 | <gh_stars>1-10
#! /usr/bin/python3
# -*- coding: utf-8 -*-
#
# python/update/xml_update.py
#
# Jul/25/2014
#
# --------------------------------------------------------------------
import xmltodict
import dicttoxml
import sys
import string
sys.path.append ('/var/www/data_base/common/python_common')
#
from file_io i... | StarcoderdataPython |
3231297 | import paystacklib
from paystacklib.base.baseapi import BaseApi
from paystacklib.util.utils import clean_params
class TransferRecipient(BaseApi):
object_type = '/transferrecipient'
def __init__(
self, secret_key=None,
uri=paystacklib.api_base + object_type, method=None,
hea... | StarcoderdataPython |
3260521 | import argparse
import pprint
from client import Client
def main(host, port, verbose):
c = Client(host=host, port=port, verbose=verbose)
while True:
text = raw_input("sql> ").strip()
if text.lower() == "quit":
break
elif text:
result = c.query(text)
... | StarcoderdataPython |
3265625 | <gh_stars>0
import abc
import functools
import itertools
import operator
import os
import scipy.io.wavfile as sio
import tqdm
class LoaderAdapter(metaclass=abc.ABCMeta):
returns_transcripts = True
@property
def loader_function(self):
"""
If overridden, should accept filename and return (... | StarcoderdataPython |
1745175 | import argparse
import fileinput
import os
import subprocess
import sys
parser = argparse.ArgumentParser(description='Compile all GLSL shaders')
parser.add_argument('--glslang', type=str, help='path to glslangvalidator executable')
parser.add_argument('--g', action='store_true', help='compile with debug symbols')
args... | StarcoderdataPython |
1725086 | import numpy as np
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_raises
from sklearn.dummy import DummyClassifier
from sklearn.dummy import DummyRegressor
def _check_p... | StarcoderdataPython |
3207678 | <filename>kkeras/sequential_demo_9.py
# 采用stateful LSTM的相同模型
from keras.models import Sequential
from keras.layers import LSTM, Dense
data_dim = 16
timesteps = 8
num_classes = 10
batch_size = 32
# Expected input batch shape:(batch_size, timesteps, data_dim)
# Note that we have to provide the full batch_input_shape si... | StarcoderdataPython |
3200466 | """
All configurations for pyscrapers
"""
import os
import logging
import browser_cookie3
from pytconf import Config, ParamCreator
class ConfigLogging(Config):
"""
Parameters to control logging
"""
loglevel = ParamCreator.create_choice(
choice_list=[
logging.getLevelName(logging.N... | StarcoderdataPython |
3351064 | import textwrap
def wrap(string, max_width):
wrap = textwrap.wrap(string, width=max_width)
return '\n'.join(wrap)
string = input()
width = int(input()) | StarcoderdataPython |
52540 | <reponame>chrisbaudouinjr/spotiserver<gh_stars>1-10
#!/usr/bin/env false
import datetime
import logging
import spotipy
import threading
import time
import random
import heapq
logger = logging.getLogger(__name__)
class PartyFoul(Exception):
pass
class Track:
def __init__(self, spotify_id):
self.spoti... | StarcoderdataPython |
3277688 | """
*******************************************************
*
* test_checkParams_constraints - UNIT TEST FOR TRAVIS CI
*
* License: Apache 2.0
* Written by: <NAME>
* Created on: April 28, 2017
* Last updated: April 29, 2018
*
*******************************************************
"""
#################... | StarcoderdataPython |
177171 | <reponame>wuhaifengdhu/MLData
from unittest import TestCase
from mldata.lib.helper import Helper
from mldata.lib.processor import Processor
class TestProcessor(TestCase):
def test_normalize(self):
print("start test normalize")
new_file_path = "outputs/new.csv"
processor = Processor("resou... | StarcoderdataPython |
181237 | <filename>tpau_gtfsutilities/gtfs/tables/helpers.py<gh_stars>1-10
class ColumnRef:
table = ''
column = ''
cascade_row = None
def __init__(self, table, column, cascade_row=True):
# cascade_row=True means that row in table should be removed
# if value in column that owns reference is not ... | StarcoderdataPython |
17640 | <gh_stars>1-10
# Credit goes to https://bitbucket.org/spookylukey/django-fabfile-starter/src
import os
import datetime as dt
from io import StringIO
import json
import posixpath
import fabric
import requests
from fabsettings import (USER, HOST, DJANGO_APP_NAME,
DJANGO_APPS_DIR, LOGS_ROOT_D... | StarcoderdataPython |
3303627 | from . import db
from werkzeug.security import generate_password_hash,check_password_hash
from flask_login import UserMixin
from . import login_manager
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class User(UserMixin,db.Model): # we pass in db.model to allow
... | StarcoderdataPython |
3310028 | # Copyright 2019, OpenCensus Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | StarcoderdataPython |
1625786 | # coding=utf-8
"""SimpleXnat wrappers for the XNAT REST API"""
import abc
import os
import zipfile
import six
from copyxnat.xnat_backend.lazy_list import LazyList
from copyxnat.xnat_backend.utis import Utils
from copyxnat.xnat_backend.xnat_rest_client import XnatRestClient
@six.add_metaclass(abc.ABCMeta)
class Si... | StarcoderdataPython |
3222329 | class Document(object):
def load(self, row):
pass
| StarcoderdataPython |
3216659 | <reponame>martinthomas/vowpal_wabbit<gh_stars>1-10
# -*- coding: utf-8 -*-
""" Vowpal Wabbit python setup module """
import distutils.dir_util
import os
import platform
import sys
from codecs import open
from distutils.command.clean import clean as _clean
from setuptools import setup, Extension, find_packages, Distrib... | StarcoderdataPython |
1720995 | <reponame>Pierre-Sassoulas/copyright_notice_precommit
#!/usr/bin/env python
# mypy: ignore-errors
"""
Fixtures to generate sample source code files
A generic source file is structured following the layout:
<preamble>
<license>
<body>
where 'preamble' is a section of text preceding the 'license' block (if any),
... | StarcoderdataPython |
59112 | from typing import Optional, List, Any, Dict
from logic.dicom_file_reader.dicom_file_reader import DicomFileReader
from logic.entities.image import Image
class DicomFileReaderMockUp(DicomFileReader):
def __init__(self, dicom_data_directory: str) -> None:
super().__init__(dicom_data_directory)
s... | StarcoderdataPython |
3219949 | <gh_stars>0
# Generated by Django 3.1.7 on 2021-03-02 02:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Address',
fields=[
... | StarcoderdataPython |
1623294 | <reponame>pawlaczyk/sarenka_tools
"""
Zapsiywanie listy wszystkich podatności cve do pliku cve_all.json (same idki)
cve_all_details.json zapisywanie dadatkowych informacji srapowanych ze strony, m.inntmi cwe id dla dane podatności
"""
import json
import time
from datetime import datetime
from cve_ids_all_nist_scraper ... | StarcoderdataPython |
3245652 | import datetime
import logging
import collections
from flask import (current_app, flash, request, render_template, redirect,
url_for, abort)
from flask.ext.login import current_user
from kozmic import db
from kozmic.models import User, Organization, Project, DeployKey
from . import bp
logger = lo... | StarcoderdataPython |
3292390 | class PokerHandType(object):
HIGH_CARD = 1
ONE_PAIR = 2
TWO_PAIR = 3
THREE_OF_A_KIND = 4
STRAIGHT = 5
FLUSH = 6
FULL_HOUSE = 7
FOUR_OF_A_KIND = 8
STRAIGHT_FLUSH = 9
ROYAL_FLUSH = 10
@classmethod
def to_string(cls, handType):
stringRepr = {
... | StarcoderdataPython |
3385990 | # -*- coding: utf-8 -*-
""" PDS Registry """
import pkg_resources
__version__ = pkg_resources.resource_string(__name__, "VERSION.txt").decode("utf-8").strip()
# For future consideration:
#
# - Other metadata (__docformat__, __copyright__, etc.)
# - N̶a̶m̶e̶s̶p̶a̶c̶e̶ ̶p̶a̶c̶k̶a̶g̶e̶s̶ we got this
| StarcoderdataPython |
180634 | <reponame>0Karim/Concept-Task-with-python
import ply.lex as lex
import ply.yacc as yacc
import re
tokens = [
'NUMBER',
'PLUS',
'MINUS',
'TIMES',
'DIVIDE',
'LPAREN',
'RPAREN',
'FOR',
'ID',
'EQUALE' ,
'GREATER' ,
'SMALLER' ,
'TRUE',
'SEMICOLOMN',
... | StarcoderdataPython |
131995 | <filename>tests/data/config/g.py
filename = 'reserved.py'
| StarcoderdataPython |
61506 | from vkapp.bot.models import Income, Payment, Blogger, News
from .usersDAO import get_or_create_blogger
def new_income_proposal(amount, news):
income = Income(amount=amount, news=news, type=Income.PROPOSAL)
blogger = news.blogger
blogger.balance += amount
blogger.save()
income.save()
def re_count_... | StarcoderdataPython |
5130 | <reponame>Branlala/docker-sickbeardfr
# -*- coding: UTF-8 -*-
"""
RIFF parser, able to parse:
* AVI video container
* WAV audio container
* CDA file
Documents:
- libavformat source code from ffmpeg library
http://ffmpeg.mplayerhq.hu/
- Video for Windows Programmer's Guide
http://www.opennet.ru/docs/forma... | StarcoderdataPython |
141671 | <filename>tick/linear_model/tests/logistic_regression_test.py<gh_stars>0
# License: BSD 3 clause
import itertools
import unittest
import numpy as np
from sklearn.metrics.ranking import roc_auc_score
from tick.base.inference import InferenceTest
from tick.linear_model import SimuLogReg, LogisticRegression
from tick.s... | StarcoderdataPython |
3370048 | """https://adventofcode.com/2020/day/3"""
import aoc_interface
YEAR = 2020
DAY = 3
def traverse_map(input_map, right=3, down=1):
"""Travel down the input map by heading right and down a fixed amount each
iteration.
The map consists of clear ground '.', and trees '#'.
The map repeats to the right inf... | StarcoderdataPython |
1727163 | <reponame>broccolii/LearnPython<filename>PreviouslyCode/testAdd.py
import Python
z = Python.add(10, 23)
print z | StarcoderdataPython |
3284325 | <filename>AS1_Flow_dense2.py
import solvers as sol
from AS1_class import Asym_slab
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import pickle
def save():
with open('pickles/flow_c0={}_R1={}_R2={}_K={}_M_A={}.p'.format(
slab.c0, slab.R1, slab.R2, slab.K, slab.M_A), 'wb') a... | StarcoderdataPython |
1710596 | import discord
from discord.ext import commands
def check_if_admin(ctx):
return ctx.author.id == 8741<PASSWORD>
class Admin(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
@commands.check(check_if_admin)
async def load(self, ctx, extension):... | StarcoderdataPython |
1705647 | <filename>2018/day13.py
from collections import deque
class Cart():
def __init__(self, direction, x, y):
self.direction = direction
self.x = x
self.y = y
self.intersection_actions = deque(['LEFT', 'STRAIGHT', 'RIGHT'])
def location(self):
return (self.x, self.y)
d... | StarcoderdataPython |
133321 | <gh_stars>0
'''
Author: ckd27546
Created: 19 November 12
'''
import argparse
class AdcClockDelayConfigure():
def __init__(self, Reserved=0, DelayAdjust=0):
'''
AdcClockDelayConfigure allows the user to specify up to both of the different parts of the Filter Control Slow Control S... | StarcoderdataPython |
1745388 | import jax
import jax.numpy as jnp
import chex
from typing import Optional
from functools import partial
from .obs_norm import ObsNormalizer
class BraxFitness(object):
def __init__(
self,
env_name: str = "ant",
num_env_steps: int = 1000,
num_rollouts: int = 16,
legacy_sprin... | StarcoderdataPython |
79211 | from django.conf.urls import url, patterns
urlpatterns = patterns('notification.views',
url(r'^notification/$', 'notification_list', name='notification_list'),
url(r'^request/$', 'request_list', name='request_list'),
) | StarcoderdataPython |
4102 | <filename>tibanna/top.py<gh_stars>10-100
import datetime
class Top(object):
"""class TopSeries stores the information of a series of top commands
::
echo -n 'Timestamp: '; date +%F-%H:%M:%S
top -b -n1 [-i] [-c]
over short intervals to monitor the same set of processes over time.
An... | StarcoderdataPython |
43939 | <reponame>GSByeon/edge-tpu-servers
"""
Detect objects and faces using tensorflow-tpu served by zerorpc.
This needs to be called from a zerorpc client with
an array of alarm frame image paths.
This is part of the smart-zoneminder project.
See https://github.com/goruck/smart-zoneminder
Copyright (c) 2018, 2019 <NAME>
... | StarcoderdataPython |
1792965 | <reponame>leoatchina/MachineLearning
import sys
import Cython.Compiler.Main
from numpy.distutils.command import build_src
from numpy.distutils.misc_util import appendpath
from numpy.distutils import log
from os.path import join as p_join, dirname
from distutils.dep_util import newer_group
from distutils.errors i... | StarcoderdataPython |
3373719 | from argparse import ArgumentParser
import os
from plumbum.cmd import git
from plumbum import local
from dodo_commands import Dodo
from dodo_commands.framework.util import bordered
def _args():
parser = ArgumentParser()
parser.add_argument('--checkout')
parser.add_argument('--prune', action='store_true'... | StarcoderdataPython |
3338232 | # you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(S, P, Q):
N = len(S)
A_prefix_sums = [0] * (N + 1)
C_prefix_sums = [0] * (N + 1)
G_prefix_sums = [0] * (N + 1)
factors = {"A": 1, "C": 2, "G": 3, "T": 4}
for i in range(N):
a, c, g = ... | StarcoderdataPython |
1629359 | <filename>airbyte-integrations/connectors/source-freshdesk/unit_tests/test_300_page.py
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
import pendulum
from source_freshdesk.api import TicketsAPI
class Test300PageLimit:
tickets_input = [
{"id": 1, "updated_at": "2018-01-02T00:00:00Z"},
... | StarcoderdataPython |
1791348 | <reponame>catornot/Followed<filename>main.py
import pygame
import sys
from states.intro import Intro
from states.menu import Menu
from states.game import Game
from states.transition import Transition
from states.editor import Editor
from utils import music_manager as Music_Manager
import random
class Main(object):
... | StarcoderdataPython |
1653666 | <gh_stars>0
from azureml.core import Workspace
from azureml.core.authentication import ServicePrincipalAuthentication
import os
import sys
import json
from pathlib import Path
def retrieve_workspace() -> Workspace:
ws = None
try:
ws = Workspace.from_config()
return ws
except Exception as... | StarcoderdataPython |
1789796 | <reponame>eur00t/django-ethereum-events<filename>django_ethereum_events/migrations/0003_auto_20180531_0836.py
# Generated by Django 2.0.5 on 2018-05-31 08:36
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_ethereum_e... | StarcoderdataPython |
56979 | #Get roll numbers, name & marks of the students of a class(get from user) and store these details in a file- marks.txt
count = int(input("How many students are there in class? "))
fileObj = open('marks.txt',"w")
for i in range(count):
print("Enter details for student",(i+1),"below:")
rollNo = int(input("Rolln... | StarcoderdataPython |
1705375 | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RKnitr(RPackage):
"""Provides a general-purpose tool for dynamic report generation in R u... | StarcoderdataPython |
3335659 | <gh_stars>0
# Union Find 木
from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] += parent[i]
... | StarcoderdataPython |
150346 | from tensorflow import keras as k
from tensorflow.keras import layers, models
import numpy as np
from tensorflow.python.keras.models import Model
class MockModel:
@classmethod
def get_model(cls) -> Model:
# Create a fake model. Basically, we simulate a text classifier where we have 3 words which are ... | StarcoderdataPython |
3308073 | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-04-05 17:30
from __future__ import unicode_literals
from django.db import migrations
from django.contrib.auth.models import Permission, Group
def fix_osfuser_view_permissions(*args):
view_osfuser_permission = Permission.objects.get(codename='view_osfuser'... | StarcoderdataPython |
3396961 | <reponame>fishprotect/crawl_image_from_360
import settings
port = settings.MYSQL_PORT
print(port) | StarcoderdataPython |
3204083 | # /test/test_style_warnings.py
#
# Test cases for style/* checks
#
# See /LICENCE.md for Copyright information
"""Test cases for style/* checks."""
from test.warnings_test_common import DEFINITION_TYPES
from test.warnings_test_common import FUNCTIONS_SETTING_VARS
from test.warnings_test_common import LinterFailure
fro... | StarcoderdataPython |
4831044 | <gh_stars>0
# -*- coding: utf-8 -*-
import copy
import re
import tempfile
from typing import Any, Dict, List, Optional, Union
from pytest import mark, param, raises
from omegaconf import (
MISSING,
AnyNode,
DictConfig,
DictKeyType,
ListConfig,
MissingMandatoryValue,
OmegaConf,
Unsuppor... | StarcoderdataPython |
4574 | <filename>python/get_links.py
#This file is auto-generated. See modules.json and autogenerator.py for details
#!/usr/bin/python3
"""
get_links.py
MediaWiki API Demos
Demo of `Links` module: Get all links on the given page(s)
MIT License
"""
import requests
S = requests.Session()
URL = "https://en... | StarcoderdataPython |
192457 | __author__ = '<NAME>'
from PyQt4 import QtCore, QtGui
from core.pco_definitions import PixelFly
from threading import Thread
import os, time, sys, pickle
import pyqtgraph as pg
from astropy.io import fits
import numpy as np
import matlab.engine
from queue import Empty
import pygame, os, time, pickle
import w... | StarcoderdataPython |
107997 | <reponame>RobinYaoWenbin/Python-CommonCode
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 11 10:50:38 2020
@author: Administrator
"""
"""
实现字符串的反转,要求不使用任何系统方法,且时间复杂度最小
"""
def ReverseStr(string):
lens = len(string)
mid = int(lens / 2)
for i in range(mid):
temp = string[i]
... | StarcoderdataPython |
3267903 | <reponame>IMULMUL/etl-parser
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-WinHttp
GUID : 7d44233d-3055-4b9c-ba64-0d47ca40a232
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl... | StarcoderdataPython |
199814 | # Generated by Django 2.0.2 on 2018-03-26 23:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course', '0007_course_teacher'),
]
operations = [
migrations.AddField(
model_name='course',
name='teacher_tell',
... | StarcoderdataPython |
133338 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 27 20:00:33 2021
@author: Mahsa
"""
import analyze_sensitivity
import pandas as pd
#sensitivity results for statusQuo strategy
output1=analyze_sensitivity.run_sensitivity_statusQuo('r',10)
output2=analyze_sensitivity.run_sensitivity_statusQuo('r',-10)
output3=analyze_se... | StarcoderdataPython |
87944 | <reponame>tumido/aiops-data-collector
import os
TOPOLOGICAL_INTERNAL_PATH = os.environ.get('TOPOLOGICAL_INTERNAL_PATH')
ALL_TENANTS = os.environ.get('ALL_TENANTS', 'true').lower() in ['true', 'y']
TOPOLOGICAL_INVENTORY_HOST = os.environ.get('TOPOLOGICAL_INVENTORY_HOST')
TOPOLOGICAL_INVENTORY_PATH = os.environ.get('TOP... | StarcoderdataPython |
1771555 | <filename>examples/2-benchmark/ccsd_iteration.py
#!/usr/bin/env python
import os
import time
import pyscf
log = pyscf.lib.logger.Logger(verbose=5)
with open('/proc/cpuinfo') as f:
for line in f:
if 'model name' in line:
log.note(line[:-1])
break
with open('/proc/meminfo') as f:
... | StarcoderdataPython |
3343967 | import unittest
from g1.containers import bases
from tests import fixtures
class BasesTest(fixtures.TestCaseBase):
def test_get_repo_path(self):
self.assertEqual(
bases.get_repo_path(),
self.test_repo_path / bases.REPO_LAYOUT_VERSION,
)
def test_cmd_init(self):
... | StarcoderdataPython |
3211292 | <reponame>PragyaJaiswal/Projection-Profile-Analysis-CXR
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import json, pickle
out_dir = '../sample_output/pickles/'
def feature_vector(density_symmetry, roughness_max, roughness_symmetry, filename):
# print(density_symmetry, roughness_max, roughness_sy... | StarcoderdataPython |
1773166 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, api
class AccountMove(models.Model):
_inherit = 'account.move'
website_id = fields.Many2one('website', related='partner_id.website_id', string='Website',
... | StarcoderdataPython |
10479 | """ python-rq based backend
This backend will send your messages asynchronously with python-rq.
Before using this backend, make sure that django-rq is installed and
configured.
Usage
-----
In settings.py
SENDSMS_BACKEND = 'sendsms.backends.rq.SmsBackend'
RQ_SENDSMS_BACKEND = 'actual.backend.to.use.SmsBack... | StarcoderdataPython |
1761891 | <gh_stars>1-10
# GUI frame for the stftMorph_function.py
try:
# for Python2
from Tkinter import * ## notice capitalized T in Tkinter
import tkFileDialog, tkMessageBox
except ImportError:
# for Python3
from tkinter import * ## notice lowercase 't' in tkinter here
from tkinter import filedial... | StarcoderdataPython |
3399932 | import pytest
import numpy as np
import pandas as pd
import patsy
from spudtr import DATA_DIR, mneutils, get_demo_df, RESOURCES_DIR
epochs_df = get_demo_df("sub000p3.ms100.epochs.feather")
def test__streams2mne_digmont():
eeg_streams = [
"lle",
"lhz",
"MiPf",
"LLPf",
"RLP... | StarcoderdataPython |
3284067 | import numpy as np
from scipy.integrate import quad
from scipy.special import binom
from scipy.special import gamma
from scipy.special import gammainc
from scipy.stats import binom
from numba import njit
def get_thetami_mat(mmax, beta, f=lambda m: 1, K=1, alpha=2, tmin=1, T=np.inf):
#uses an exponential dose distr... | StarcoderdataPython |
3218664 | from ... import Blocking
from ..shared_vars import KEY, KEY_ID
CLIENT = Blocking(
key_id=KEY_ID,
key=KEY,
timeout=7720
)
| StarcoderdataPython |
1695165 | <reponame>zelogik/remi<gh_stars>1000+
"""
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 t... | StarcoderdataPython |
162505 | from collections import defaultdict
import pycparser
import os
import ast
from pycparser import parse_file
def build_tree(script):
"""Builds an AST from a script."""
return ast.parse(script)
def read_oj_scripts(data_dir):
result = []
label_counts = defaultdict(int)
for label in os.listdir(data_di... | StarcoderdataPython |
52023 | #
# Copyright (c) 2015-2020 <NAME> <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE... | StarcoderdataPython |
1629725 | from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('stages', '0025_section_has_stages'),
]
operations = [
migrations.CreateModel(
name='Examination',
fields=[
('id', mo... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.