id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3315833 | import dbus.mainloop.glib, sys
from gi.repository import GLib
import can
from prototypes import text_encoder
import time
def sendToNav(text):
frames = text_encoder.encode(text, 0x2A)
for frame in frames:
can0.send(can.Message(arbitration_id=0x5E7, data=frame, extended_id=False))
time.sleep(0.05... | StarcoderdataPython |
43149 | <reponame>branislav1991/MicroscopyUNet
import os
import sys
import random
import math
import re
import time
import numpy as np
import cv2
import matplotlib
import matplotlib.pyplot as plt
import keras.backend as K
from models.mask_rcnn.config import CellConfig
from models.mask_rcnn import utils
from mode... | StarcoderdataPython |
1619871 | """
Base classes for representing signals.
"""
import logging
from copy import deepcopy
from functools import partial
import numpy as np
import xarray as xr
from ..models.model import Model
from scipy.signal import butter, detrend, get_window, hilbert
from scipy.signal import resample as scipy_resample
from scipy.sig... | StarcoderdataPython |
153453 | from protocolbuffers import Dialog_pb2
from distributor.shared_messages import create_icon_info_msg, IconInfoData
from interactions.utils.tunable_icon import TunableIcon
from sims4.localization import TunableLocalizedStringFactory
from sims4.tuning.tunable import TunableList
from ui.ui_dialog import UiDialogOk
import s... | StarcoderdataPython |
3267220 | import unittest
import tests.settings_mock as settings_mock
from tests.activity.classes_mock import FakeLogger
from workflow.workflow_DepositCrossref import workflow_DepositCrossref
class TestWorkflowDepositCrossref(unittest.TestCase):
def setUp(self):
self.workflow = workflow_DepositCrossref(
... | StarcoderdataPython |
133280 | <gh_stars>1-10
from .isAllowAccess import isAllowAccess
def validObjectAttr(obj, attrName):
if hasattr(obj, attrName):
return obj['attrName']
else:
return ''
def log(arg):
print ('\n')
print ("log --> ##################")
print (arg)
print ("##################")
print ('\n'... | StarcoderdataPython |
4825147 | import mock
from django.utils import unittest
from iml_common.lib.ntp import NTPConfig
class TestNTPConfig(unittest.TestCase):
""" Test class for NTPConfig """
def setUp(self):
super(TestNTPConfig, self).setUp()
self.ntp = NTPConfig()
# Static assignments for use in tests
se... | StarcoderdataPython |
3237962 | import urllib.parse
from io import BytesIO
import astropy.io.ascii
from ztf_viewer.catalogs.conesearch._base import _BaseCatalogApiQuery
class AstrocatsQuery(_BaseCatalogApiQuery):
id_column = 'event'
type_column = 'claimedtype'
redshift_column = 'redshift'
_table_ra = 'ra'
_ra_unit = 'hour'
... | StarcoderdataPython |
45150 | #https://www.crummy.com/software/BeautifulSoup/bs4/doc/#strings-and-stripped-strings
html_doc = """<html><head><title>The Dormouse's story</title></head>
<body>
<p class="title"><b>The Dormouse's story</b></p>
<p class="story">Once upon a time there were three little sisters; and their names were
<a href="http://exam... | StarcoderdataPython |
3308363 | import json
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from perceptron import Neuron
def read_data():
with open('data.json') as f:
return json.load(f)
def main():
sns.set(rc={'figure.figsize': (8, 4)})
sns.set_style('darkgrid', {'figure.facecolor': '#dddddd', 'ax... | StarcoderdataPython |
3264806 | <gh_stars>0
#!/usr/bin/env python3
# Author: <NAME>
# Date: 12/30/21
# License: (see MIT License at the end of this file)
# Title: VM Setup script
# This script will install the necessary programs and settings files on an
# Ubuntu 20.04.x Virtual Machine for USNA course work in Computer Science or
# Cyber Operations... | StarcoderdataPython |
23733 | import time
import sys
import numpy as np
from local_search import kmedian_local_search
import feasibility
from kmedkpm import k_median_k_partitions_LS
import psutil
from sklearn.datasets import make_blobs
import generator
import random
test = False
def lp_ls_complete(data, color_mat, rvec, k, logfile):
#########... | StarcoderdataPython |
1682219 | # Generated by Django 3.0.6 on 2020-06-11 10:47
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('members', '0001_initial'),
('articles', '0001_initial'),
... | StarcoderdataPython |
17236 | from PyQt5.QtWidgets import QTreeWidget
from PyQt5.Qt import pyqtSignal
from PyQt5.QtWidgets import QTreeWidgetItem
from PyQt5.Qt import Qt
class TreeWidget(QTreeWidget):
# enum ItemShowMode
ItemsCollapsed = 0
ItemsExpanded = 1
def __init__(self, parent=None):
super().__init__(parent)
s... | StarcoderdataPython |
1676692 | from django.core.management.base import BaseCommand
from django.utils import timezone
from django.conf import settings
from disturbance.components.proposals.models import ProposalType
import datetime
import itertools
class Command(BaseCommand):
help = 'Change the status of Compliances from future to due when th... | StarcoderdataPython |
161796 | <filename>server/src/oscarbluelight/offer/benefits.py<gh_stars>1-10
from decimal import Decimal as D
from django.core import exceptions
from django.db import models
from django.utils.translation import gettext_lazy as _
from oscar.core.loading import get_model, get_class
from oscar.apps.offer import utils
from oscar.ap... | StarcoderdataPython |
1601757 | import os
# os is only used for finding a dynamic absolute path to the I/O files
absolute_path = os.path.dirname(os.path.abspath(__file__))
inn = absolute_path + '/nasty.in'
outt = absolute_path + '/nasty.out'
# Open files
fin = open(inn)
fout = open(outt, 'w')
# Get the first line/number of numbers
firstLine = fin... | StarcoderdataPython |
3345735 | import ffmpeg
import os
def downloadRTSP(url, videoName, seconds=9999999, debug=False, force=False):
"""
Downloads an RTSP livestream from url to videoName.
Parameters:
url (str): the RTSP link to a stream
videoName (str): the filename of the downloaded stream
seconds (int): the m... | StarcoderdataPython |
205 | # Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import unittest
from aenum import Enum, auto
from dace import registry
@registry.make_registry
class ExtensibleClass(object):
pass
class Extension(ExtensibleClass):
pass
@registry.extensible_enum
class ExtensibleEnumeration(Enum):... | StarcoderdataPython |
3358156 | <filename>crashbin_app/migrations/0008_create_mailbox.py
from django.db import migrations
from django.conf import settings
def create_mailbox(apps, schema_editor):
Mailbox = apps.get_model("django_mailbox", "Mailbox")
Mailbox.objects.create(
name="crashbin inbox", uri=settings.CRASHBIN_CONFIG.EMAIL["i... | StarcoderdataPython |
15075 | <reponame>alirsamar/intro-ml
# Explained Variance of Each PC
#### Boilerplate #################################################################
print __doc__
from time import time
import logging
import pylab as pl
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn.datasets import ... | StarcoderdataPython |
99360 | <reponame>Anselmoo/robustness_metrics
# coding=utf-8
# Copyright 2022 The Robustness Metrics 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/LI... | StarcoderdataPython |
4812835 | <filename>coding/learn_tornado_2/synchronous_demo01.py
# -*- coding: utf-8 -*-
from tornado.httpclient import HTTPClient
http_client = HTTPClient()
response = http_client.fetch('http://www.baidu.com')
print(response.body)
| StarcoderdataPython |
3330921 | __version__ = """1.42.0""" | StarcoderdataPython |
1742927 | import psycopg2, urlparse, re, os
import urlparse
# url de la base de donnees heroku
DATABASE_URL="postgres://eoxdsmbgnnjprd:819342ac1961db6dceb37078f90e581b45743e34502382e75184184eae7b1948@ec2-23-21-220-152.compute-1.amazonaws.com:5432/decknecom629ch"
class Db:
"""Connexion a la base de donnees postgres de l'envir... | StarcoderdataPython |
4808051 | <reponame>NESpet/Pcap-visualization-project
from scapy.all import *
from datetime import datetime
import json
import sys
def onlyascii (text):
#if ord(char) < 48 or ord(char) > 127 : return '.'
#else: return char
return ''.join([i if ord(i) < 128 else '.' for i in text])
def get_protocol(ip):... | StarcoderdataPython |
1628784 | <filename>pegasus_wrapper/scripts/sort_nums_in_file.py
# This script is for testing purposes only
import logging
from immutablecollections import immutableset
from vistautils.parameters import Parameters
from vistautils.parameters_only_entrypoint import parameters_only_entry_point
def main(params: Parameters):
i... | StarcoderdataPython |
1756304 | """ Crypto helper functions """
import euclid
def fast_mod_exp(b, e, n):
"""
A fast algorithm for modular exponentiation (see square-and-multiply).
"""
assert b >= 1 and e >= 1 and n >= 1, "b, e and n must all be > 0"
result = b if (e & 1) else 1
exp_bit_len = e.bit_length()
for x in ra... | StarcoderdataPython |
3387279 | <reponame>trjahnke/PyWiki
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
SECRET_KEY = "2f336f67d6e8c38a177035e718131a8a2f8609671532e456"
class DevConfig(Config): #used as the local env
DEBUG = True
DEV... | StarcoderdataPython |
1704677 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from rpython.rlib.objectmodel import we_are_translated
class ExitException(Exception):
def __init__(self, status_msg):
self.exit_status = status_msg
def is_user(self):
return False
class SchemeException(Exception):
_attrs_ = ["msg", "w_exn_... | StarcoderdataPython |
70786 | from particle import Particle
def read_csv(path):
with open(path) as csvf:
lines = csvf.readlines()
header_data = [v for v in lines[0].split(',')]
L = float(header_data[0])
vf = float(header_data[1])
ff = float(header_data[2])
if header_data[-1].strip() == 'error':
print('Warni... | StarcoderdataPython |
1687724 | <gh_stars>1-10
import networkx as nx
from typing import Iterable, List, Tuple, Dict, Union
from itertools import islice
from llist import dllist
from bispy.utilities.graph_entities import _QBlock as _Block, _Vertex, _XBlock
from bispy.utilities.graph_decorator import decorate_nx_graph
from bispy.paige_tarjan.paige_tarj... | StarcoderdataPython |
67112 | from http import server
from http.server import HTTPServer #choose a port, serve until ctrl + c
from http.server import BaseHTTPRequestHandler #handle get requests
class requestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200) #status code 200
self.send_head... | StarcoderdataPython |
1684767 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File : 695.py
@Contact : <EMAIL>
@Modify Time : 2022/3/22 15:28
------------
"""
import collections
from typing import List
class Solution:
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
"""
广度优先搜索,并记录
""... | StarcoderdataPython |
46627 | # A tool for hand labelling images
# Generates an IDL file
# pass in the directory where you store your images and a filename, then select the points on the images
# every time you hit next a line is generated
# the clear button removes are selected points on the current image
# when all files in the directory are proc... | StarcoderdataPython |
161795 | <filename>utils.py
import cv2
import itertools
import numpy as np
import pathlib
def preprocess_image_from_path(path, target_shape=None):
image = cv2.imread(str(path))
if target_shape is not None:
image = cv2.resize(image, target_shape)
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
image = im... | StarcoderdataPython |
1675222 | """ Cisco_IOS_XR_ip_iarm_v4_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR ip\-iarm\-v4 package operational data.
This module contains definitions
for the following management objects\:
ipv4arm\: IPv4 Address Repository Manager (IPv4 ARM)
operational data
Copyright (c) 2013\-2016... | StarcoderdataPython |
1788476 | from django.forms import ModelForm
from .models import Address
from django_countries.fields import CountryField
class Address_Form(ModelForm):
country = CountryField().formfield()
class Meta:
model = Address
fields = ["country", "city", "street", "postal_code"] | StarcoderdataPython |
1608128 | <filename>drs2.py
# MIT License
#
# Copyright (c) [2018] [<NAME> (<EMAIL>),
# <NAME> (<EMAIL>)]
#
# 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, inc... | StarcoderdataPython |
1726960 | # Aemulator - dextreem (c) 2020
#
# This class represents a client (= participant) that can assign to a challenger
import datetime
import json
class Client:
name = ""
last_seen = datetime.time()
def __init__(self, name, last_seen):
self.name = name
self.last_seen = last_see... | StarcoderdataPython |
4816202 | <reponame>DanielLund/campus-compass<gh_stars>0
import pyowm
from a_star import A_Star, Node, Frontier
from config.config_reader import ConfigReader
class directionInformation():
def __init__(self):
self.config_reader = ConfigReader()
self.configuration = self.config_reader.read_config()
... | StarcoderdataPython |
3220235 | <gh_stars>10-100
#!/usr/bin/env python
"""
Test program that shows an object browser containing many types and variables.
"""
from __future__ import print_function
import sys, logging, six
import datetime as dt
from collections import OrderedDict
from objbrowser import browse
from objbrowser.utils import logging_ba... | StarcoderdataPython |
4834618 | <gh_stars>0
from django.conf.urls import include, url
from django.contrib import admin
from teacher import views as tv
from teacher import teacher_urls
urlpatterns = [
# Examples:
# url(r'^$', 'DjangoDemo.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.... | StarcoderdataPython |
1708094 | <reponame>Buettovan/flappy_bird_G18E
import pygame as pg
import random as rnd
def zeichne_kachel(pos):
x, y = pos[0]*kachel, pos[1]*kachel
pg.draw.rect(screen, farben[brett[pos]], (x, y, kachel, kachel))
pg.draw.rect(screen, f'#BBADA0', (x, y, kachel, kachel), 25)
if brett[pos] == 0:
return
text_surface... | StarcoderdataPython |
3324933 | <gh_stars>0
from typing import Dict, Iterable, Optional, Tuple, Union
import numpy as np
from cpsplines.psplines.bspline_basis import BsplineBasis
def granulate_prediction_range(
bspline_bases: Iterable[BsplineBasis],
prediction_step: Optional[Iterable[Iterable[Union[int, float]]]] = None,
) -> Tuple[Dict[in... | StarcoderdataPython |
1796022 | <gh_stars>1-10
import unittest
from translator import french_To_English
from translator import english_To_French
class Testtranslator(unittest.TestCase):
def test_french_To_English(self):
self.assertEqual(french_To_English("Bonjour"), "Hello")
class Testtranslator(unittest.TestCase):
def ... | StarcoderdataPython |
3202729 | # coding:utf-8
from models import GWUser
from gservice.client import GServiceClient
from datetime import datetime
import time
from django.core.paginator import PageNotAnInteger, Paginator, EmptyPage
def request_gw_user(appid, user, pwd):
_id = 1
_gw_user = GWUser.objects.get(id=_id) # must exists. and id = 1... | StarcoderdataPython |
1703018 | <filename>openstates/openstates-master/openstates/wv/committees.py<gh_stars>0
import re
from billy.scrape.committees import CommitteeScraper, Committee
import lxml.html
class WVCommitteeScraper(CommitteeScraper):
jurisdiction = "wv"
def scrape(self, chamber, term):
getattr(self, 'scrape_' + chamber... | StarcoderdataPython |
28379 | import numpy as np
from astroquery.hitran import Hitran
from astropy import units as un
from astropy.constants import c, k_B, h, u
def calc_solid_angle(radius,distance):
'''
Convenience function to calculate solid angle from radius and distance, assuming a disk shape.
Parameters
----------
radius ... | StarcoderdataPython |
1721336 | #!/usr/local/miniconda2/bin/python
# _*_ coding: utf-8 _*_
"""
@author: MarkLiu
@time : 17-7-28 下午4:26
"""
import os
import sys
module_path = os.path.abspath(os.path.join('..'))
sys.path.append(module_path)
import pandas as pd
from conf.configure import Configure
result_files = os.listdir('./model_results/')
resu... | StarcoderdataPython |
4823971 | <reponame>TheCodeInside/NumberMunchers
from __future__ import division
from random import *
import random
import calendar, time
# Seed the PRNG
random.seed(calendar.timegm(time.gmtime()))
# Fractional constants
FRAC_NUMERATOR_MIN = 1
FRAC_NUMERATOR_MAX = 6
FRAC_DENOMINATOR_MIN = 2
FRAC_DENOMINATOR_MAX = 11
FRAC_MULTI... | StarcoderdataPython |
127702 | from django.contrib import admin
from . import models
# Register your models here.
@admin.register(models.PHR)
class AuthorAdmin(admin.ModelAdmin):
list_display = ('first_name', 'last_name') | StarcoderdataPython |
144860 | import base64
from flask import jsonify, request, abort
import logging
from yaml import safe_load, dump
from permissions import Permissions
logger = logging.getLogger(__name__)
class Maintenance:
def __init__(self, permissions=None, users=None, channels=None, state_file=None):
self.permissions = permi... | StarcoderdataPython |
138455 | <gh_stars>1-10
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
from onnxruntime.capi.onnxruntime_inference_collection im... | StarcoderdataPython |
3397539 | import sys
import time
from datetime import datetime
from picamera import PiCamera
camera = PiCamera()
#camera.start_preview()
code = 1
logins = {'12345': '12345', '123': '123', '1': '1'};
with open("../logs/logs.txt", "a") as f:
match = False
if len(sys.argv) != 3:
f.write("Incorrect format, got arguments: " + s... | StarcoderdataPython |
67484 | <gh_stars>10-100
import bz2
import contextlib
import distutils.util
import fcntl
import logging
import lzma
import io
import os
import pathlib
import progressbar # type: ignore
import select
import stat
import subprocess
import time
import tempfile
import uuid
import sys
import zlib
try:
import importlib.resource... | StarcoderdataPython |
1739337 | <gh_stars>100-1000
from corehq.apps.app_manager.management.commands.helpers import (
AppMigrationCommandBase,
)
from corehq.apps.app_manager.util import get_correct_app_class
class Command(AppMigrationCommandBase):
help = "One-time migration to replace CaseSearch command_label and again_label with " \
... | StarcoderdataPython |
3284030 | """
License terms and conditions for Gluu Cloud Native Edition:
https://www.apache.org/licenses/LICENSE-2.0
"""
from pathlib import Path
import subprocess
import ipaddress
import re
import string
import shutil
import random
import json
import base64
from getpass import getpass
from .kubeapi import Kubernetes
from .y... | StarcoderdataPython |
16612 | <gh_stars>0
import unittest
from main import Solution
class TestSolutionMethods(unittest.TestCase):
solution = Solution()
def test_longestCommonPrefix(self):
# leetcode test
self.assertEqual(self.solution.removeDuplicates([1,1,2]), 2)
# customized test
self.assertEqual(self.so... | StarcoderdataPython |
151831 | import requests
import json
import cloudscraper
import re
import sys
from bs4 import BeautifulSoup
mode = input('''Select mode:
- Email: email
- Username: username
- Email by password: <PASSWORD>
- Username by password: elogin
- Phone (BETA): phone
- Domain (BETA): domain
- Email by hash: hash
''').lower()
tr... | StarcoderdataPython |
4814175 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
A python implementation of persistence-pair-finding algorithm described in
Dey, <NAME>., <NAME>, and <NAME>. "Comparing Graphs via Persistence Distortion."
31st International Symposium on Computational Geometry (SoCG 2015).
Schloss Dagstuhl-Leibniz-Z... | StarcoderdataPython |
3278379 | <reponame>hellohuizz/The-Employment-System
import hashlib
import uuid
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from webpro.models import User, Admin, Jobinfo
# 功能函数部分
def make_token():
# 刚生成的token其实是128,默认进行了进制转换,转换为了16进制
token = str(uuid.uuid4())
... | StarcoderdataPython |
1685832 | <gh_stars>0
#!/usr/bin/env python3.8
"""Find the maximum amount of nesting for an expression that can be parsed
without causing a parse error.
Starting at the INITIAL_NESTING_DEPTH, an expression containing n parenthesis
around a 0 is generated then tested with both the C and Python parsers. We
continue incrementing t... | StarcoderdataPython |
1623776 | <filename>polling_stations/apps/data_collection/management/commands/import_east_cambridgeshire.py
from data_collection.management.commands import BaseDemocracyCountsCsvImporter
class Command(BaseDemocracyCountsCsvImporter):
council_id = "E07000009"
addresses_name = "local.2019-05-02/Version 1/Democracy Club -... | StarcoderdataPython |
1631722 | from .core import *
from .flat_estimators import *
from .preprocessing import *
from .validation import *
from .verification import *
from .estimators import *
from .tests import NMME_IMD_ISMR
import warnings
from pathlib import Path
__version__ = "0.5.0"
__licence__ = "MIT"
__author__ = "<NAME> (<EMAIL>)"
| StarcoderdataPython |
1773136 | #!/usr/bin/python
__author__ = 'kilroy'
# (c) 2014, WasHere Consulting, Inc.
# Written for Infinite Skills
import urllib2
proxy = urllib2.ProxyHandler({'http': '127.0.0.1:8080'})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
handle = urllib2.urlopen('http://www.microsoft.com')
print(handle.re... | StarcoderdataPython |
1737754 | #
# Copyright (c) 2018 Intel Corporation
#
# 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 ... | StarcoderdataPython |
3227288 | <gh_stars>1-10
# Copyright (c) 2019-2020 <NAME>
# License: MIT License
# Created 2019-02-13
# DXFEntity - Root Entity
from typing import TYPE_CHECKING, List, Any, Iterable, Optional, Union, Type, TypeVar, Set
import copy
from ezdxf import options
from ezdxf.lldxf.types import handle_code, dxftag, cast_value
from ezdxf.... | StarcoderdataPython |
3377686 | """Test cases for response objects."""
from typing import Dict
from typing import List
import pytest
import git_portfolio.response_objects as res
@pytest.fixture
def response_value() -> Dict[str, List[str]]:
"""Fixture for response value."""
return {"key": ["value1", "value2"]}
@pytest.fixture
def respons... | StarcoderdataPython |
20890 | # coding=utf-8
# Copyright 2020 The Google Research 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 applicab... | StarcoderdataPython |
3309419 | <filename>django_crud_cbv/urls.py
"""django_crud_cbv URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: pat... | StarcoderdataPython |
1790669 | # modified from Kristen's code
def create_proportion_class_k_friends(adj_matrix, node_id,
y_labels, k_class):
prop_class_k_friends = []
total_neighbors = []
total = np.sum(adj_matrix,1)
class_k_num = adj_matrix*np.matrix((y_labels==k_class)+0).T
prop_class_k =cla... | StarcoderdataPython |
1653370 | <filename>boba/urls.py
from django.urls import path
from .views import BobaListView, BobaCreateView, BobaDeleteView, BobaDetailView, BobaUpdateView
urlpatterns = [
path("", BobaListView.as_view(), name="boba_list"),
path("<int:pk>/", BobaDetailView.as_view(), name="boba_detail"),
path("new/", BobaCreateVie... | StarcoderdataPython |
22700 | #!/usr/bin/env python3
"""
Copyright 2018 Couchbase, 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 applicable law or agreed ... | StarcoderdataPython |
1770076 | <reponame>jayvdb/alcazar
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------------------------------------------------------------
# includes
# 2+3 compat
from __future__ import absolute_import, division, print_function, unicode_literals
# stand... | StarcoderdataPython |
3329746 | <reponame>Angelalalu/ProjectOption2
import numpy as np
from math import exp, log, sqrt
from scipy.stats import norm
from scipy import interpolate
import matplotlib.pyplot as plt
import csv
from scipy.optimize import Bounds
from scipy.optimize import minimize
from scipy.optimize import show_options
import copy
### Imp... | StarcoderdataPython |
3235629 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-09-01 22:59
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('profiles', '0008_auto_20170818_2024'),
... | StarcoderdataPython |
1785061 | # -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | StarcoderdataPython |
1729072 | import requests
import json
import time
import re
from bs4 import BeautifulSoup
import MySQLdb
import random
# 获取当前知乎热榜
# 获取当前知乎热榜
def get_hot_zhihu(url, headers, proxy_ip):
res = requests.get(url, headers=headers, proxies=proxy_ip)
content = BeautifulSoup(res.text, "html.parser")
hot_data = content.fin... | StarcoderdataPython |
3365447 | <reponame>wikimedia/labs-tools-wikibugs2
import shlex
import sys
import click
import socket
import subprocess
tool_name = 'wikibugs'
home_dir = '/data/project/{}'.format(tool_name)
code_dir = '{}/libera'.format(home_dir)
python = '{}/py35-stretch/bin/python'.format(home_dir)
job_definitions = {
'libera-phab': [... | StarcoderdataPython |
195754 | """Posts models."""
#Django
from django.db import models
from django.contrib.auth.models import User
#Este se conecta con el formulario PostForm de form.py
class Post(models.Model):
"""Post model."""
#Para relacionarlo con nuestro usuario
#USANDO FOREIGN KEY
#documentation Django Model Field Referen... | StarcoderdataPython |
71365 | # -*- coding: utf-8 -*-
"""
Semantic models for interpreting graphs.
"""
from typing import (
cast, Optional, Tuple, List, Dict, Set, Iterable, Mapping, Any)
import re
from collections import defaultdict
import random
from penman.exceptions import ModelError
from penman.types import (
Variable,
Role,
... | StarcoderdataPython |
3369356 | <filename>leetcode_python/59. Spiral Matrix II.py<gh_stars>10-100
class Solution:
def generateMatrix(self, n: int) -> [[int]]:
l, r, t, b = 0, n - 1, 0, n - 1
mat = [[0 for _ in range(n)] for _ in range(n)]
num, tar = 1, n * n
while num <= tar:
for i in range(l, r + 1): #... | StarcoderdataPython |
106568 | #!/usr/bin/env python
import argparse
import logging
import sys
from os.path import join
from pathlib import Path
from stravaviz import drawer, track_loader, grid_drawer, heatmap_drawer, elevations_drawer
from stravaviz.exceptions import ParameterError, DrawerError
def main() -> None:
d = drawer.Drawer()
a... | StarcoderdataPython |
1666304 | <filename>scripts/03_segmentation_pipeline.py
import sys
import yaml
import shared.segmentationFunctions as sg
if len(sys.argv) < 1:
print('Please Name a configuration to run ie config1: configurations are defined in deepVision/configSegmenters.yml')
sys.exit()
configFile = '../configSegmenters.yml'
datapath ... | StarcoderdataPython |
1718467 | <filename>setup.py
from setuptools import setup
setup(
name='py_VOD',
version='0.4.0',
packages=['pyvod'],
url='https://github.com/OpenJarbas/pyvod/',
license='Apache',
author='jarbasAI',
author_email='<EMAIL>',
include_package_data=True,
install_requires=["requests", "youtube-dl", ... | StarcoderdataPython |
3359649 | #!/usr/bin/env python3
# -*-coding:utf-8 -*
"""mapper.py"""
import sys
key_column_idx = sys.argv[1] # This variable holds index of corresponding dataset key column
if key_column_idx != "None":
key_column_idx = int(key_column_idx)
value_column_idx = int(sys.argv[2]) # This variable holds index of corresponding d... | StarcoderdataPython |
1654783 | <filename>server/ec2-coordinator-app/src/library/geth_status.py<gh_stars>0
from enum import Enum
from datetime import datetime
from loguru import logger
from library import ssh
class GethStatusEnum(Enum):
unknown = 1
not_started = 2
running = 3
running_error = 4
stopped_success = 5
stopped_int... | StarcoderdataPython |
3394952 | <reponame>kingRovo/PythonCodingChalenge<filename>sum of digits.py<gh_stars>1-10
n=int(input("Enter The Number"))
sum=0
while(n>0):
r=n%10
sum=sum+r
n=n//10
print(sum)
| StarcoderdataPython |
3380277 | class Invoker:
def __init__(self, userCommand: str):
self.userCommand = userCommand
def execute(self):
print(self.userCommand)
| StarcoderdataPython |
3209010 | import numpy as np
import cv2
from matplotlib import pyplot as plt
from imutils.video import VideoStream
face_cascade = cv2.CascadeClassifier('./haarcascades/haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('./haarcascades/haarcascade_eye.xml')
vs = VideoStream(src=0).start()
orgimg = vs.rea... | StarcoderdataPython |
57750 | angka = {
0: 'tepat',
1: 'satu',
2: 'dua',
3: 'tiga',
4: 'empat',
5: 'lima',
6: 'enam',
7: 'tujuh',
8: 'delapan',
9: 'sembilan',
10: 'sepuluh',
11: 'sebelas',
12: 'dua belas',
}
def eja(n):
lut1 = ['nol', 'satu', 'dua', 'tiga', 'empat',
... | StarcoderdataPython |
3209355 | import asyncio
import aiohttp
from jsonrpcclient.clients.aiohttp_client import AiohttpClient
async def main(loop):
async with aiohttp.ClientSession(loop=loop) as session:
client = AiohttpClient(session, "http://localhost:5000")
response = await client.request("ping")
print(response.data.result... | StarcoderdataPython |
8767 | <filename>fedex/services/availability_commitment_service.py<gh_stars>0
"""
Service Availability and Commitment Module
This package contains the shipping methods defined by Fedex's
ValidationAvailabilityAndCommitmentService WSDL file. Each is encapsulated in a class for
easy access. For more details on each, refer to ... | StarcoderdataPython |
86002 | #test_views.py
import pytest
import unittest
from flask import render_template, Flask, request, jsonify, session, redirect, url_for, flash
#from routes import index, scheduleMaker, load_ajax
from routes import app
#this test class will test the function that flask set up all pages successfully and correctly... | StarcoderdataPython |
3252200 | <reponame>waytai/open
#########################################################################
# -*- coding:utf-8 -*-
# File Name: ma.py
# Author: wayne
# mail: <EMAIL>
# Created Time: 2015/8/27 9:46:34
#########################################################################
#!/bin/python
f = lambda x:x*x
print f(3)... | StarcoderdataPython |
83773 | <gh_stars>1-10
#!/usr/bin/python
# ================
# databaseTools.py
# ================
#
# See README.md
#
# ===============
# Based on RadioDBTools.py by <NAME>.
# ===============
#
# This code is heavily based upon an open source code developed by <NAME>:
#
# -----------------... | StarcoderdataPython |
127412 | <filename>src/models/recurrent/lstm.py
import tensorflow as tf
def create_variable(name, shape, dtype, initializer=tf.truncated_normal_initializer,
weight_decay=None, loss=tf.nn.l2_loss):
with tf.device("/cpu:0"):
var = tf.get_variable(name=name, shape=shape, dtype=dtype, initializer=i... | StarcoderdataPython |
130992 | <filename>pyFAI/test/test_spline.py
#!/usr/bin/env python
# coding: utf-8
#
# Project: Azimuthal integration
# https://github.com/silx-kit/pyFAI
#
# Copyright (C) 2015-2018 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: <NAME> (<EMAIL>)
#
# Permission is hereb... | StarcoderdataPython |
116243 | <filename>scGCN/utility.py
import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn.cross_decomposition import PLSCanonical
import random
from sklearn.neighbors import KDTree
def svd1(mat, num_cc):
U, s, V = np.linalg.svd(mat)
d = s[0:int(num_cc)]
u = U[:, 0:int(num_cc)]
v ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.