id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1769321 | <gh_stars>0
# -*- coding:utf-8 -*-
from yepes.apps import OverridingConfig
class AppConfig(OverridingConfig):
name = 'apps.no_target'
| StarcoderdataPython |
1735579 | from rest_framework import serializers
from django.contrib.auth.models import User
from models import Video, Frame, Region, DVAPQL, QueryResult, TEvent, IndexEntries, Tube, Segment, TrainedModel, \
Retriever, SystemState, QueryRegion, Worker, TrainingSet, RegionRelation, TubeRegionRelation, TubeRelation, \
Expo... | StarcoderdataPython |
1616894 | <reponame>liu3xing3long/MITK-2016.11
import os
import pandas as pd
import lmdb
import caffe
from regression.preprocessing import preprocess
def create_lmdb(path_to_simulation_results, lmdb_name):
df = pd.read_csv(path_to_simulation_results, header=[0, 1])
X, y = preprocess(df, snr=10.)
... | StarcoderdataPython |
74504 | #
# ovirt-engine-setup -- ovirt engine setup
# Copyright (C) 2013-2015 Red Hat, 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
#
# Unl... | StarcoderdataPython |
104791 | <reponame>feeltheajf/go-raml
# DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml.
import handlers
async def deliveries_get(request):
"""
Get a list of deliveries
It is handler for GET /deliveries
"""
return handlers.deliveries_getHandler(request)
async def deliveries_... | StarcoderdataPython |
1660213 | #!/usr/bin/env python3
# coding:utf-8
class Solution:
def FindGreatestSumOfSubArray(self, array):
if array == []:
return None
res = array[0]
tmp = array[0]
for i in range(1, len(array)):
if tmp < 0:
tmp = array[i]
else:
... | StarcoderdataPython |
3239121 | import sqlalchemy as sa
import datetime
from sqlalchemy.exc import SQLAlchemyError
from convergence.utils import exceptions
from convergence.utils import logger
from convergence.data.repo import Store
from convergence.data.models import User, Friend, FriendInvite
class FriendStore(Store):
def __init__(self, ses... | StarcoderdataPython |
1680450 | <reponame>deadsnakes/python2.3
"""
Package generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5
"""
import aetools
Error = aetools.Error
import CodeWarrior_suite
import Standard_Suite
import Metrowerks_Shell_Suite
import Required
_code_to_module =... | StarcoderdataPython |
1627635 | import abc
class CoverageFile(object):
"""
Templated class for Lighthouse-compatible code coverage file reader.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self, filepath=None):
self.filepath = filepath
self.modules = {}
self._parse()
#--------... | StarcoderdataPython |
59716 | from collections import namedtuple
from typing import List, Tuple
import torch
from wiki_search.dataset import Dataset, Document
from wiki_search.core.bert_ranking import BertRanking
SearchResult = namedtuple('SearchResult', ['score', 'document'])
class Engine(object):
def __init__(self, dataset: Dataset, ran... | StarcoderdataPython |
4801776 | <filename>git_lint_branch/spacy.py
import spacy
import typer
from spacy.cli import download
# NOTE: Preload the Spacy English File as it is used across
# several linters
try:
NLP = spacy.load('en_core_web_sm')
except OSError:
typer.echo(
f'"en_core_web_sm" not found!! Spacy will try to automatic... | StarcoderdataPython |
3231630 | <reponame>rionaldichandraseta/paparazzi-id
import os
import re
import requests
from bs4 import BeautifulSoup
from modules.constants import Constants
class Wikipedia:
@staticmethod
def convert_to_wiki_url(character_name: str) -> [[str]]:
return character_name.replace(' ', '_')
@staticmethod
... | StarcoderdataPython |
3310651 | <reponame>joshainglis/Web-Development-with-Sanic
from sanic import Sanic, text
from myapp.common.log import app_logger, setup_logging
def create_app():
app = Sanic(__name__)
setup_logging(app)
@app.route("")
async def dummy(_):
app_logger.debug("This is a DEBUG message")
app_logger.i... | StarcoderdataPython |
4809323 | <reponame>BloodAxe/xView3-The-First-Place-Solution
from .necks import *
from .heads import *
from .inference import *
from .unet_blocks import *
from .centernet_unet import *
| StarcoderdataPython |
1737732 | #
# ESnet Network Operating System (ENOS) Copyright (c) 2015, The Regents
# of the University of California, through Lawrence Berkeley National
# Laboratory (subject to receipt of any required approvals from the
# U.S. Dept. of Energy). All rights reserved.
#
# If you have questions about your rights to use or distrib... | StarcoderdataPython |
122810 | import pandas as pd
class DataLoader:
def __init__(self, config):
base_data_path = config.labels_generator.paths.base_data_path
test_data_path = config.defects_classifier.paths.test_data_path
generated_labels_path = config.labels_generator.paths.save_data_path
self.common_cols = ['... | StarcoderdataPython |
3393950 | def neighbours(r, c, R, C):
for rows, cols in ((r - 1, c), (r, c - 1), (r + 1, c), (r, c + 1)):
if 0 <= rows < R and 0 <= cols < C:
yield rows, cols
# Another way to write directions is:
i, j = 0, 0 # Assuming this is the start position
dirs = ((0, 1), (0, -1), (1, 0), (-1, 0))
for x, y in di... | StarcoderdataPython |
123178 | from django.forms import model_to_dict
from backoffice import models
from backoffice.utils.constant import Status, RoleLevel
from backoffice.utils.exceptions import EntityNotFound, UnAuthorized, IsNotOwner
class GroupLogic():
"""
Group business logic.
Methods:
create(): create a new group
... | StarcoderdataPython |
4838384 | <reponame>wqt2019/tacotron-2_wavernn
from wavernn_vocoder.utils.dataset import get_vocoder_datasets
from wavernn_vocoder.utils.dsp import *
from wavernn_vocoder.models.fatchord_version import WaveRNN
from wavernn_vocoder.utils.paths import Paths
from wavernn_vocoder.utils.display import simple_table
import torch
import... | StarcoderdataPython |
3399537 | <reponame>vanburgerberg/constypes
from .abc import Parser, TypedParser
from .exception import NoParserFoundError, ParsingError
from .parser import collection
__all__ = ["Parser", "TypedParser", "ParsingError", "NoParserFoundError", "parse"]
parse = collection.parse
| StarcoderdataPython |
14435 | <gh_stars>1-10
from pytest import raises
from notario.validators import Hybrid
from notario.exceptions import Invalid
from notario.decorators import optional
from notario import validate
def validator(x):
assert x, 'fail'
class TestHybrid(object):
def test_use_validator_passes(self):
schema = ()
... | StarcoderdataPython |
3272302 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .svm import SVMClassifier as SVC
__all__ = [
'SVC'
]
| StarcoderdataPython |
3366276 | <gh_stars>0
#!/usr/local/bin/python3
# encoding=utf-8
import datetime
import os
import threading
def execCmd(cmd):
try:
print("命令%s开始运行%s" % (cmd, datetime.datetime.now() ))
os.system(cmd)
print("命令%s结束运行%s" % (cmd, datetime.datetime.now()))
except Exception as e: #异常处理,此处声明.没有刻意... | StarcoderdataPython |
1719947 | <gh_stars>0
#!/usr/bin/env python
import curses
import time
import random
from curses import panel
from collections import deque
import sys
sys.stdout.write("\x1b]2;Vipers\x07")
curBoard = curses.initscr()
curses.cbreak()
curBoard.keypad(1)
curses.halfdelay(1)
curses.noecho()
curses.curs_set(0)
dimensions = curBoard.g... | StarcoderdataPython |
1603655 | # shows a user's playlists (need to be authenticated via oauth)
import pprint
import sys
import os
import subprocess
import spotipy
import spotipy.util as util
from Secrets import *
scope='playlist-read-private,playlist-modify-private,playlist-modify-public,playlist-read-collaborative,user-modify-playback-state,use... | StarcoderdataPython |
169580 | <gh_stars>0
import unittest
from hostphot.cutouts import download_images
from hostphot.interactive_aperture import InteractiveAperture
class TestHostPhot(unittest.TestCase):
def test_interactivity(self):
sn_name = 'SN2004eo'
ra = 308.22579
dec = 9.92853
survey = 'PS1'
down... | StarcoderdataPython |
1630275 | import pandas as pd
from technical_indicators.technical_indicators import trades_to_candles, moving_average, rate_of_change
from technical_indicators.technical_indicators import bollinger_bands, average_true_range, stochastic_oscillator
from technical_indicators.technical_indicators import trix
from db_connection.db_c... | StarcoderdataPython |
4837633 | #
# This file contains the Python code from Program 4.13 of
# "Data Structures and Algorithms
# with Object-Oriented Design Patterns in Python"
# by <NAME>.
#
# Copyright (c) 2003 by <NAME>, P.Eng. All rights reserved.
#
# http://www.brpreiss.com/books/opus7/programs/pgm04_13.txt
#
class LinkedList(object):
def p... | StarcoderdataPython |
4938 | <filename>ng/distributions/Distribution.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
from enum import Enum
from .NormalDist import NormalDist
from .UniformDist import UniformDist
class Distribution(Enum):
UNIFORM = 0
GAUSSIAN = 1
POISSON = 2
@staticmethod
def determ... | StarcoderdataPython |
1754870 | <gh_stars>100-1000
"Reading and writing of scalepack merge reflection files."
from __future__ import absolute_import, division, print_function
# Sample scalepack OUTPUT FILE
# 1
# -987
# 34.698 71.491 54.740 90.000 106.549 90.000 p21
# 0 0 4 3617.6 287.2
# 0 1 6 12951.7 1583.6 12039... | StarcoderdataPython |
3249083 | <reponame>nicksnickers/miscellaneous<filename>freefall.py
# Program for calculating the free fall time w/o air resistance at 9.8 m/s given the distance.
import math
def falltime(d):
x = float(d)/4.9
t = math.sqrt(x)
return t
print("This program calculates the time for free fall based on the di... | StarcoderdataPython |
1798980 | <reponame>ministryofjustice/moj-product-dashboard<filename>dashboard/settings/base.py
"""
Django settings for dashboard project.
Generated by 'django-admin startproject' using Django 1.9.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and... | StarcoderdataPython |
3226326 | def test():
assert (
"doc1.similarity(doc2)" or "doc2.similarity(doc1)" in __solution__
), "Compares-tu la similarité entre les deux docs ?"
assert (
0 <= float(similarity) <= 1
), "La valeur de similarité doit être un nombre flottant. L'as-tu calculé correctement ?"
__msg__.good("Bi... | StarcoderdataPython |
1608468 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from dataclasses import dataclass, field
import numpy as np
from typing import List
from tqdm import tqdm
from load_halo import LoadHalo
@dataclass
class BinHalo(LoadHalo):
"""Divide halo into bins."""
nr_bins: int = 102
r_middle: float = 10 ** 1.3
r_cut_min: f... | StarcoderdataPython |
3337799 | from drawengine import *
from readscreen import *
import screens
class Catalog:
last_tale = 0
search_text = ''
def __init__(self, to_overview = False):
self.window = Singleton.window
self.color = [Color(200, 80, 80), Color(250, 180, 180)]
self.toshow = [(self.show, 0.5... | StarcoderdataPython |
1751748 | <filename>libraries/ShuffleboardGenerator/lib/template_helpers.py
from jinja2 import Template
import re
import os
def _lower_first_char(input_str):
if len(input_str) == 0:
raise Exception("Cannot use an empty string for a field name!")
return input_str[0].lower() + input_str[1:]
def camel_to_snake(... | StarcoderdataPython |
3330832 | """
This runs tests for brod's ZooKeeper Producer and Consumer. It actually starts
an instance of ZooKeeper and multiple instances of Kafka. Since it's meant to
run during development, it runs these servers on different ports and different
locations from the application defaults, to avoid conflicts.
Current assumptio... | StarcoderdataPython |
1653535 | import logging
import inspect
import json
import os
import urlparse
import pylons.config as config
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
import ckanext.hdx_theme.helpers.auth as auth
from ckanext.hdx_theme.helpers.redirection_middleware import RedirectionMiddleware
from ckanext.hdx_th... | StarcoderdataPython |
3330799 | <reponame>lesiavl/simple_openprocurement_document_service_test
import requests
import json
from requests.auth import HTTPBasicAuth
import hashlib
import unittest
url = 'https://upload.docs-sandbox.openprocurement.org'
register_suffix = '/register'
auth = HTTPBasicAuth('<EMAIL>', '<PASSWORD>')
file_bytes = open('some_f... | StarcoderdataPython |
3358141 | import os
import cv2
import time
import numpy as np
import torch
import torchvision.transforms.functional as TF
from model.lpr import BiSeNet
import argparse
def isEqual(labelGT, labelP, num_char):
compare = [1 if int(labelGT[i]) == int(labelP[i]) else 0 for i in range(num_char)]
return sum(compare)
def tra... | StarcoderdataPython |
126520 | import numpy as np
import sympy as sp
from devitoboundary.symbolics.symbols import a, n, n_max
def standard_stencil(deriv, space_order, offset=0., as_float=True):
"""
Generate a stencil expression with standard weightings. Offset can be
applied to this stencil to evaluate at non-node positions.
Param... | StarcoderdataPython |
37468 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#=======================================================================
#
# day_1.py
# --------
# Solution for Advent of code 2017, day 1.
# http://adventofcode.com/2017/day/1
#
# Status: Done.
#
# <NAME> 2017
#
#===========================================================... | StarcoderdataPython |
169530 | # Generated by Django 2.1.5 on 2019-06-22 14:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hora_extra", "0003_auto_20190208_0020"),
]
operations = [
migrations.AddField(
model_name="horaextra",
name="horas",... | StarcoderdataPython |
3210477 | from Tkinter import *
import tkFont
import win32api
import win32print
import pyodbc
from fpdf import FPDF
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()
arial18 = tkFont.Font(family='Arial', size=18, weight='bold') # big font so we can read it in the shop
... | StarcoderdataPython |
3272014 | import numpy as np
from sklearn.metrics import adjusted_rand_score
from pygkernels.cluster import KKMeans
from pygkernels.data import StochasticBlockModel
from pygkernels.measure import logComm_H
from pygkernels.scenario import ParallelByGraphs
n_graphs, n, k, p_in, p_out = 100, 100, 2, 0.3, 0.1 # params for G(n (k)... | StarcoderdataPython |
3249984 | <reponame>ahartikainen/pyinfraformat
"""General information concerning Finnish Infraformat."""
import logging
import numpy as np
__all__ = ["identifiers", "print_info"]
logger = logging.getLogger("pyinfraformat")
def is_number(number_str):
"""Test if number_str is number including infraformat logic."""
try... | StarcoderdataPython |
188290 | <filename>controller/SnesMappings.py
from enum import IntEnum
class SNESButtons(IntEnum):
X = 0
A = 1
B = 2
Y = 3
L_BUMPER = 4
R_BUMPER = 5
SELECT = 8
START = 9
class SNESAxes(IntEnum):
HORIZONTAL = 0
VERTICAL = 1
# the mappings are different on windows for some reason
clas... | StarcoderdataPython |
43059 | #
# GeomProc: geometry processing library in python + numpy
#
# Copyright (c) 2008-2021 <NAME> <<EMAIL>>
# under the MIT License.
#
# See file LICENSE.txt for details on the copyright license.
#
"""This module contains the implicit function class of the GeomProc
geometry processing library used for defining implicit fu... | StarcoderdataPython |
1663459 | <reponame>PraghadeshManivannan/Python
n = int(input("Enter the number of days :"))
a = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
print((n//365),"years",(n//7)%52,"weeks",(a[n%7]))
| StarcoderdataPython |
3221395 | <reponame>smsahu/seldon-server<gh_stars>1-10
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_selection import SelectKBest, chi2
from sklearn.base import BaseEstimator,TransformerMixin
import logging
import time
import logging... | StarcoderdataPython |
56714 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 21 13:52:07 2019
@author: Administrator
train.py: 训练模型
"""
from Unet import Unet
import LoadBatches1D
import tensorflow as tf
import keras
from keras import optimizers
import warnings
import matplotlib.pyplot as plt
gpu_options = tf.GPUOptions(allow_growth=True)
sess ... | StarcoderdataPython |
1634280 | def f(i):
xs = []
xs[i].items()
def g(index):
x = [][index]
x['foo']
| StarcoderdataPython |
3259400 | from django.db import models
from datetime import datetime
from django.db.models.signals import post_save, pre_save, post_delete
COLOR_CHOICES = [
('blue', 'Blue'),
('green', 'Green'),
('black', 'Black'),
]
FEATURED = [
(0, 'No'),
(1, 'Everwhere'),
(2, 'Category-only')
]
# Create your models here.
... | StarcoderdataPython |
26224 | <filename>lista_ex3.1.py/exercicio23.py
''' 23. Faça um programa que receba o valor do salário mínimo, o turno de trabalho (M
— matutino; V — vespertino; ou N — noturno), a categoria (O — operário; G —
gerente) e o número de horas trabalhadas no mês de um funcionário. Suponha a
digitação apenas de dados válidos e, quan... | StarcoderdataPython |
34263 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from documents.tests.utils import generate_random_documents
from categories.models import Category
class Command(BaseCommand):
args = '<number_of_documents> <category_id>'
help = 'Creates a given number of random d... | StarcoderdataPython |
125039 | <reponame>searayeah/sublime-snippets<filename>Courses/HyperskillPython/Password Hacker/4.py
import json
import sys
import socket
import itertools
import string
args = sys.argv
letters = string.ascii_uppercase + string.ascii_lowercase + string.digits
def generator():
for letter in letters:
yield letter
... | StarcoderdataPython |
3211070 | <gh_stars>0
import webapp2
from config.config import _TEMP_SECRET
__author__ = 'Lorenzo'
class Crawling(webapp2.RequestHandler):
"""
/database/crawling/store POST: Service handler for operations on crawled resources
"""
def post(self):
self.response.headers['Access-Control-Allow-Origin'] = '*... | StarcoderdataPython |
4824974 | <gh_stars>0
"""
Code based on solution https://gist.github.com/joshbode/569627ced3076931b02f
"""
import logging
import os
from typing import IO, Any
import yaml
from scanapi.errors import EmptyConfigFileError
logger = logging.getLogger(__name__)
class Loader(yaml.SafeLoader):
"""YAML/JSON Loader with `!includ... | StarcoderdataPython |
43839 | <reponame>cuenca-mx/facturapi-python
import pytest
@pytest.fixture
def facturapi_creds(monkeypatch) -> None:
monkeypatch.setenv('FACTURAPI_KEY', 'some_api_key')
| StarcoderdataPython |
3266901 | <reponame>kaflesudip/faker
# coding=utf-8
from __future__ import unicode_literals
from ..internet import Provider as InternetProvider
import re
class Provider(InternetProvider):
user_name_formats = (
'{{last_name_female}}.{{first_name_female}}',
'{{last_name_male}}.{{first_name_male}}',
... | StarcoderdataPython |
1723065 | from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (QGridLayout, QSizePolicy, QToolBar, QToolButton,
QWidget)
from .ribbon import Ribbon
class ToolbarRibbon(Ribbon):
"""A ribbon with helpers for containing toolbars
"""
def add_toolbar(self, title=None, toolbar=None):
... | StarcoderdataPython |
3329333 | <filename>vpv/model/coordinate_mapper.py
from vpv.common import Orientation
import numpy as np
from vpv.display.slice_view_widget import SliceWidget
flip_to_axial_order = {
# The order of the source dimensions after mapping to axial space
# For example [2, 1, 0] reverses the dimension ordering as we are using
... | StarcoderdataPython |
1709714 | <reponame>DarishkaAMS/Flask_Projects-EPAM-CRM
"""
This module consists of the:
- Employee class to work with the `employees` table
- Role class to work with the `roles` table
- UserRoles class to work with the `employees_roles` table
- load_user function to return Employee by the specified employee's id
"""
from f... | StarcoderdataPython |
3299812 | <reponame>XxuChen/Capsule-Specific-Attacks<filename>notebooks/capsule_specific_attacks/norm_based/loose_layout/utils.py
"""
Utility file functions
"""
import os
from glob import glob
MNIST_CATEGORIES = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
CIFAR10_CATEGORIES = ['airplane', 'automobile', 'bird', 'cat', ... | StarcoderdataPython |
1617280 | from django.urls import path, include
from . import views
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
urlpatterns = [
path('', views.index, name="index"),
path('home', views.stores, name="home"),
path('accounts/sign_up/', views.sign_up, ... | StarcoderdataPython |
3213440 | <gh_stars>0
from __future__ import annotations
import pyglet
from pyglet import clock
from pyglet import resource
from pyglet.graphics import Batch
from pyglet.text import Label
from pyglet.window import Window, key
from game.level import Level, BlockPlace, Player
from game.settings import Settings
from game.utility ... | StarcoderdataPython |
3282868 | <reponame>viggy96/Flexget
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import os
import logging
from requests import Session
from requests.exceptions import RequestException
from flexget import plugin
from flexget.e... | StarcoderdataPython |
98769 | <filename>Curso-python/aula008/Exerciocio8..py
q1 = float(input('Insira o valor de Q1: '))
q2 = float(input('Insira o valor de Q2: '))
d = float(input('Insira o valor de D: '))
print(9000000000*q1*q2/d**2) | StarcoderdataPython |
3312833 | import pygatt
import struct
adapter = pygatt.GATTToolBackend()
def print_data(handle, value):
print("Received data: %s" % struct.unpack('f', value)[0])
try:
adapter.start()
device = adapter.connect('c7:36:e0:31:ab:ae',
address_type=pygatt.BLEAddressType.random)
print(device)
#device.... | StarcoderdataPython |
1700082 | <reponame>Coffee-Meets-Bagel/python-leanplum
import logging
__all__ = ["Logger"]
def new_default_logger():
return Logger()
class Logger(object):
def __init__(self, name="leanplum", level="DEBUG"):
self._logger = logging.getLogger(name)
self._logger.setLevel(level)
def set_level(self, ... | StarcoderdataPython |
1738762 | # SETUP ------------------------------------------------------------------------
import sys
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow.keras.layers import Activation, Conv2D, MaxPooling2D, UpSampling2D
from tensorflow.keras.preprocessing.image import load_img
# Set base filepath. I... | StarcoderdataPython |
3278049 | <gh_stars>0
import notion
import os
from notion import block
from notion2md.converter import PageBlockConverter
import json
# convert page block to markdown string
def convert_cli(block, blog_mode):
# 1. initialize converter
converter = PageBlockConverter(block, blog_mode=blog_mode)
# 2. export the markd... | StarcoderdataPython |
84398 | a = [5, 4, 8, 3, 4, 14, 90, 45, 9, 3, 2, 4]
for i in range(len(a), 0, -1):
for j in range(0, i - 1):
if a[j] > a[j + 1]:
a[j], a[j + 1] = a[j + 1], a[j]
print(a) | StarcoderdataPython |
1774136 | <reponame>kendrick90/iPERCore<filename>iPERCore/tools/utils/visualizers/skeleton_visualizer.py
# Copyright (c) 2020-2021 impersonator.org authors (<NAME> and <NAME>). All rights reserved.
import numpy as np
import cv2
from tqdm import tqdm
from ..multimedia.video import convert_avi_to_mp4
colors = {
"pink": [19... | StarcoderdataPython |
1696681 | <filename>src/Main/DispatcherBase.py
import subprocess
class Dispatcher(object):
def __init__(self, disallowedOptions, optionalOptions, requiredOptions):
self.disallowedOptions = disallowedOptions
self.optionalOptions = optionalOptions
self.requiredOptions = requiredOptions
def ParseOp... | StarcoderdataPython |
3356711 | <reponame>ltiao/gp-dre<gh_stars>0
import tensorflow as tf
from abc import ABC, abstractmethod
from tensorflow.keras.regularizers import l1_l2
from ...base import MLPDensityRatioEstimator
from ...math import logit
# from .initializers import KMeans
# kernels = tfp.math.psd_kernels
class BaseCovariateShiftAdapter(A... | StarcoderdataPython |
1651998 | #!/usr/bin/env python3
#<NAME>, 22-MAR-2018
#this command can run multiple times for a stack
#example command
#../../code/s1_select_ion.py -dir . -sn 34/38.5 -nr 5
import os
import sys
import glob
import shutil
import zipfile
import argparse
import datetime
import numpy as np
import xml.etree.ElementTree as ET
cla... | StarcoderdataPython |
3206243 | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-04-27 09:34
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ktapp', '0071_linkclick'),
... | StarcoderdataPython |
189161 | import torch
from torch.optim.optimizer import Optimizer
import math
class Tom(Optimizer):
def __init__(self, params, lr=1e-3, betas=(0.9, 0.99,0.999), eps=1e-8,
weight_decay=0, amsgrad=False, use_bias_correction_for_level_trend=False):
if not 0.0 <= lr:
raise ValueError("Inva... | StarcoderdataPython |
1668086 | <filename>dcp/031/solution.py
# -*- coding: utf-8 -*-
def edit_distance(word1, word2):
if word1 == word2:
return 0
elif not word1:
return len(word2)
elif not word2:
return len(word1)
if word1[0] == word2[0]:
return edit_distance(word1[1:], word2[1:])
return 1 + min... | StarcoderdataPython |
1683356 | <reponame>mstrumeck/saleor-app-framework-python
from pathlib import Path
from pydantic import BaseSettings, DirectoryPath
from saleor_app.schemas.core import SaleorPermissions
from saleor_app.schemas.manifest import Extension, Manifest, MountType, TargetType
from saleor_app.schemas.utils import LazyUrl
PROJECT_DIR =... | StarcoderdataPython |
53044 | <reponame>peterbencze/silene<filename>silene/crawler_configuration.py
# Copyright 2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | StarcoderdataPython |
3263795 | <gh_stars>0
import unittest
from unittest import mock
import commands.modifycommand as modifycommand
import filters.confirmfilter as confirmfilter
class ModifyCommandTests(unittest.TestCase):
def test_constructor_sets_properties(self):
mock_context = mock.Mock()
mock_filter = mock.Mock()
... | StarcoderdataPython |
188331 | <reponame>Jackbytes/pycolate
# python3 setup.py bdist_wheel
# twine upload dist/*
import numpy as np
from pycolate.grid_engine import grid
from colorsys import hsv_to_rgb
from scipy.ndimage import measurements
import scipy.ndimage as ndimage
from random import shuffle
import PIL
CRIT_PROB = 0.59274621
class Percolat... | StarcoderdataPython |
3237755 | <filename>contracting_process/resource_level/reference/contract_in_awards.py
from tools.checks import get_empty_result_resource
from tools.getter import get_values
version = 1.0
def calculate(item):
result = get_empty_result_resource(version)
if not item or "awards" not in item or "contracts" not in item:
... | StarcoderdataPython |
1639639 | <reponame>nsg-ethz/tekton<filename>setup.py
#!/usr/bin/env python
import os
from distutils.core import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='Tekton',
version='0.1',
description='Annotated Computer Network Graph',
author='<NAME>',
au... | StarcoderdataPython |
3268992 | <reponame>brexhq/pyrefchecker<gh_stars>0
from .block_scope_provider import monkeypatch_nameutil
from .check import (
BaseRefWarning,
BaseWarning,
ImportStarWarning,
NoLocationRefWarning,
RefWarning,
check,
)
__version__ = "1.0.0"
| StarcoderdataPython |
3278609 | <filename>utils/configtable.py
import asyncio
import logging
log = logging.getLogger(__name__)
class ConfigTableRecord(object):
_data = dict()
def __init__(self, config, record):
self._config = config
self._data = dict()
self._dirty = set()
for key, value in record.items():
self._data[key] = value
... | StarcoderdataPython |
190458 | <filename>packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-basic/TestBasicVector.py
"""
Test basic std::vector functionality.
"""
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestBasicVector(TestBase):
mydir = T... | StarcoderdataPython |
1760072 | <gh_stars>1-10
from kipro2.characteristic_functional import CharacteristicFunctional
from pysmt.shortcuts import get_env, Symbol, Implies, And, Not, Equals, Function, Or, GT, FunctionType
from kipro2.pysmt_extensions.simplifier import Simplifier
from kipro2.pysmt_extensions.euf_substituter import EUFMGSubstituter
from ... | StarcoderdataPython |
1665938 | <filename>libs/casadi-linux-py27-58aa427/casadi/casadi.py
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.11
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_i... | StarcoderdataPython |
1757830 | """Project Palette
- version -
python=3.9.7
bs4=4.10.0
pandas=1.3.4
pillow=8.4.0
requests=2.26.0
code by DeneV
"""
from tkinter import *
import tkinter.ttk as ttk
from tkinter.tix import *
from PIL import ImageTk
from palette.functions import *
class App(Tk):
def __init__(self):
Tk.__init__(self)
... | StarcoderdataPython |
3202635 | <reponame>carloss79/pyhton2020AProjectLibrosa
import librosa
import soundfile
import os, glob, pickle
import numpy as np
import subprocess
from sklearn.model_selection import train_test_split
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import accuracy_score
from tkinter import messagebox
from ... | StarcoderdataPython |
1640116 | <gh_stars>1-10
from zeit.cms.i18n import MessageFactory as _
import grokcore.component as grok
import hashlib
import zeit.cms.browser.interfaces
import zeit.cms.browser.tree
import zeit.cms.browser.view
import zeit.cms.interfaces
import zeit.cms.repository.interfaces
import zeit.cms.workingcopy.interfaces
import zope.c... | StarcoderdataPython |
3352541 | <filename>meross_iot/controller/mixins/system.py<gh_stars>0
import logging
from typing import Optional
from meross_iot.model.enums import Namespace, OnlineStatus
_LOGGER = logging.getLogger(__name__)
class SystemAllMixin(object):
_execute_command: callable
#async_handle_update: Callable[[Namespace, dict], A... | StarcoderdataPython |
1798395 | import glob
class getItens:
def __init__(self):
self.fileList = []
def getFile(self, path):
self.fileList = [f for f in glob.glob(path+'/entrance/'+'*.png')]
return self.fileList
| StarcoderdataPython |
3334700 | <gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
__author__ = 'Du'
import sys
# query = sys.argv[1]
simulatorFileName = "simulators"
appPathFileName = "appPath"
appBundleIDFileName = "bundleID"
simulatorDescSeparator = '|'
fbCommand = '/usr/local/bin/fbsimctl'
def addSimulator(simulatorID):
if... | StarcoderdataPython |
1734878 | <filename>src/marks.py
# Copyright (c) 2015, <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:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of ... | StarcoderdataPython |
1700632 | import random
import discord
from discord import member
from discord.ext import commands
class admin(commands.Cog):
def __init__(self, bot):
self.bot = bot
# pick an random user to giveaway
@commands.command()
@commands.has_permissions(administrator=True)
@commands.guild_only()
asyn... | StarcoderdataPython |
52541 | <gh_stars>10-100
from django.db import models
from django.utils.translation import ugettext_lazy as _
class MirrorSite(models.Model):
enabled = models.BooleanField(default=False)
name = models.CharField(max_length=64)
url = models.CharField(max_length=255, unique=True)
def __unicode__(self):
r... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.