id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11329009 | <reponame>d-asnaghi/bazel-rust-embedded
""" Transitive dependencies for Rust Embedded Tools """
load("@rust_embedded//crates:crates.bzl", "raze_fetch_remote_crates")
load("@rules_rust//rust:repositories.bzl", "rust_repositories")
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
def rust_embedded_deps()... | StarcoderdataPython |
8112102 | <filename>amp_app/app_config.py
import os
from dotenv import load_dotenv
# Load the values from .env file
dotenv_path = os.path.join(os.path.dirname(__file__), '.env') # Path to .env file
load_dotenv(dotenv_path)
# Our Quickstart uses this placeholder
# In your production app, we recommend you to use other ways to s... | StarcoderdataPython |
6625911 | import os
import time
# Deploy environmet
for i in range(10):
print(f"[+] Deploy test{i}")
os.system(f"tk apply environments/consensus --dangerous-auto-approve --name=test{i}")
print("[+] Wait for pods to be up")
os.system("kubectl wait -n default --for=condition=Ready pod --all")
print("[+] Wait 30s")
time... | StarcoderdataPython |
6651222 | <gh_stars>1-10
#coding=utf-8
#使用OrderedDict P160 2017.4.20
from collections import OrderedDict
languages = OrderedDict()
languages['jen'] = 'python'
languages['sarah'] = 'c'
languages['edward'] = 'ruby'
languages['phil'] = 'c++'
for name,language in languages.items():
print(name.title()+"--"+language.title())
xyz = {... | StarcoderdataPython |
388478 | <reponame>ancow/snakemq
# -*- coding: utf-8 -*-
"""
:author: <NAME> (<EMAIL>)
:license: MIT License (see LICENSE.txt or
U{http://www.opensource.org/licenses/mit-license.php})
"""
import threading
from collections import deque
# TODO utilize io module
########################################################... | StarcoderdataPython |
3315748 | <filename>ex038.py
v1 = int(input('Digite um valor: '))
v2 = int(input('Digite outro valor: '))
if v1 > v2:
print('O primeiro valor {} é o maior'.format(v1))
elif v2 > v1:
print('O segundo valor {} é o maior'.format(v2))
else:
print('NÃO EXISTE um valor maior, os dois são iguais') | StarcoderdataPython |
11378621 | '''Sudoku Solver Main Module'''
import tkinter
from tkinter import ttk # Used for scrollbar
from tkinter import messagebox # Used for message boxes
from tkinter import filedialog # Used for opening the file dialog box
import copy # Used for creating copies of variables instead of instances
import threading # Multit... | StarcoderdataPython |
3524060 | <filename>src/the_tale/the_tale/game/heroes/admin.py<gh_stars>0
import smart_imports
smart_imports.all()
class HeroAdmin(django_admin.ModelAdmin):
list_display = ('id', 'name', 'clan_id', 'is_alive', 'health', 'account')
readonly_fields = ('created_at_turn', 'saved_at_turn', 'saved_at', 'account')
def ... | StarcoderdataPython |
1873590 | <filename>vujade/vujade_yaml.py
"""
Dveloper: vujadeyoon
E-mail: <EMAIL>
Github: https://github.com/vujadeyoon/vujade
Title: vujade_videocv.py
Description: A module for yaml.
"""
import yaml
class vujade_yaml():
def __init__(self, _path_filename):
super(vujade_yaml, self).__init__()
self.path_fi... | StarcoderdataPython |
5147223 | <reponame>aogunwoolu/HRDL<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
# changes the matplotlib's figure to black (optional)
style.use('dark_background')
class TradingGraph:
def __init__(self, dfs, title=None):
self.dfs = dfs
# Needed to ... | StarcoderdataPython |
11396644 | #!/usr/bin/env python3
# <NAME>
# based off of Tdulcet's 'mprime.exp'
# Python3 exp.py <User ID> <Computer name> <Type of work> <idle time to run>
# Note: * pexpect has quirks about nonempty ()s (e.g., (y)), *s, inline ''s, or +s.
import sys
from time import sleep
import subprocess
# Potentially installing dependen... | StarcoderdataPython |
152533 | <reponame>ergs/transmutagen
try:
from . import py_solve
del py_solve
except ImportError:
raise ImportError("Run 'python -m transmutagen.gensolve --py-solve' and 'setup.py build_ext --inplace' to generate the module")
from .py_solve import (N, NNZ, IJ, NUCS, NUCS_IDX, ROWS, COLS, ones,
flatten_sparse_ma... | StarcoderdataPython |
9785893 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cv2
img = cv2.imread(r'd:\flappybird\atlas.png')
cv2.namedWindow('Image')
cv2.imshow('Image',img)
cv2.waitKey(0)
cv2.destroyAllWindows() | StarcoderdataPython |
5004481 | from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework.exceptions import NotFound
# from rest_framework.permissions import IsAuthenticatedOrReadOnly, IsAuthenticated
from .models import Stock
from .serializers.common import StockSe... | StarcoderdataPython |
1997979 | <gh_stars>0
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import os
import random
import datetime
import re
import math
import logging
from collections import OrderedDict
import multiprocessing
import numpy as np
import tensorflow as tf
import tensorflow.keras
import tensorflow.keras.b... | StarcoderdataPython |
5032669 | <filename>src/infi/asi/cdb/control.py
from infi.instruct import *
from infi.instruct.buffer import Buffer, bytes_ref, be_int_field
# sam5r07: 5.2 (page 70)
class Control(Struct):
_fields_ = BitFields(
BitPadding(2), # 0-1: obsolete
BitField("naca", 1),
BitPadding(3), # 3-5: reserved
... | StarcoderdataPython |
8093276 | <filename>01/01.py
print('Hola, mundo!')
| StarcoderdataPython |
3593261 | import pytest
from unittest import mock
from django.core.exceptions import ValidationError
from awx.main.models import (
UnifiedJob,
InventoryUpdate,
InventorySource,
)
def test_cancel(mocker):
with mock.patch.object(UnifiedJob, 'cancel', return_value=True) as parent_cancel:
iu = InventoryUp... | StarcoderdataPython |
392239 | """Contains classes and functions related to patterns/transformations.
"""
from __future__ import print_function
import copy
import dace
import inspect
from typing import Dict
from dace.sdfg import SDFG, SDFGState
from dace.sdfg import utils as sdutil, propagation
from dace.sdfg.graph import SubgraphView
from dace.pro... | StarcoderdataPython |
8163740 | <reponame>dhruvmanila/remove-print-statements
from pathlib import Path
from click.testing import CliRunner
from remove_print_statements import main
def test_noop() -> None:
runner = CliRunner()
result = runner.invoke(main)
assert result.exit_code == 0
assert not result.stdout_bytes
assert not r... | StarcoderdataPython |
378154 | <gh_stars>1-10
#!/usr/bin/env python3
class Solution:
def groupAnagrams(self, strs):
"""
:type strs: List[str]
:rtype: List[List[str]]
"""
d = {}
for w in sorted(strs):
k = tuple(sorted(w))
d[k] = d.get(k, []) + [w]
return list(d.values... | StarcoderdataPython |
9690894 | import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while True:
_, frame = cap.read()
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
lower_red = np.array([150,150,50])
upper_red = np.array([180,255,150])
mask = cv2.inRange(hsv, lower_red, upper_red)
res = cv2.bitwise_and(frame, fra... | StarcoderdataPython |
38723 | <reponame>M2I-HABET/ahac2020workshop
import rot2proG
import serial
import math
import time
import requests
from queue import Queue
from threading import Thread
def _parse_degrees(nmea_data):
# Parse a NMEA lat/long data pair 'dddmm.mmmm' into a pure degrees value.
# Where ddd is the degrees, mm.mmmm is the min... | StarcoderdataPython |
5016202 | <gh_stars>0
import csv
import json
import argparse
import os.path
from LogManager import logger, initConsoleLogging
CSV_FIELD_MAP = [
('IA #', 'number'),
('NAME', 'name'),
('TYPE', 'type'),
('DATE CREATED', 'date'),
('STATUS', 'status')
]
""" This python module will convert ICR Json file into Cs... | StarcoderdataPython |
27270 | from mbus.record import ValueRecord
from machine import RTC
import ubinascii
import random
import time
import re
class MBusDevice:
"""Class that encapulates/emulates a single MBus device"""
def __init__(self, primary_address, secondary_address, manufacturer, meter_type):
self._primary_address = primary... | StarcoderdataPython |
9757495 | import tensorflow as tf
from tensorflow import DType
NODE_FEATURES = 'node_features'
EDGE_FEATURES = 'edge_features'
def TensorGraph(node_features, edge_features):
"""Returns a tensor graph instance.
This function simply returns a dictionary with the relevant structure
to represent a graph of Tensorflow... | StarcoderdataPython |
9627366 | <reponame>adamkrekorian/Patient-Monitoring-Station-BME547<filename>test_monitor_gui.py
import pytest
import base64
import io
import os
from matplotlib import pyplot as plt
import matplotlib.image as mpimg
import filecmp
@pytest.mark.parametrize('filename', [
("images/acl1.jpg"),
("images/acl2.jpg"),
("ima... | StarcoderdataPython |
8046223 | <reponame>samwel-chege/Neighborhood
# Generated by Django 3.2.7 on 2021-09-27 08:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('neighbourhood', '0002_auto_20210925_0016'),
]
operations = [
migrations.RenameField(
model_name='res... | StarcoderdataPython |
3203918 | class Lock:
""" synchronous lock that does not block"""
def __init__(self):
self._locked = False
def acquire(self):
if self._locked:
return False
else:
self._locked = True
return True
def locked(self):
return self._locked
def re... | StarcoderdataPython |
6555281 | from facenet_pytorch import InceptionResnetV1
from torch.utils.data import Dataset
from torch.utils.data import DataLoader
import numpy as np
import torch
import natsort
from PIL import Image
from pathlib import Path
import logging
logger = logging.getLogger(__name__)
from torchvision.transforms import functional as F
... | StarcoderdataPython |
6499963 | import logging
from django.conf import settings
from django.core.urlresolvers import reverse
import httplib
import urllib
from eulfedora import models, server
from eulxml.xmlmap.dc import DublinCore
from pidservices.clients import parse_ark
from pidservices.djangowrapper.shortcuts import DjangoPidmanRestClient
from r... | StarcoderdataPython |
8111759 | <filename>profiler/image_classification/models/layers.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import torch
import torch.nn as nn
import torchmodules.torchgraph as torchgraph
class SeparableConv2d(nn.Sequential):
def __init__(self, in_channels, out_channels, dw_kernel, dw_stri... | StarcoderdataPython |
11382917 | <reponame>jejjohnson/pysim<filename>pysim/information/kde.py<gh_stars>1-10
from typing import Optional, Union, Dict, List
import numpy as np
import statsmodels.api as sm
from sklearn.utils import check_array
def kde_entropy_uni(X: np.ndarray, **kwargs):
# check input array
X = check_array(X, ensure_2d=True)
... | StarcoderdataPython |
9639213 | <reponame>abraaogleiber/Python_Procedural_OrientadoO
#__________________ Script Python - versão 3.8 _____________________#
# Autor |> <NAME>
# Data |> 18 de Março de 2021
# Paradigma |> Orientado à objetos
# Objetivo |> Desenvolver um algoritmo que consiga calcular raízes
# de equações do 2ºGrau
#____... | StarcoderdataPython |
8109377 | from FacebookWebBot import *
import os, json, random, jsonpickle
from Spam import spam
from loginInfo import Info
posts_=[]
selfProfile = "https://mbasic.facebook.com/profile.php?fref=pb"
grups = ["https://mbasic.facebook.com/groups/830198010427436",
"https://m.facebook.com/groups/1660869834170435",
... | StarcoderdataPython |
1600518 | <filename>getPrices.py
'''
Created on Jun 2, 2014
@author: vidurjoshi
'''
from pandas.io import parsers
from datetime import datetime
def make_url(ticker_symbol,start_date, end_date):
print ticker_symbol
base_url = "http://ichart.finance.yahoo.com/table.csv?s="
a = start_date
b = end_date
dt_u... | StarcoderdataPython |
8126611 | import torch
from torch import nn
import torch.nn.functional as F
from .pooling import ChannelPool
class ChannelAttention(nn.Module):
def __init__(self, in_planes, ratio=12):
super().__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.max_pool = nn.AdaptiveMaxPool2d(1)
self.fc... | StarcoderdataPython |
4952589 | <reponame>rpitchumani/s-3500
"""
Class to read exported Microtrac 3500 Particle Analysis CSV File
2022, <NAME>
"""
from typing import List, Dict, Any
import pandas as pd
import numpy as np
class S3500:
def __init__(self, path_csv: str):
self.path_csv = path_csv
self.df = pd.read_csv(path_csv,
... | StarcoderdataPython |
1708723 | <gh_stars>1-10
from pprint import pprint
from random import randint
tab1 = [[table * i for i in range(11)] for table in range(11)]
#pprint(tab1)
keno = [[5 * l + (i + 1) for i in range(5)] for l in range(14)]
for _ in range(3):
keno[randint(0, 13)][randint(0, 4)] = "X"
pprint(keno)
| StarcoderdataPython |
11211452 | # You have a number and you need to determine which digit in this number is the biggest.
#
# Input: A positive int.
#
# Output: An Int (0-9).
#
# Example:
def max_digit(number: int) -> int:
# your code here
maxnumber = 0
for x in str(number):
if int(x) > maxnumber: maxnumber = int(x)
return m... | StarcoderdataPython |
1854326 | <gh_stars>0
import adventofcode
def fuel_required(mass):
"""
>>> fuel_required(12)
2
>>> fuel_required(14)
2
>>> fuel_required(1969)
654
>>> fuel_required(100756)
33583
"""
return mass // 3 - 2
def fuel_required_extra(mass):
"""
>>> fuel_required_extra(14)
2
... | StarcoderdataPython |
1732723 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Supporting functions for scraping jaap.nl
- get_max_page finds the number of summary pages to be scraped
- read_summary_page reads the houses advertised on one page
By dr.Pep, all rights reserved
"""
# Libs
import urllib.request, urllib.parse, urllib.error
fr... | StarcoderdataPython |
203131 | <gh_stars>1-10
"""
all opcodes Python3.6.0
"""
# general
NOP = 9
POP_TOP = 1
ROT_TWO = 2
ROT_THREE = 3
DUP_TOP = 4
DUP_TOP_TWO = 5
# one operand
UNARY_POSITIVE = 10
UNARY_NEGATIVE = 11
UNARY_NOT = 12
UNARY_INVERT = 15
GET_ITER = 68
GET_YIELD_FROM_ITER = 69
# two operand
BINARY_POWER = 19
BINARY_MULTIPLY = 20
BINARY_... | StarcoderdataPython |
6413693 | <filename>PyBank.py
#import modules
import pandas as pd
import numpy as np
#save file path as variable
budget1 = "budget_data_1.csv"
budget2 = "budget_data_2.csv"
#read in first file
budget1_df = pd.read_csv(budget1)
budget1_df.head()
#read in second file
budget2_df = pd.read_csv(budget2)
budget2_df.he... | StarcoderdataPython |
9649511 | # -*- coding: utf-8 -*-
"""Community-developed Python SDK for the DNA Center APIs.
Copyright (c) 2019-2020 Cisco and/or its affiliates.
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 res... | StarcoderdataPython |
8106845 | # coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... | StarcoderdataPython |
4884357 | #!/usr/bin/env python
import rospy
import actionlib
import math
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
from geometry_msgs.msg import PoseStamped, Pose, Point
waypoints = [
[(6.5, 4.43, 0.0),(0.0, 0.0, -0.984047240305, 0.177907360295)],
[(2.1, 2.2, 0.0), (0.0, 0.0, 0.0, 1.0)]
]
g_point = P... | StarcoderdataPython |
4905319 | """Testing nodes for unimpeded model development
"""
from typing import Any, Dict
import logging
import pandas as pd
from mlflow import sklearn as mlf_sklearn
from sklearn.pipeline import Pipeline as sklearn_Pipeline
import random
from copy import deepcopy
| StarcoderdataPython |
1631499 | <gh_stars>1-10
import threading, queue
import time
lock = threading.Lock()
q = queue.Queue()
c = 0
def task(i):
global c
d = 0
for v in range(100000):
d += 1
with lock:
c += d
print("Thread %s" % (i))
if __name__ == "__main__":
tasks = []
for i in range(100):
add... | StarcoderdataPython |
8159062 | <gh_stars>0
"""Find the parameters for a levels adjustment between two images."""
import concurrent.futures
from PIL import Image
import numpy as np
from scipy.optimize import curve_fit
from level import LevelsAdjustment, level_array
def match_histogram(x: np.ndarray, y: np.ndarray, *,
xtol: fl... | StarcoderdataPython |
4848015 | import numpy as np
import pandas as pd
def generate_gbm_returns(mu, sigma, samples, scenarios, random_state=0):
"""
:param mu: vector of expected returns
:param sigma: vector of variances - returns are assumed uncorrelated
:param samples: number of samples in each scenario
:param scenarios: number... | StarcoderdataPython |
12836751 | from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from django.forms import ModelForm
from danceschool.core.admin import EventChildAdmin, EventOccurrenceInline
from danceschool.core.models import Event
from danceschool.core.forms import LocationWithDataWidget
from .models import P... | StarcoderdataPython |
6614660 | <filename>Contents/Code/agents/ave.py
# coding=utf-8
import datetime
import re
from bs4 import BeautifulSoup
import requests
from .base import Base
class AVE(Base):
name = "AVEntertainments"
def get_results(self, media):
rv = []
movie_id = self.get_local_id(media)
if movie_id:
... | StarcoderdataPython |
247583 | # https://app.codility.com/demo/results/trainingUJUBFH-2H3/
def solution(X, A):
"""
DINAKAR
Clue -> Find the earliest time when the frog can jump to the other side of the river. The frog can cross only when leaves appear at every position across the river from 1 to X
[1, 3, 1, 4, 2, 3, 5, 4]
X ... | StarcoderdataPython |
4972811 | from jadlog.calcula import peso_cubagem
def test_peso_cubagem_expresso():
cubagens = peso_cubagem(72, 44, 62)
peso_cubagem_expresso = cubagens['Cubagem Expresso']
assert peso_cubagem_expresso == 32.736
def test_peso_cubagem_rodoviario():
cubagens = peso_cubagem(72, 44, 62)
peso_cubagem_rodoviari... | StarcoderdataPython |
9742354 | import csb.test as test
from csb.bio.sequence import RichSequence, SequenceTypes
from csb.bio.sequence.alignment import IdentityMatrix, SimilarityMatrix
from csb.bio.sequence.alignment import GlobalAlignmentAlgorithm, LocalAlignmentAlgorithm, AlignmentResult
@test.unit
class TestIdentityMatrix(test.Case):
d... | StarcoderdataPython |
32838 | <filename>organization/job_urls.py<gh_stars>0
from django.conf.urls import url, patterns
urlpatterns = patterns('organization.views',
url(r'^organization/(?P<organization_id>\d+)/job/create/$', 'job_create', name='job_create'),
url(r'^job/create/$', 'job_create_standalone', name='job_create_standalone'),
... | StarcoderdataPython |
6574424 | class Solution:
def exist(self, board, word):
if not word:
return True
if not board:
return False
m=len(board)
n=len(board[0])
w=len(word)-1
def dfs(i,j,k):
if (i<0) or (i>=m) or (j<0) or (j>=n):
... | StarcoderdataPython |
11235149 | import compas_rhino
from compas.datastructures import Mesh
from compas.geometry import delaunay_from_points
from compas.datastructures import trimesh_remesh
from compas_rhino.artists import MeshArtist
# get the boundary curve
# and divide into segments of a specific length
boundary = compas_rhino.rs.GetObject("Select... | StarcoderdataPython |
39445 | <reponame>EgorBlagov/l2address
import re
from abc import ABC, abstractmethod
from .utils import parse_hex, per_join
class Formatter(ABC):
def _to_clean_str(self, value, max_value):
value_str = str(hex(value))[2:]
full_mac_str = '0' * (self._hex_digits_count(max_value) -
... | StarcoderdataPython |
9756086 | <gh_stars>0
from rubygems_utils import RubyGemsTestUtils
class RubyGemsTestrubygems_tty_box(RubyGemsTestUtils):
def test_gem_list_rubygems_tty_box(self):
self.gem_is_installed("tty-box")
def test_load_tty_box(self):
self.gem_is_loadable("tty-box")
| StarcoderdataPython |
11208813 | <reponame>Mithzyl/Master-college-selecting-api<filename>Favorites/migrations/0006_auto_20210208_0945.py
# Generated by Django 3.1.5 on 2021-02-08 09:45
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
(... | StarcoderdataPython |
8039229 | from datetime import datetime
from mongoengine import *
from config import *
class UserSettings(Document):
email = EmailField(unique=True, required=True)
location = PointField() # todo: make this required
education_navigation = BooleanField()
education_support = BooleanField()
employment_navigati... | StarcoderdataPython |
4880842 | """visualization.py
draw widgets on main frame
"""
import cv2
def open_window(window_name, width, height, title):
"""Open the display window."""
cv2.namedWindow(window_name, cv2.WINDOW_NORMAL)
cv2.resizeWindow(window_name, width, height)
cv2.setWindowTitle(window_name, title)
def show_fps(img, fps):... | StarcoderdataPython |
6473794 | <filename>keras/layers/custom.py
from keras import backend as K
from .core import Dense, Lambda
from .embeddings import Embedding
class SoftAttention(Dense):
def call(self, x, mask=None):
score = self.activation(K.dot(x, self.W) + self.b)
return K.sum(x * K.dimshuffle(score, (0, 'x')), axis=1)
cl... | StarcoderdataPython |
8194973 | <reponame>annihilatorrrr/pytgbot
# -*- coding: utf-8 -*-
"""
A cli for bot api.
Supported commands are all `Bot.*` commands.
They need to be called with the parameter being json.
For the command
Custom commands to make stuff easier:
`msg <peer> <text>`
"""
from itertools import chain
import requests
from DictObject im... | StarcoderdataPython |
79460 | <filename>fdrtd/plugins/simon/accumulators/accumulator_statistics_bivariate.py
import math as _math
from fdrtd.plugins.simon.accumulators.accumulator import Accumulator
from fdrtd.plugins.simon.accumulators.accumulator_statistics_univariate import AccumulatorStatisticsUnivariate
class AccumulatorStatisticsBivariate(... | StarcoderdataPython |
9628319 | <filename>neuralocalize/utils/cifti_utils.py
import itertools
import warnings
import cifti
import nibabel as nib
import numpy as np
from . import constants, utils
class BrainMap:
"""Represent a brain map object
"""
def __init__(self, brain_map_object):
"""
Initialize from a brain map object that was loaded... | StarcoderdataPython |
4917152 | <reponame>JRC1995/Dynamic-Mem-Net-QA
# coding: utf-8
# ### LOADING PREPROCESSED DATA
#
# Loading GloVe word embeddings. Building functions to convert words into their vector representations and vice versa. Loading babi induction task 10K dataset.
# In[1]:
import numpy as np
from __future__ import division
filena... | StarcoderdataPython |
376379 | from rest_framework.fields import SerializerMethodField
from rest_framework.serializers import ModelSerializer
from ..quips import models
class CliqueSerializer(ModelSerializer):
"""Clique model serializer."""
class Meta:
model = models.Clique
fields = ["id", "slug"]
class SpeakerSerialize... | StarcoderdataPython |
9683316 | import os
import tempfile
from click.testing import CliRunner
import requests
from filmcompress import main as conv
def file2dir(dl_uri: str, path: str) -> str:
"""
Get file from URL and save it to file (basically wget)
:param dl_uri: Download URL
:return: HTTP request status code
"""
print(... | StarcoderdataPython |
3402472 | <reponame>ludwiglierhammer/pyremo<filename>tests/test_domain.py<gh_stars>0
# -*- coding: utf-8 -*-
# flake8: noqa
import pytest
import pyremo as pr
def test_domain_dataset():
eur11 = pr.remo_domain("EUR-11")
eur22 = pr.remo_domain("EUR-22")
eur44 = pr.remo_domain("EUR-44")
| StarcoderdataPython |
5093529 | <reponame>MehmetErer/anima<filename>anima/env/equalizer/toolbox.py
# -*- coding: utf-8 -*-
"""
import os
import sys
os.environ['STALKER_PATH'] = '/mnt/T/STALKER_CONFIG'
sys.path.append("/home/eoyilmaz/Documents/development/anima/anima")
sys.path.append("/home/eoyilmaz/Documents/development/anima/extra_libraries/py2")... | StarcoderdataPython |
4870734 | <gh_stars>0
"""Feature -> (categories, ids) mappings."""
import csv
import os
import yaml
from .config import get_config_path
with open(os.path.join(get_config_path(), "mappings.yml"), "r") as f:
mappings = yaml.load(f, Loader=yaml.SafeLoader)
with open(os.path.join(get_config_path(), "value_sets.yml"), "r") a... | StarcoderdataPython |
1813524 | <reponame>saadaoui-salah/Daily-Coding-Problem<gh_stars>0
"""This problem was asked by Square.
A competitive runner would like to create a route that starts and ends at his house, with the condition that the route goes entirely uphill at first, and then entirely downhill.
Given a dictionary of places of the form {loca... | StarcoderdataPython |
11242952 | # 12 - Tendo como dados de entrada a altura de uma pessoa.
# Construa um algoritmo que calcule seu peso ideal, usando a seguinte fórmula: (72.7*altura) - 58.
altura = float(input('Digite sua altura: '))
conversor = (72.7 * altura) - 58
print(f'De acordo com sua altura: {altura:.2f}m . ')
print(f'Seu peso ideal é: {co... | StarcoderdataPython |
9770273 | import argparse
import random
import time
import logging
import pymongo
import requests
from gumjabi import queue
from gumjabi.util.config import (
collections,
)
from gumjabi.util import mongo
log = logging.getLogger(__name__)
# Disable annoying "HTTP connection" log lines from the requests module
requests_... | StarcoderdataPython |
6514962 | #!/usr/bin/env python3
# Developed by <NAME> and <NAME>
# This file is covered by the LICENSE file in the root of this project.
# Brief: This demo shows how to generate the overlap and yaw ground truth files for training and testing.
import yaml
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '.... | StarcoderdataPython |
1897076 | <reponame>Allen7D/mini-shop-server
# _*_ coding: utf-8 _*_
"""
Created by Allen7D on 2018/6/16.
↓↓↓ Banner接口 ↓↓↓
"""
from app.extensions.api_docs.redprint import Redprint
from app.extensions.api_docs.v1 import banner as api_doc
from app.models.banner import Banner
from app.libs.error_code import Success, BannerExce... | StarcoderdataPython |
357697 | #!/usr/bin/python3
# Polyglot Node Server for EnvisaLink EVL 3/4 Device (DSC)
import sys
import envisalinktpi as EVL
import polyinterface
# TODO: Test Fire zone and reporitng functionality
# TODO: Add heartbeat from nodeserver
# TODO: Add shortcut arming (with #)
# TODO: Process CID events for more information
# con... | StarcoderdataPython |
3355499 | <gh_stars>0
import time
import mock
import pytest
import random
from etcd3.client import Client
from tests.docker_cli import docker_run_etcd_main
from .envs import protocol, host
from .etcd_go_cli import NO_ETCD_SERVICE, etcdctl
@pytest.fixture(scope='module')
def client():
"""
init Etcd3Client, close its c... | StarcoderdataPython |
4940375 | import argparse
import cv2
import numpy as np
from tqdm import tqdm
def get_args():
"""Gets the arguments from the command line."""
parser = argparse.ArgumentParser("Handle an input stream")
# -- Create the descriptions for the commands
i_desc = "The location of the input file"
# -- Create the arg... | StarcoderdataPython |
286708 | <gh_stars>10-100
#
# Copyright 2012-2015 <NAME>, Inc. and contributors
#
# 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 b... | StarcoderdataPython |
6455934 | # coding: utf-8
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class MeetingsConfig(AppConfig):
name = 'value.deliverables.meetings'
verbose_name = _('meetings')
def ready(self):
import value.deliverables.meetings.signals.handlers # noqa
| StarcoderdataPython |
238043 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
import matplotlib.patches as patches
import cv2
# write your script here, we recommend the above libraries for making your animation
from LucasKanadeBasis import LucasKanadeBasis
from LucasKanade import LucasKanade
# write your scrip... | StarcoderdataPython |
6657017 | <filename>Back/userprofile/urls.py
from django.urls import path
from . import views
urlpatterns = [
path("showpersonalinfo/", views.show_personal_info, name="showpersonalinfo"),
path("getpersonalinfo/", views.get_personal_info, name="getpersonalinfo"),
path("editprofilepicture/", views.edit_profile_picture... | StarcoderdataPython |
1833645 | <reponame>Khan/pyobjc-framework-Cocoa
#
# __main__.py
# TableModel
#
# Created by <NAME> on Sun Apr 04 2004.
# Copyright (c) 2004 <NAME>. All rights reserved.
#
from PyObjCTools import AppHelper
# import classes required to start application
import TableModelAppDelegate
# start the event loop
AppHelper.runEventL... | StarcoderdataPython |
6548814 | import factory
from wagtail.core.models import Site, Page
from wagtail_factories import PageFactory
from .pages.base import BasePage
class BasePageFactory(PageFactory):
class Meta:
model = BasePage
| StarcoderdataPython |
9647733 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import copy, warnings
from os import path
from collections import OrderedDict
import itertools
import numpy as np
from scipy import stats, signal, interpolate
import matplotlib.pyplot as plt
... | StarcoderdataPython |
962 | <gh_stars>1000+
# Copyright 2019 Atalaya Tech, 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 |
6429119 | from .LoggingManager import LoggingManager | StarcoderdataPython |
6528672 | # -*- coding: utf-8 -*-
from andip.default import DefaultProvider
from ZODB.FileStorage import FileStorage
from ZODB.DB import DB
from persistent.mapping import PersistentMapping
import transaction
class DatabaseProvider(DefaultProvider):
def __init__(self, path, backoff = None):
"""
Initializes ... | StarcoderdataPython |
11321227 | <reponame>jgori-ouistiti/CoopIHC
import pytest
def test_basic_examples():
import coopihc.examples.basic_examples.space_examples
import coopihc.examples.basic_examples.stateelement_examples
import coopihc.examples.basic_examples.state_examples
import coopihc.examples.basic_examples.observation_examples... | StarcoderdataPython |
5036215 | from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import ObjectDoesNotExist
from django.db import transaction
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse_lazy
from djan... | StarcoderdataPython |
11343104 | class Solution:
def minWindow(self, s: str, t: str) -> str:
d = collections.Counter(t)
l0,r0,l,cnt = 0,-1,0,len(t)
for r,c in enumerate(s):
if c in d:
cnt -= d[c]>0
d[c] -= 1
while not cnt:
if r0 < 0 or r-l <r0-l0:
... | StarcoderdataPython |
6481930 | from rest_framework.serializers import SerializerMetaclass
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import authentication,permissions
from rest_framework.parsers import FileUploadParser
from .cosmosdb import CosmosDB
from .blobdb import BlobDB
collection... | StarcoderdataPython |
9788734 | #!/usr/bin/env python
# encoding: utf-8
# Copyright (c) 2016, <NAME> (www.karlsruhe.de)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation th... | StarcoderdataPython |
9713555 | <gh_stars>1-10
import sys
import time
import numpy as np
import matplotlib.pyplot as plt
from multiprocessing import Pool
# if len(sys.argv) < 3:
# print('ERROR Args number. Needed: \n[1]In Path(with file.npy) -- prepros file \n[2]Out Path(with .json)')
# sys.exit()
#
#
# in_path = str(sys.argv[1])
# out_path ... | StarcoderdataPython |
1779423 | <filename>dynamics.py
import numpy as np
from matplotlib import pyplot as plt
class Enum(object):
def __init__(self, _list):
self._list = _list
def __getitem__(self, key):
if key in self._list:
return self._list.index(key)
else:
raise(KeyError("{} not in enum".... | StarcoderdataPython |
6447370 | <filename>napari/components/tests/test_multichannel.py
import numpy as np
from napari.components import ViewerModel
base_colormaps = ['cyan', 'yellow', 'magenta', 'red', 'green', 'blue']
def test_multichannel():
"""Test adding multichannel image."""
viewer = ViewerModel()
np.random.seed(0)
data = np.... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.