hexsha stringlengths 40 40 | size int64 5 2.06M | ext stringclasses 11 values | lang stringclasses 1 value | max_stars_repo_path stringlengths 3 251 | max_stars_repo_name stringlengths 4 130 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 251 | max_issues_repo_name stringlengths 4 130 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 116k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 251 | max_forks_repo_name stringlengths 4 130 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 1 1.05M | avg_line_length float64 1 1.02M | max_line_length int64 3 1.04M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
34ba56f92389624b3e0ca24dcce3ebbffc885fcd | 3,494 | py | Python | latexnewfloat.py | takaakiaoki/sphinx_latexnewfloat | e20c4b6825484976cf41c48a634b67524024007f | [
"BSD-2-Clause"
] | null | null | null | latexnewfloat.py | takaakiaoki/sphinx_latexnewfloat | e20c4b6825484976cf41c48a634b67524024007f | [
"BSD-2-Clause"
] | null | null | null | latexnewfloat.py | takaakiaoki/sphinx_latexnewfloat | e20c4b6825484976cf41c48a634b67524024007f | [
"BSD-2-Clause"
] | null | null | null | r""" latexnewfloat.py extension for latex builder to replace
literal-block environment by \captionof{LiteralBlockNewFloat}{caption_title} command.
For \captionof command (in capt-of pacakge), the new environment
LiteralBlockNewFloat should be configured by newfloat pagage instead of
original float package.
needspace package is required, and \literalblockneedspace and \literalblockcaptionaboveskip
are introduced in order to control pagebreak around caption.
Usage:
add following latex preambles for latex_elements['preamble'] in conf.py
'preamble': r'''
% declare new LiteralBlockNewFloat. You may change `name` option
\DeclareFloatingEnvironment{LiteralBlockNewFloat}
% confiure additional options
\SetupFloatingEnvironment{LiteralBlockNewFloat}{name=Listing,placement=h,fileext=loc}
% change within option in similar to literal-block in sphinx.sty
\ifx\thechapter\undefined
\SetupFloatingEnvironment{LiteralBlockNewFloat}{within=section}
\else
\SetupFloatingEnvironment{LiteralBlockNewFloat}{within=chapter}
\fi
% if the left page space is less than \literalblockneedsapce, insert page-break
\newcommand{\literalblockneedspace}{5\baselineskip}
% margin before the caption of literal-block
\newcommand{\literalblockcaptionaboveskip}{0.5\baselineskip}
'''
Run sphinx with builder name 'latexnewfloat'
python -m sphinx.__init__ -b latexnewfloat {intpudir} {outputdir}
or
- add entry in makefile
- you may also override original latex builder entry using app.set_translator
"""
from sphinx.writers.latex import LaTeXTranslator
from sphinx.builders.latex import LaTeXBuilder
# inherited from LaTeXBuilder
# inherited from LaTeXTranslator
| 40.627907 | 92 | 0.709788 |
34baa570e639a04a3c0bb24a77d73f14fd9abb0d | 9,347 | py | Python | django_g11n/tools/ipranges.py | martinphellwig/django-g11n | 94eb9da7d7027061873cd44356fdf3378cdb3820 | [
"BSD-2-Clause"
] | null | null | null | django_g11n/tools/ipranges.py | martinphellwig/django-g11n | 94eb9da7d7027061873cd44356fdf3378cdb3820 | [
"BSD-2-Clause"
] | null | null | null | django_g11n/tools/ipranges.py | martinphellwig/django-g11n | 94eb9da7d7027061873cd44356fdf3378cdb3820 | [
"BSD-2-Clause"
] | null | null | null | """
Module to fetch and parse regional NIC delegation data
"""
import urllib.parse
import ftplib
import os
from functools import lru_cache
import socket
import ipaddress
from binascii import hexlify
import tempfile
TWD = tempfile.gettempdir()
DELEGATES = [
# America (non-latin)
"ftp://ftp.arin.net/pub/stats/arin/delegated-arin-extended-latest",
# Europe
"ftp://ftp.ripe.net/ripe/stats/delegated-ripencc-extended-latest",
# Africa
"ftp://ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-extended-latest",
# Asia & Pacific
"ftp://ftp.apnic.net/pub/stats/apnic/delegated-apnic-extended-latest",
# Latin-America
"ftp://ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-extended-latest",]
def _file_details(ftp, file_name):
"Retrieve details of the file."
details = None
print('# Retrieving file details')
try:
listing = list(ftp.mlsd())
print('# Server support mlsd, extracting details ...')
for entry in listing:
name, facts = entry
if name.lower() == file_name.lower():
details = facts
details['name_local'] = name
details['name_remote'] = name
break
except ftplib.error_perm:
print('# Server does not support mlsd, falling back.')
tmp = list()
ftp.retrlines('LIST %s' % file_name, callback=tmp.append)
if '->' in tmp[0]:
print('# Fall back: entry is a symbolic link, following ...')
link2name = tmp[0].split('->')[1].strip()
tmp = list()
ftp.retrlines('LIST %s' % link2name, callback=tmp.append)
details = dict()
tmp = tmp[0]
tmp = tmp.rsplit(' ', 1)[0]
details['name_local'] = file_name
details['name_remote'] = link2name
tmp, details['size'], month, day, time = tmp.rsplit(' ', 4)
details['modify'] = '_'.join([month, day, time.replace(':', '')])
return details
def download(url):
"Download the url."
host, file_path, file_name = _split_url(url)
print('# Connecting to: %s' % host)
ftp = ftplib.FTP(host)
print('# Logging in ...')
ftp.login()
print('# Changing cwd to: %s' % file_path)
ftp.cwd(file_path)
details = _file_details(ftp, file_name)
file_cache = '_'.join([details['name_local'],
details['size'],
details['modify']])
file_cache += '.csv'
if file_cache in os.listdir(TWD):
print('# File is already downloaded !')
return
print('# Downloading ...')
retr = 'RETR %s' % details['name_remote']
local_file = os.path.join(TWD, file_cache)
ftp.retrbinary(retr, open(local_file, 'wb').write)
print('# Downloaded!')
# The parsing part of the program
def _address_range_ipv4(address, width):
"Convert IPv4 address and amount to integer range."
# The width of ipv4 addresses is given in number of addresses which
# are not bounded by exact netmasks for example a width of 640 addresses.
blocks = address.split('.')
for index, block in enumerate(blocks):
blocks[index] = bin(int(block, 10))[2::].zfill(8)
blocks = ''.join(blocks)
network = int(blocks, 2)
broadcast = network + int(width) - 1
return(network, broadcast)
def _ipv6_to_int(ipv6_address):
"Convert an IPv6 address to an integer"
packed_string = socket.inet_pton(socket.AF_INET6, ipv6_address.exploded)
return int(hexlify(packed_string), 16)
def _address_range_ipv6(address, width):
"Convert IPv6 address and broadcast to integer range."
network = ipaddress.ip_network(address+'/'+width)
broadcast = _ipv6_to_int(network.broadcast_address)
network = _ipv6_to_int(network.network_address)
return(network, broadcast)
def _address_range(ipv, address, width):
"From an IP address create integers for the network and broadcast IP"
# This is essentially the range which in between an IP address is.
if ipv == 4:
# IPv4, the width is given as the number of IPs
network, broadcast = _address_range_ipv4(address, width)
else:
# IPv6, width is given by a netmask.
network, broadcast = _address_range_ipv6(address, width)
return (network, broadcast)
def _parse_row(row):
"Parse and modify the row."
columns = row.strip().split('|')
# If there isn't more then 6 columns I can't parse it, so skipping it.
if len(columns) > 6:
tmp = columns[:5]
if len(tmp[1].strip()) == 0:
# This is the country it is assigned to, if there is no country
# I am not interested in it.
return None
if tmp[2].strip().lower() not in ['ipv4', 'ipv6']:
# If the protocol is not an IP protocol (such as asn), I am not
# interested.
return None
if '6' in tmp[2]:
tmp[2] = 6
else:
tmp[2] = 4
# Convert the IP address and netmask/number of IP's to an IP range where
# the IPs are converted to a numerical value.
tmp[3], tmp[4] = _address_range(tmp[2], tmp[3], tmp[4])
return tmp
def _local_file_from_url(url):
"Open the file, if available from the url"
file_name = _split_url(url)[2]
candidates = list()
for candidate in os.listdir(TWD):
if file_name.lower() in candidate.lower():
candidates.append(candidate)
candidates.sort(reverse=True)
if len(candidates) == 0:
print('# No files to parse')
return None
file_full = os.path.join(TWD, candidates[0])
return file_full
def parse_latest(url):
"Parse a file as it has been retrieved from the url."
file_name = _local_file_from_url(url)
if file_name is None:
print('# No files available to parse !')
return
print('# Opening file: %s' % file_name)
compacted = CompactRanges()
count_linesall = 0
count_relevant = 0
with open(file_name, 'r') as file_open:
for row in file_open:
count_linesall += 1
parsed = _parse_row(row)
if parsed is None:
continue
count_relevant += 1
compacted.add(*parsed)
print('# Parsed %s lines' % count_linesall)
print('# - of which relevant: %s' % count_relevant)
print('# - reduced to ranges: %s' % compacted.length())
return compacted.ranges
def _compact_string(text):
"try making text compacter"
# we go through the text and try to replace repeated characters with:
# _c_n_ where c is the character and n is the amount of if. The underscore
# in this context is guaranteed to not occur in text. As such we can use
# it as an escape character.
# Also we do not collapse if repeated character is below 5.
tmp = list()
last = ''
count = 0
for character in text+'_':
# Add the underscore so we make sure not to miss the last bit of the
# string if it happens to end on more then 4 identical characters.
count += 1
if character != last:
if count > 4:
tmp = tmp[:len(tmp)-count]
tmp.append('_%s_%s_' % (last, count))
count = 0
last = character
tmp.append(character)
# Remove the appended underscore before returning.
return ''.join(tmp)[:-1]
| 32.120275 | 80 | 0.609714 |
34bac3615a35d59de02e3b0769b794431fef838e | 548 | py | Python | resource/index.py | TintypeMolly/Yuzuki | 94dc874c4000ac918f0b52846927311b3f25ce2c | [
"MIT"
] | 6 | 2015-01-09T06:32:15.000Z | 2015-08-15T13:23:34.000Z | resource/index.py | TintypeMolly/Yuzuki | 94dc874c4000ac918f0b52846927311b3f25ce2c | [
"MIT"
] | 73 | 2015-01-08T11:38:34.000Z | 2015-09-10T09:55:08.000Z | resource/index.py | TintypeMolly/Yuzuki | 94dc874c4000ac918f0b52846927311b3f25ce2c | [
"MIT"
] | 11 | 2015-01-09T06:26:12.000Z | 2015-03-26T13:16:19.000Z | # -*- coding: utf-8 -*-
from helper.resource import YuzukiResource
from helper.template import render_template
from config.config import SITE_DESCRIPTION
from helper.content import markdown_convert_file
| 32.235294 | 61 | 0.656934 |
34bb5b87da16431c41b077d93418d9a992f6e4d0 | 6,281 | py | Python | src/dh2019dataverse.py | Mish-JPFD/DAPIload | d1f2c0e9832e6731c7e98f03481712db765e9af6 | [
"MIT"
] | null | null | null | src/dh2019dataverse.py | Mish-JPFD/DAPIload | d1f2c0e9832e6731c7e98f03481712db765e9af6 | [
"MIT"
] | null | null | null | src/dh2019dataverse.py | Mish-JPFD/DAPIload | d1f2c0e9832e6731c7e98f03481712db765e9af6 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Author : Jacques Flores
Created : October 17th,2019
About: Script for creating datasets in Dataverse.
An Empty JSON file with Dataverse structure is imported and converted into a JSON dict
Metadata is imported from an excel file into a pandas dataframe and written into the empty JSON formatted string.
"""
from pyDataverse import api
from pyDataverse.utils import read_file_json
from pyDataverse.utils import dict_to_json
import pandas as pd
import copy
# Confidential API Token (Do Not Distribute) ****last four digits removed)
apitoken = "38404b17-46f9-4fe5-808e-a4a38bd80aea"
# Demo Dataverse server
dtvserver = "https://dataverse.nl"
#Loading connection and authentication
dataverse = api.Api(dtvserver,apitoken)
#reading json file as dict
template = read_file_json('dataversetemplate.json')
#read excel file with metadata as pandas dataframe
xlfile = "DH2019_paperswithfiles.xlsx"
xl = pd.read_excel(xlfile, converters={'paperID': str})
handles = create_datasets(dataverse, xl, template)
handles_df = pd.DataFrame(handles)
handles_df.to_excel("handles.xlsx")
| 44.864286 | 215 | 0.603566 |
34bbafd4c9930c0faccaa0114904fc2722169c13 | 778 | py | Python | manage.py | YaroslavChyhryn/SchoolAPI | 6b5eb4e1faf6b962561109fc227057ad0f8d4d92 | [
"MIT"
] | null | null | null | manage.py | YaroslavChyhryn/SchoolAPI | 6b5eb4e1faf6b962561109fc227057ad0f8d4d92 | [
"MIT"
] | null | null | null | manage.py | YaroslavChyhryn/SchoolAPI | 6b5eb4e1faf6b962561109fc227057ad0f8d4d92 | [
"MIT"
] | null | null | null | from flask_script import Manager, prompt_bool
# from flask_migrate import Migrate, MigrateCommand
from school_api.app import create_app
from school_api.db import create_tables, drop_tables
from school_api.data_generator import test_db
"""
Refused flask_migration because it was overkill for this project
"""
app = create_app()
# migrate = Migrate(app, db)
manager = Manager(app)
# manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
manager.run()
| 20.473684 | 66 | 0.746787 |
34bbecbef412ab4c340ef6c39922f83c94f745b1 | 214 | py | Python | parrot2.py | AmitSuresh/learning-python | f1ea5b9f3659f21504b1b0e452c03239b03cde85 | [
"MIT"
] | null | null | null | parrot2.py | AmitSuresh/learning-python | f1ea5b9f3659f21504b1b0e452c03239b03cde85 | [
"MIT"
] | null | null | null | parrot2.py | AmitSuresh/learning-python | f1ea5b9f3659f21504b1b0e452c03239b03cde85 | [
"MIT"
] | null | null | null | p="\nTell me something, and I will repeat it back to you"
p+="\nEnter 'quit' to end the program."
active = True
while active:
message=input(p)
if message =='quit':
active = False
else:
print(message) | 23.777778 | 58 | 0.663551 |
34bcda748e6f244af235e4cdcc2cf69df9e0d4a6 | 2,512 | py | Python | info_modules/custom/example/layer_info.py | HusseinKabbout/qwc-feature-info-service | 3d7cdbc1a3dc4a3725ba0529204848d47c4ed87e | [
"MIT"
] | null | null | null | info_modules/custom/example/layer_info.py | HusseinKabbout/qwc-feature-info-service | 3d7cdbc1a3dc4a3725ba0529204848d47c4ed87e | [
"MIT"
] | null | null | null | info_modules/custom/example/layer_info.py | HusseinKabbout/qwc-feature-info-service | 3d7cdbc1a3dc4a3725ba0529204848d47c4ed87e | [
"MIT"
] | 2 | 2020-03-24T09:13:14.000Z | 2021-09-29T10:43:31.000Z | # Sample implementation of a custom layer info module
def layer_info(layer, x, y, crs, params, identity):
"""Query layer and return info result as dict:
{
'features': [
{
'id': <feature ID>, # optional
'attributes': [
{
'name': '<attribute name>',
'value': '<attribute value>'
}
],
'bbox': [<minx>, <miny>, <maxx>, <maxy>], # optional
'geometry': '<WKT geometry>' # optional
}
]
}
:param str layer: Layer name
:param float x: X coordinate of query
:param float y: Y coordinate of query
:param str crs: CRS of query coordinates
:param obj params: FeatureInfo service params
{
'i': <X ordinate of query point on map, in pixels>,
'j': <Y ordinate of query point on map, in pixels>,
'height': <Height of map output, in pixels>,
'width': <Width of map output, in pixels>,
'bbox': '<Bounding box for map extent as minx,miny,maxx,maxy>',
'crs': '<CRS for map extent>',
'feature_count': <Max feature count>,
'with_geometry': <Whether to return geometries in response
(default=1)>,
'with_maptip': <Whether to return maptip in response
(default=1)>,
'FI_POINT_TOLERANCE': <Tolerance for picking points, in pixels
(default=16)>,
'FI_LINE_TOLERANCE': <Tolerance for picking lines, in pixels
(default=8)>,
'FI_POLYGON_TOLERANCE': <Tolerance for picking polygons, in pixels
(default=4)>,
'resolution': <Resolution in map units per pixel>
}
:param str identity: User name or Identity dict
"""
features = []
feature_id = 123
attributes = [
{
'name': 'title',
'value': 'Feature for Layer %s' % layer
},
{
'name': 'name',
'value': 'Feature Name'
}
]
px = round(x)
py = round(y)
bbox = [px - 50, py - 50, px + 50, py + 50]
geometry = "POINT(%s %s)" % (px, py)
features.append({
'id': feature_id,
'attributes': attributes,
'bbox': bbox,
'geometry': geometry
})
return {
'features': features
}
| 31.797468 | 78 | 0.48328 |
34bce8f103a1242d4cbbb176bc3c65328694b160 | 20,740 | py | Python | integration/gCalIntegration.py | conzty01/RA_Scheduler | 6bf4931871aef4058d93917e62ceb31766e06b3a | [
"MIT"
] | 1 | 2021-03-31T05:26:17.000Z | 2021-03-31T05:26:17.000Z | integration/gCalIntegration.py | conzty01/RA_Scheduler | 6bf4931871aef4058d93917e62ceb31766e06b3a | [
"MIT"
] | 83 | 2018-03-19T18:32:34.000Z | 2022-02-01T02:15:01.000Z | integration/gCalIntegration.py | conzty01/RA_Scheduler | 6bf4931871aef4058d93917e62ceb31766e06b3a | [
"MIT"
] | 2 | 2021-01-15T22:16:00.000Z | 2021-02-10T01:03:32.000Z | from google.auth.transport.requests import Request
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError
import google_auth_oauthlib.flow
import logging
import os
if __name__ == "__main__":
g = gCalIntegratinator()
| 46.711712 | 129 | 0.588091 |
34bff1450311d256bf20dadcb095880fb22acb44 | 933 | py | Python | pins/admin.py | boyombo/smsbet | 66c20494b729c930edec553fe71e2084222acc4a | [
"MIT"
] | null | null | null | pins/admin.py | boyombo/smsbet | 66c20494b729c930edec553fe71e2084222acc4a | [
"MIT"
] | null | null | null | pins/admin.py | boyombo/smsbet | 66c20494b729c930edec553fe71e2084222acc4a | [
"MIT"
] | null | null | null | from random import choice
from django.contrib import admin
from pins.models import Batch, Pin
from pins.forms import BatchForm
admin.site.register(Batch, BatchAdmin)
admin.site.register(Pin, PinAdmin)
| 23.923077 | 69 | 0.622722 |
34c1c0f2296ec9a8cff26832714ccf9c61244f45 | 961 | py | Python | 2017/February/2_maxcross/maxcross.py | alantao5056/USACO_Silver | 6998cb916692af58a0b40b1a4aff0708ee1106b8 | [
"MIT"
] | null | null | null | 2017/February/2_maxcross/maxcross.py | alantao5056/USACO_Silver | 6998cb916692af58a0b40b1a4aff0708ee1106b8 | [
"MIT"
] | null | null | null | 2017/February/2_maxcross/maxcross.py | alantao5056/USACO_Silver | 6998cb916692af58a0b40b1a4aff0708ee1106b8 | [
"MIT"
] | null | null | null |
main('maxcross.in', 'maxcross.out') | 20.891304 | 62 | 0.612903 |
34c2dd9c20a2135a93d6b5c256d90be592b639fa | 752 | py | Python | Python/leetcode2/41. First Missing Positive.py | darrencheng0817/AlgorithmLearning | aec1ddd0c51b619c1bae1e05f940d9ed587aa82f | [
"MIT"
] | 2 | 2015-12-02T06:44:01.000Z | 2016-05-04T21:40:54.000Z | Python/leetcode2/41. First Missing Positive.py | darrencheng0817/AlgorithmLearning | aec1ddd0c51b619c1bae1e05f940d9ed587aa82f | [
"MIT"
] | null | null | null | Python/leetcode2/41. First Missing Positive.py | darrencheng0817/AlgorithmLearning | aec1ddd0c51b619c1bae1e05f940d9ed587aa82f | [
"MIT"
] | null | null | null | '''
Given an unsorted integer array, find the smallest missing positive integer.
Example 1:
Input: [1,2,0]
Output: 3
Example 2:
Input: [3,4,-1,1]
Output: 2
Example 3:
Input: [7,8,9,11,12]
Output: 1
Note:
Your algorithm should run in O(n) time and uses constant extra space.
'''
s = Solution()
print(s.firstMissingPositive([-1,4,2,1,9,10])) | 21.485714 | 76 | 0.575798 |
34c375e2a66eb6bf3befc20ceb9878fbf3112409 | 6,531 | py | Python | 4/figs/figX9/entropy_comparison_ew_hsm_igm.py | t-young31/thesis | 2dea31ef64f4b7d55b8bdfc2094bab6579a529e0 | [
"MIT"
] | null | null | null | 4/figs/figX9/entropy_comparison_ew_hsm_igm.py | t-young31/thesis | 2dea31ef64f4b7d55b8bdfc2094bab6579a529e0 | [
"MIT"
] | null | null | null | 4/figs/figX9/entropy_comparison_ew_hsm_igm.py | t-young31/thesis | 2dea31ef64f4b7d55b8bdfc2094bab6579a529e0 | [
"MIT"
] | null | null | null | """
Calculate the translational entropy with EW, HSM and IGM models
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy import integrate
plt.style.use("paper")
ha2kjmol = 627.5 * 4.184
def _q_t_ew(self):
cap_lambda = ((2.0 * self.mass_au * np.pi) / (
beta_au * Constants.h_au ** 2)) ** 1.5
integral = integrate.quad(exp_integrand, 0.0, 10.0,
args=(beta_au, self.a_au, self.b_inv_au))[0]
return 4.0 * np.pi * np.exp(beta_au * self.a_au) * cap_lambda * integral
def ST(S):
return np.round(temp_K * S, decimals=3)
if __name__ == '__main__':
temp_K = 298.15
beta_au = 1.0 / (Constants.kb_au * temp_K)
Methane_Water = Solute(mass_amu=16.04, k_kcal=1.048, a_inv_ang=2.918)
Methane_Acetonitrile = Solute(mass_amu=16.04, k_kcal=0.529, a_inv_ang=2.793)
Methane_Benzene = Solute(mass_amu=16.04, k_kcal=0.679, a_inv_ang=2.736)
CO2_Water = Solute(mass_amu=44.01, k_kcal=0.545, a_inv_ang=4.075)
CO2_Acetonitrile = Solute(mass_amu=44.01, k_kcal=0.446 , a_inv_ang=2.93)
CO2_Benzene = Solute(mass_amu=44.01, k_kcal=0.415, a_inv_ang=3.431)
Alanine_Water = Solute(mass_amu=89.09, k_kcal=0.53, a_inv_ang=4.083)
Alanine_Acetonitrile = Solute(mass_amu=89.09, k_kcal=1.005, a_inv_ang=2.127)
Alanine_Benzene = Solute(mass_amu=89.09, k_kcal=0.368, a_inv_ang=2.878)
systems = [Methane_Water, Methane_Acetonitrile, Methane_Benzene,
CO2_Water, CO2_Acetonitrile, CO2_Benzene,
Alanine_Water, Alanine_Acetonitrile, Alanine_Benzene]
rels = []
for system in systems:
rel = ST(system.s_t_ew) / ST(system.s_t_igm_1m)
rels.append(rel)
print(ST(system.s_t_igm_1atm),
ST(system.s_t_igm_1m),
ST(system.s_t_ew),
'kcal mol-1',
sep=' & ')
print(np.average(np.array(rels)),
'', np.std(np.array(rels))/np.sqrt(len(rels)))
| 34.739362 | 100 | 0.548767 |
34c5294b5c38bdcb5b04e56497ca943887aae731 | 53 | py | Python | gramex/apps/nlg/__init__.py | joshuamosesb/gramex | e416cb609698b5941a18b06743c853dee50e0500 | [
"MIT"
] | 1 | 2020-05-17T18:03:44.000Z | 2020-05-17T18:03:44.000Z | gramex/apps/nlg/__init__.py | joshuamosesb/gramex | e416cb609698b5941a18b06743c853dee50e0500 | [
"MIT"
] | null | null | null | gramex/apps/nlg/__init__.py | joshuamosesb/gramex | e416cb609698b5941a18b06743c853dee50e0500 | [
"MIT"
] | null | null | null | from .nlgsearch import templatize # NOQA: F401
| 26.5 | 52 | 0.698113 |
34c843d990ddc136afa91e10afc82afbaed4398e | 5,300 | py | Python | MessagePassingRPC/rpc_client.py | asgokhale/DistributedSystemsCourse | 9ae24ed65e7a7ef849c7e39ec5a1a8cc5973c12f | [
"Apache-2.0"
] | 4 | 2022-01-16T17:36:49.000Z | 2022-02-07T16:57:33.000Z | MessagePassingRPC/rpc_client.py | asgokhale/DistributedSystemsCourse | 9ae24ed65e7a7ef849c7e39ec5a1a8cc5973c12f | [
"Apache-2.0"
] | null | null | null | MessagePassingRPC/rpc_client.py | asgokhale/DistributedSystemsCourse | 9ae24ed65e7a7ef849c7e39ec5a1a8cc5973c12f | [
"Apache-2.0"
] | 1 | 2022-01-25T23:51:51.000Z | 2022-01-25T23:51:51.000Z | ##############################################
#
# Author: Aniruddha Gokhale
#
# Created: Spring 2022
#
# Purpose: demonstrate a basic remote procedure call-based client
#
# A RPC uses message passing under the hood but provides a more
# type-safe and intuitive way for users to make invocations on the remote
# side because the caller makes invocations on methods (these could be methods
# of a class object, which is what we show here). That object often is
# a proxy of the real, remote implementation. The proxy simply offers the same
# interface to the caller. Under the hood, the proxy's method will then use the
# traditional message passing style where the packet is created in the
# desired format using some serialization framework like Flatbuffers etc
#
##############################################
import argparse # for argument parsing
import zmq # ZeroMQ
# define a proxy class for the server that supports the same interface
# as the real server. The client then invokes methods on this proxy, which
# are then sent to the other side. The proxy offers exactly the same interface
# to the caller as what the real implementation does on the remote side.
#
# Such proxies are also referred to as stubs and skeletons and are often
# automatically generated from interface and packet format definitions by
# interface definition language (IDL) compilers. Although, in our implementation
# here, we show an extremely simple and manually created packet, one
# could use Flatbuffers or similar modern serialization framework to do the
# necessary packet serialization.
#
# Notice also that the only 3 methods one can invoke on this proxy are
# connect, get and put. Thus, it is impossible to send a wrong message type
# like "POST" as we did in the basic message passing client, or mess up the
# packet encoding by forgetting the space after the message type keyword
# because often the serialization code will be generated by frameworks like
# Flatbuffer
#
###################################
#
# Parse command line arguments
#
###################################
def parseCmdLineArgs ():
# instantiate a ArgumentParser object
parser = argparse.ArgumentParser (description="Message Passing Client")
# Now specify all the optional arguments we support
# server's IP address
parser.add_argument ("-a", "--ipaddr", default="localhost", help="IP address of the message passing server, default: localhost")
# server's port
parser.add_argument ("-p", "--port", default="5557", help="Port number used by message passing server, default: 5557")
return parser.parse_args()
##################################
#
# main program
#
##################################
###################################
#
# Main entry point
#
###################################
if __name__ == "__main__":
main ()
| 37.588652 | 132 | 0.658679 |
34c9095464074f8f39e3db552d812f1238aad8c5 | 1,305 | py | Python | main.py | Sirius1942/Agave_ui_tools | 7789de1d40955046d2e40fbe1c552f4a082c1472 | [
"MIT"
] | 1 | 2019-04-10T03:17:16.000Z | 2019-04-10T03:17:16.000Z | main.py | Sirius1942/Agave_ui_tools | 7789de1d40955046d2e40fbe1c552f4a082c1472 | [
"MIT"
] | null | null | null | main.py | Sirius1942/Agave_ui_tools | 7789de1d40955046d2e40fbe1c552f4a082c1472 | [
"MIT"
] | null | null | null |
import sys
from PyQt5.QtWidgets import QApplication,QMainWindow,QDialog
from PyQt5 import QtCore, QtGui, QtWidgets
from ui.main_window import Ui_MainWindow
# from login import Ui_dialog
from lib.tcmd import TCmdClass
# from SignalsE import Example
# class SignalsWindow(QWidget,SignalsExample):
# def __init__(self,parent=None):
# super(SignalsExample,self).__init__(parent)
# self.setupUi(self)
# def keyPressEvent(self, e):
# if e.key() == Qt.Key_Escape:
# self.close()
if __name__=="__main__":
app=QApplication(sys.argv)
myWin=MyMainWindow()
myWin.show()
# sig=SignalsWindow()
sys.exit(app.exec_())
| 24.622642 | 75 | 0.683525 |
34ca769ede09a2256c0d08709d7ea01edfa2631c | 1,675 | py | Python | lib/python2.7/site-packages/setools/polcapquery.py | TinkerEdgeR-Android/prebuilts_python_linux-x86_2.7.5 | 5bcc5eb23dbb00d5e5dbf75835aa2fb79e8bafa2 | [
"PSF-2.0"
] | null | null | null | lib/python2.7/site-packages/setools/polcapquery.py | TinkerEdgeR-Android/prebuilts_python_linux-x86_2.7.5 | 5bcc5eb23dbb00d5e5dbf75835aa2fb79e8bafa2 | [
"PSF-2.0"
] | null | null | null | lib/python2.7/site-packages/setools/polcapquery.py | TinkerEdgeR-Android/prebuilts_python_linux-x86_2.7.5 | 5bcc5eb23dbb00d5e5dbf75835aa2fb79e8bafa2 | [
"PSF-2.0"
] | 1 | 2020-05-14T05:25:00.000Z | 2020-05-14T05:25:00.000Z | # Copyright 2014-2015, Tresys Technology, LLC
#
# This file is part of SETools.
#
# SETools is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 2.1 of
# the License, or (at your option) any later version.
#
# SETools is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with SETools. If not, see
# <http://www.gnu.org/licenses/>.
#
import logging
from .mixins import MatchName
from .query import PolicyQuery
| 31.603774 | 90 | 0.699104 |
34cc917b6b0a55b388657d87b459c3107ab03a8f | 2,108 | py | Python | src_Python/EtabsAPIbface1/EtabsAPIe_eUnits.py | fjmucho/APIdeEtabsYPython | a5c7f7fe1861c4ac3c9370ef06e291f94c6fd523 | [
"MIT"
] | null | null | null | src_Python/EtabsAPIbface1/EtabsAPIe_eUnits.py | fjmucho/APIdeEtabsYPython | a5c7f7fe1861c4ac3c9370ef06e291f94c6fd523 | [
"MIT"
] | null | null | null | src_Python/EtabsAPIbface1/EtabsAPIe_eUnits.py | fjmucho/APIdeEtabsYPython | a5c7f7fe1861c4ac3c9370ef06e291f94c6fd523 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""Description:
"""
import os
import sys
import comtypes.client
try:
ETABSObject = comtypes.client.GetActiveObject("CSI.ETABS.API.ETABSObject")
print("Coneccion exitosa!.\nadjuntando a una instancia existente.")
except (OSError, comtypes.COMError):
print("No se encontr ninguna instancia en ejecucin del programa(Etabs).")
sys.exit(-1)
smodel = ETABSObject.SapModel
# Unlocking model | Abriendo modelo (hace referencia al candadito de etabs)
smodel.SetModelIsLocked(False)
# 'initialize model | Inicializa nuevo modelo en blanco
res = smodel.InitializeNewModel()
# create grid-only template model | Crea una nueva hoja con grilla
res = smodel.File.NewGridOnly(4,12,12,4,4,24,24)
# Unit Preferences | Preferencias de Unidad
# N_mm_C = 6 #kN_m_c
# smodel.SetPresentUnits(N_mm_C)
unitOption = {
'lb_in_F':1, 'lb_ft_F':2, 'kip_in_F':3, 'kip_ft_F':4,
'kN_mm_C':5, 'kN_m_C':6, 'kgf_mm_C':7, 'kgf_m_C':8, 'N_mm_C':9, 'N_m_C':10,
'Ton_mm_C':11, 'Ton_m_C':12, 'kN_cm_C':13, 'kgf_cm_C':14, 'N_cm_C':15, 'Ton_cm_C':16
}
_n_mm_n = unitOption['kN_m_C'] #, propiedad estatica y privada, deberia ser
# su utilidad de estas 2 variables se usara para las funciones/metodos
length="mm" # longitud
force="kN" #
# length can be either "m" or "mm"
# force can be either "N" or "kN"
if(length=="mm" and force=="N"):
# smodel.SetPresentUnits(9);
smodel.SetPresentUnits(_n_mm_n);
elif(length=="mm" and force=="kN"):
# smodel.SetPresentUnits(5);
smodel.SetPresentUnits(_n_mm_n);
elif(length=="m" and force=="N"):
# smodel.SetPresentUnits(10);
smodel.SetPresentUnits(_n_mm_n);
elif(length=="m" and force=="kN"):
# smodel.SetPresentUnits(6);
smodel.SetPresentUnits(_n_mm_n)
# ....
print(smodel.GetPresentUnits())
input("Enter para cerrar Etabs!")
# 'close ETABS | Cerrar aplicacion Etabs
ETABSObject.ApplicationExit(False)
# clean up variables | limpiamos las variables y eliminamos
ETABSObject, smodel, res = None, None, None
del ETABSObject, smodel, res | 31.939394 | 85 | 0.693074 |
34ccc2dc6b0cda2dc80e2e73e7a9e34065db3f8d | 826 | py | Python | casepro/msgs/migrations/0040_outgoing_as_single_pt1.py | rapidpro/ureport-partners | 16e5b95eae36ecbbe8ab2a59f34a2f5fd32ceacd | [
"BSD-3-Clause"
] | 21 | 2015-07-21T15:57:49.000Z | 2021-11-04T18:26:35.000Z | casepro/msgs/migrations/0040_outgoing_as_single_pt1.py | rapidpro/ureport-partners | 16e5b95eae36ecbbe8ab2a59f34a2f5fd32ceacd | [
"BSD-3-Clause"
] | 357 | 2015-05-22T07:26:45.000Z | 2022-03-12T01:08:28.000Z | casepro/msgs/migrations/0040_outgoing_as_single_pt1.py | rapidpro/ureport-partners | 16e5b95eae36ecbbe8ab2a59f34a2f5fd32ceacd | [
"BSD-3-Clause"
] | 24 | 2015-05-28T12:30:25.000Z | 2021-11-19T01:57:38.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
| 33.04 | 110 | 0.654964 |
34d35a78f92c8bdc372877964e8913cfb9da9911 | 197 | py | Python | Areatriangulo.py | ChristianSalas1234567/salas-yupanqui | 36fdbe3ebc51cd73f62870fcc8b646ad98133ae7 | [
"Apache-2.0"
] | 1 | 2021-04-22T12:34:37.000Z | 2021-04-22T12:34:37.000Z | Areatriangulo.py | ChristianSalas1234567/salas-yupanqui | 36fdbe3ebc51cd73f62870fcc8b646ad98133ae7 | [
"Apache-2.0"
] | null | null | null | Areatriangulo.py | ChristianSalas1234567/salas-yupanqui | 36fdbe3ebc51cd73f62870fcc8b646ad98133ae7 | [
"Apache-2.0"
] | null | null | null | #variables de entrada
print("area del triangulo")
#datos de entrada
B=int(input("ingrese base:"))
H=int(input("ingrese haltura:"))
#proceso
area=(B*H)/2
#datos de salida
print("el area es: ", area) | 21.888889 | 32 | 0.71066 |
34d4e4b6e7b86d15d1faa785806544997cfd4d94 | 1,756 | py | Python | testing/session.py | edchelstephens/django-rest-utils | 15cee427149217d1e53384281894f91e9653b6b4 | [
"BSD-3-Clause"
] | 1 | 2022-02-20T01:37:25.000Z | 2022-02-20T01:37:25.000Z | testing/session.py | edchelstephens/django-rest-utils | 15cee427149217d1e53384281894f91e9653b6b4 | [
"BSD-3-Clause"
] | null | null | null | testing/session.py | edchelstephens/django-rest-utils | 15cee427149217d1e53384281894f91e9653b6b4 | [
"BSD-3-Clause"
] | null | null | null | from typing import Any, Optional
from django.contrib.sessions.middleware import SessionMiddleware
| 35.12 | 98 | 0.649772 |
34d967b2599f558aa7f42f79ee2207cb821523d7 | 2,930 | py | Python | test/integration/test_integration_halo.py | cloudpassage/provision_csp_accounts | a99fd6322116d5482bc183c4084a9066d81bc0b3 | [
"BSD-3-Clause"
] | 2 | 2020-02-11T21:47:55.000Z | 2021-01-16T02:49:06.000Z | test/integration/test_integration_halo.py | cloudpassage/provision_csp_accounts | a99fd6322116d5482bc183c4084a9066d81bc0b3 | [
"BSD-3-Clause"
] | 2 | 2019-05-31T22:30:46.000Z | 2020-02-11T21:31:38.000Z | test/integration/test_integration_halo.py | cloudpassage/provision_csp_accounts | a99fd6322116d5482bc183c4084a9066d81bc0b3 | [
"BSD-3-Clause"
] | 1 | 2020-02-11T21:05:34.000Z | 2020-02-11T21:05:34.000Z | import cloudpassage
import provisioner
import pytest
import os
here_dir = os.path.abspath(os.path.dirname(__file__))
fixture_dir = os.path.join(here_dir, "../fixture")
| 41.267606 | 91 | 0.695904 |
34da6249230478c06324343ddaaf9e58a8828973 | 22,665 | py | Python | tests/python3/test_lambda.py | pecigonzalo/aws-lambda-ddns-function | 06e6c06bced80611238734d202deb284a5680813 | [
"Apache-2.0"
] | 120 | 2018-02-14T21:36:45.000Z | 2022-03-23T20:52:17.000Z | tests/python3/test_lambda.py | pecigonzalo/aws-lambda-ddns-function | 06e6c06bced80611238734d202deb284a5680813 | [
"Apache-2.0"
] | 17 | 2018-03-29T09:21:23.000Z | 2021-04-21T21:48:42.000Z | tests/python3/test_lambda.py | pecigonzalo/aws-lambda-ddns-function | 06e6c06bced80611238734d202deb284a5680813 | [
"Apache-2.0"
] | 70 | 2018-02-15T13:03:05.000Z | 2022-02-24T13:52:43.000Z | import os
import sys
import boto3
import boto
import moto
import botocore
import unittest
import logging
import re
import sure
import botocore.session
from datetime import datetime
from moto import mock_sns_deprecated, mock_sqs_deprecated
from botocore.stub import Stubber
from freezegun import freeze_time
from mock import patch
#from moto import mock_dynamodb2, mock_dynamodb2_deprecated
#from moto.dynamodb2 import dynamodb_backend2
from moto import mock_ec2, mock_ec2_deprecated, mock_route53
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0,myPath+'/..')
from union_python3 import publish_to_sns, delete_item_from_dynamodb_table, get_subnet_cidr_block, get_item_from_dynamodb_table, list_hosted_zones, get_hosted_zone_properties, is_dns_support_enabled, is_dns_hostnames_enabled, associate_zone, create_reverse_lookup_zone, get_reversed_domain_prefix, reverse_list, get_dhcp_configurations, create_dynamodb_table, list_tables, put_item_in_dynamodb_table, get_dynamodb_table, create_table, change_resource_recordset, create_resource_record, delete_resource_record, get_zone_id, is_valid_hostname, get_dhcp_option_set_id_for_vpc
try:
import boto.dynamodb2
except ImportError:
print("This boto version is not supported")
logging.basicConfig(level=logging.DEBUG)
os.environ["AWS_ACCESS_KEY_ID"] = '1111'
os.environ["AWS_SECRET_ACCESS_KEY"] = '2222'
| 30.382038 | 571 | 0.528039 |
34db9103dcbc551abbdebff8ae585f4f1742d35b | 1,929 | py | Python | web/transiq/api/decorators.py | manibhushan05/transiq | 763fafb271ce07d13ac8ce575f2fee653cf39343 | [
"Apache-2.0"
] | null | null | null | web/transiq/api/decorators.py | manibhushan05/transiq | 763fafb271ce07d13ac8ce575f2fee653cf39343 | [
"Apache-2.0"
] | 14 | 2020-06-05T23:06:45.000Z | 2022-03-12T00:00:18.000Z | web/transiq/api/decorators.py | manibhushan05/transiq | 763fafb271ce07d13ac8ce575f2fee653cf39343 | [
"Apache-2.0"
] | null | null | null | import json
from api.helper import json_405_response, json_error_response
def no_test(func):
"""
Use for URLs that do not require testing, use wisely
"""
inner.__name__ = func.__name__
inner.__module__ = func.__module__
inner.__doc__ = func.__doc__
inner.__dict__ = func.__dict__
inner.do_not_test = True
return inner
| 30.619048 | 95 | 0.653188 |
34dbc736ddc462f2c6d882b037aad3cf68384021 | 16,484 | py | Python | ASHMC/courses/management/commands/populate_from_csv.py | haaksmash/Webfront | 8eb942394c568c681a83bc2c375d7552f4b3a30c | [
"Apache-2.0"
] | null | null | null | ASHMC/courses/management/commands/populate_from_csv.py | haaksmash/Webfront | 8eb942394c568c681a83bc2c375d7552f4b3a30c | [
"Apache-2.0"
] | null | null | null | ASHMC/courses/management/commands/populate_from_csv.py | haaksmash/Webfront | 8eb942394c568c681a83bc2c375d7552f4b3a30c | [
"Apache-2.0"
] | null | null | null | '''
Created on Apr 16, 2012
@author: Haak Saxberg
'''
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ObjectDoesNotExist
from django.db.utils import IntegrityError
from ...models import Campus, Course, Professor, Section, Meeting, Timeslot, Day, Semester,\
CourseArea, RoomInfo, Log, Department, Room, Building
import csv, pprint, re, datetime
| 44.672087 | 127 | 0.473186 |
34dcd15230933fd8287950f334911c981fecf57b | 858 | py | Python | Alura/MLClassificacao2/A4V4_Classificando_email.py | EduardoMoraesRitter/Alura | c0f5e7e9807e8e1d1dc46e6b847df8a8085783a6 | [
"MIT"
] | null | null | null | Alura/MLClassificacao2/A4V4_Classificando_email.py | EduardoMoraesRitter/Alura | c0f5e7e9807e8e1d1dc46e6b847df8a8085783a6 | [
"MIT"
] | null | null | null | Alura/MLClassificacao2/A4V4_Classificando_email.py | EduardoMoraesRitter/Alura | c0f5e7e9807e8e1d1dc46e6b847df8a8085783a6 | [
"MIT"
] | null | null | null | import pandas as pd
classificacoes = pd.read_csv('email.csv')
textosPuros = classificacoes['email']
textosQuebrados = textosPuros.str.lower().str.split(' ')
dicionario = set()
for lista in textosQuebrados:
dicionario.update(lista)
totalPalavras = len(dicionario)
tuplas = list(zip(dicionario, range(totalPalavras)))
tradutor = {palavra:indice for palavra, indice in tuplas}
print(totalPalavras)
#print(vetorizar_texto(textosQuebrados[0], tradutor))
#print(vetorizar_texto(textosQuebrados[1], tradutor))
#print(vetorizar_texto(textosQuebrados[2], tradutor))
vetoresDeTexto = [vetorizar_texto(texto, tradutor) for texto in textosQuebrados]
print(vetoresDeTexto)
| 28.6 | 80 | 0.749417 |
34dd7a78ed67d24dec24e1e267661e54ecc9605b | 23,901 | py | Python | tests/test_challonge.py | eprouty/dgcastle | b4b56f7675648987f30d016a45e716cb76c69516 | [
"MIT"
] | null | null | null | tests/test_challonge.py | eprouty/dgcastle | b4b56f7675648987f30d016a45e716cb76c69516 | [
"MIT"
] | 13 | 2017-01-30T15:38:38.000Z | 2017-06-09T00:15:58.000Z | tests/test_challonge.py | eprouty/dgcastle | b4b56f7675648987f30d016a45e716cb76c69516 | [
"MIT"
] | null | null | null | import copy
import os
import pickle
import unittest
from unittest.mock import patch
from dgcastle import dgcastle
from dgcastle.exceptions import IncompleteException
from dgcastle.exceptions import ValidationException
from dgcastle.handlers.challonge import Challonge
TEST_TOURNAMENT = pickle.loads(b'\x80\x03}q\x00(X\x02\x00\x00\x00idq\x01J.X6\x00X\x04\x00\x00\x00nameq\x02X\x07\x00\x00\x00DG Testq\x03X\x03\x00\x00\x00urlq\x04X\x08\x00\x00\x00mwtmsdjsq\x05X\x0b\x00\x00\x00descriptionq\x06X\x1b\x00\x00\x00This is just a test bracketq\x07X\x0f\x00\x00\x00tournament-typeq\x08X\x12\x00\x00\x00single eliminationq\tX\n\x00\x00\x00started-atq\ncdatetime\ndatetime\nq\x0bC\n\x07\xe1\x06\t\x0e,\x13\x00\x00\x00q\x0cciso8601.iso8601\nFixedOffset\nq\rJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\x0e\x87q\x0fRq\x10}q\x11(X\x1a\x00\x00\x00_FixedOffset__offset_hoursq\x12J\xfc\xff\xff\xffX\x1c\x00\x00\x00_FixedOffset__offset_minutesq\x13K\x00X\x14\x00\x00\x00_FixedOffset__offsetq\x14cdatetime\ntimedelta\nq\x15J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\x16Rq\x17X\x12\x00\x00\x00_FixedOffset__nameq\x18h\x0eub\x86q\x19Rq\x1aX\x0c\x00\x00\x00completed-atq\x1bh\x0bC\n\x07\xe1\x06\t\x10\x14$\x00\x00\x00q\x1ch\rJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\x1d\x87q\x1eRq\x1f}q (h\x12J\xfc\xff\xff\xffh\x13K\x00h\x14h\x15J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q!Rq"h\x18h\x1dub\x86q#Rq$X\x17\x00\x00\x00require-score-agreementq%\x89X\x1e\x00\x00\x00notify-users-when-matches-openq&\x88X\n\x00\x00\x00created-atq\'h\x0bC\n\x07\xe1\x06\t\x0e+\x10\x00\x00\x00q(h\rJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q)\x87q*Rq+}q,(h\x12J\xfc\xff\xff\xffh\x13K\x00h\x14h\x15J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q-Rq.h\x18h)ub\x86q/Rq0X\n\x00\x00\x00updated-atq1h\x0bC\n\x07\xe1\x06\t\x10\x14$\x00\x00\x00q2h\rJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q3\x87q4Rq5}q6(h\x12J\xfc\xff\xff\xffh\x13K\x00h\x14h\x15J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q7Rq8h\x18h3ub\x86q9Rq:X\x05\x00\x00\x00stateq;X\x08\x00\x00\x00completeq<X\x0b\x00\x00\x00open-signupq=\x89X%\x00\x00\x00notify-users-when-the-tournament-endsq>\x88X\x0e\x00\x00\x00progress-meterq?KdX\r\x00\x00\x00quick-advanceq@\x89X\x16\x00\x00\x00hold-third-place-matchqA\x89X\x10\x00\x00\x00pts-for-game-winqBcdecimal\nDecimal\nqCX\x03\x00\x00\x000.0qD\x85qERqFX\x10\x00\x00\x00pts-for-game-tieqGhCX\x03\x00\x00\x000.0qH\x85qIRqJX\x11\x00\x00\x00pts-for-match-winqKhCX\x03\x00\x00\x001.0qL\x85qMRqNX\x11\x00\x00\x00pts-for-match-tieqOhCX\x03\x00\x00\x000.5qP\x85qQRqRX\x0b\x00\x00\x00pts-for-byeqShCX\x03\x00\x00\x001.0qT\x85qURqVX\x0c\x00\x00\x00swiss-roundsqWK\x00X\x07\x00\x00\x00privateqX\x89X\t\x00\x00\x00ranked-byqYX\n\x00\x00\x00match winsqZX\x0b\x00\x00\x00show-roundsq[\x88X\n\x00\x00\x00hide-forumq\\\x89X\x13\x00\x00\x00sequential-pairingsq]\x89X\x12\x00\x00\x00accept-attachmentsq^\x89X\x13\x00\x00\x00rr-pts-for-game-winq_hCX\x03\x00\x00\x000.0q`\x85qaRqbX\x13\x00\x00\x00rr-pts-for-game-tieqchCX\x03\x00\x00\x000.0qd\x85qeRqfX\x14\x00\x00\x00rr-pts-for-match-winqghCX\x03\x00\x00\x001.0qh\x85qiRqjX\x14\x00\x00\x00rr-pts-for-match-tieqkhCX\x03\x00\x00\x000.5ql\x85qmRqnX\x0e\x00\x00\x00created-by-apiqo\x89X\r\x00\x00\x00credit-cappedqp\x89X\x08\x00\x00\x00categoryqqNX\n\x00\x00\x00hide-seedsqr\x89X\x11\x00\x00\x00prediction-methodqsK\x00X\x15\x00\x00\x00predictions-opened-atqtNX\x10\x00\x00\x00anonymous-votingqu\x89X\x18\x00\x00\x00max-predictions-per-userqvK\x01X\n\x00\x00\x00signup-capqwNX\x07\x00\x00\x00game-idqxK@X\x12\x00\x00\x00participants-countqyK\x08X\x14\x00\x00\x00group-stages-enabledqz\x89X!\x00\x00\x00allow-participant-match-reportingq{\x88X\x05\x00\x00\x00teamsq|\x89X\x11\x00\x00\x00check-in-durationq}NX\x08\x00\x00\x00start-atq~NX\x16\x00\x00\x00started-checking-in-atq\x7fNX\n\x00\x00\x00tie-breaksq\x80X\x05\x00\x00\x00\n q\x81X\t\x00\x00\x00locked-atq\x82NX\x08\x00\x00\x00event-idq\x83NX$\x00\x00\x00public-predictions-before-start-timeq\x84\x89X\x06\x00\x00\x00rankedq\x85\x89X\x15\x00\x00\x00grand-finals-modifierq\x86NX\x1a\x00\x00\x00predict-the-losers-bracketq\x87\x89X\x04\x00\x00\x00spamq\x88NX\x03\x00\x00\x00hamq\x89NX\x12\x00\x00\x00description-sourceq\x8aX\x1b\x00\x00\x00This is just a test bracketq\x8bX\t\x00\x00\x00subdomainq\x8cNX\x12\x00\x00\x00full-challonge-urlq\x8dX\x1d\x00\x00\x00http://challonge.com/mwtmsdjsq\x8eX\x0e\x00\x00\x00live-image-urlq\x8fX!\x00\x00\x00http://challonge.com/mwtmsdjs.svgq\x90X\x0b\x00\x00\x00sign-up-urlq\x91NX\x18\x00\x00\x00review-before-finalizingq\x92\x88X\x15\x00\x00\x00accepting-predictionsq\x93\x89X\x13\x00\x00\x00participants-lockedq\x94\x88X\t\x00\x00\x00game-nameq\x95X\t\x00\x00\x00Disc Golfq\x96X\x16\x00\x00\x00participants-swappableq\x97\x89X\x10\x00\x00\x00team-convertableq\x98\x89X\x19\x00\x00\x00group-stages-were-startedq\x99\x89u.')
TEST_MATCH_INDEX = pickle.loads(b'\x80\x03]q\x00(}q\x01(X\x02\x00\x00\x00idq\x02J\xef\xd0Z\x05X\r\x00\x00\x00tournament-idq\x03J.X6\x00X\x05\x00\x00\x00stateq\x04X\x08\x00\x00\x00completeq\x05X\n\x00\x00\x00player1-idq\x06J\xfc.c\x03X\n\x00\x00\x00player2-idq\x07J\x0e/c\x03X\x17\x00\x00\x00player1-prereq-match-idq\x08NX\x17\x00\x00\x00player2-prereq-match-idq\tNX\x1d\x00\x00\x00player1-is-prereq-match-loserq\n\x89X\x1d\x00\x00\x00player2-is-prereq-match-loserq\x0b\x89X\t\x00\x00\x00winner-idq\x0cJ\xfc.c\x03X\x08\x00\x00\x00loser-idq\rJ\x0e/c\x03X\n\x00\x00\x00started-atq\x0ecdatetime\ndatetime\nq\x0fC\n\x07\xe1\x06\t\x0e,\x13\x00\x00\x00q\x10ciso8601.iso8601\nFixedOffset\nq\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\x12\x87q\x13Rq\x14}q\x15(X\x1a\x00\x00\x00_FixedOffset__offset_hoursq\x16J\xfc\xff\xff\xffX\x1c\x00\x00\x00_FixedOffset__offset_minutesq\x17K\x00X\x14\x00\x00\x00_FixedOffset__offsetq\x18cdatetime\ntimedelta\nq\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\x1aRq\x1bX\x12\x00\x00\x00_FixedOffset__nameq\x1ch\x12ub\x86q\x1dRq\x1eX\n\x00\x00\x00created-atq\x1fh\x0fC\n\x07\xe1\x06\t\x0e,\x13\x00\x00\x00q h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q!\x87q"Rq#}q$(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q%Rq&h\x1ch!ub\x86q\'Rq(X\n\x00\x00\x00updated-atq)h\x0fC\n\x07\xe1\x06\t\x0e-\r\x00\x00\x00q*h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q+\x87q,Rq-}q.(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q/Rq0h\x1ch+ub\x86q1Rq2X\n\x00\x00\x00identifierq3X\x01\x00\x00\x00Aq4X\x0e\x00\x00\x00has-attachmentq5\x89X\x05\x00\x00\x00roundq6K\x01X\r\x00\x00\x00player1-votesq7NX\r\x00\x00\x00player2-votesq8NX\x08\x00\x00\x00group-idq9NX\x10\x00\x00\x00attachment-countq:NX\x0e\x00\x00\x00scheduled-timeq;NX\x08\x00\x00\x00locationq<NX\x0b\x00\x00\x00underway-atq=NX\x08\x00\x00\x00optionalq>\x89X\x08\x00\x00\x00rushb-idq?NX\x0c\x00\x00\x00completed-atq@h\x0fC\n\x07\xe1\x06\t\x0e-\r\x00\x00\x00qAh\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00qB\x87qCRqD}qE(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87qFRqGh\x1chBub\x86qHRqIX\x14\x00\x00\x00suggested-play-orderqJK\x01X\x1a\x00\x00\x00prerequisite-match-ids-csvqKNX\n\x00\x00\x00scores-csvqLX\x03\x00\x00\x002-0qMu}qN(h\x02J\xf0\xd0Z\x05h\x03J.X6\x00h\x04X\x08\x00\x00\x00completeqOh\x06J\xff.c\x03h\x07J\x00/c\x03h\x08Nh\tNh\n\x89h\x0b\x89h\x0cJ\x00/c\x03h\rJ\xff.c\x03h\x0eh\x0fC\n\x07\xe1\x06\t\x0e,\x13\x00\x00\x00qPh\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00qQ\x87qRRqS}qT(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87qURqVh\x1chQub\x86qWRqXh\x1fh\x0fC\n\x07\xe1\x06\t\x0e,\x13\x00\x00\x00qYh\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00qZ\x87q[Rq\\}q](h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q^Rq_h\x1chZub\x86q`Rqah)h\x0fC\n\x07\xe1\x06\t\x10\x123\x00\x00\x00qbh\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00qc\x87qdRqe}qf(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87qgRqhh\x1chcub\x86qiRqjh3X\x01\x00\x00\x00Bqkh5\x89h6K\x01h7Nh8Nh9Nh:Nh;Nh<Nh=Nh>\x89h?Nh@h\x0fC\n\x07\xe1\x06\t\x10\x123\x00\x00\x00qlh\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00qm\x87qnRqo}qp(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87qqRqrh\x1chmub\x86qsRqthJK\x02hKNhLX\x03\x00\x00\x002-4quu}qv(h\x02J\xf1\xd0Z\x05h\x03J.X6\x00h\x04X\x08\x00\x00\x00completeqwh\x06J\xfd.c\x03h\x07J\x02/c\x03h\x08Nh\tNh\n\x89h\x0b\x89h\x0cJ\x02/c\x03h\rJ\xfd.c\x03h\x0eh\x0fC\n\x07\xe1\x06\t\x0e,\x13\x00\x00\x00qxh\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00qy\x87qzRq{}q|(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q}Rq~h\x1chyub\x86q\x7fRq\x80h\x1fh\x0fC\n\x07\xe1\x06\t\x0e,\x13\x00\x00\x00q\x81h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\x82\x87q\x83Rq\x84}q\x85(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\x86Rq\x87h\x1ch\x82ub\x86q\x88Rq\x89h)h\x0fC\n\x07\xe1\x06\t\x10\x13\r\x00\x00\x00q\x8ah\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\x8b\x87q\x8cRq\x8d}q\x8e(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\x8fRq\x90h\x1ch\x8bub\x86q\x91Rq\x92h3X\x01\x00\x00\x00Cq\x93h5\x89h6K\x01h7Nh8Nh9Nh:Nh;Nh<Nh=Nh>\x89h?Nh@h\x0fC\n\x07\xe1\x06\t\x10\x13\r\x00\x00\x00q\x94h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\x95\x87q\x96Rq\x97}q\x98(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\x99Rq\x9ah\x1ch\x95ub\x86q\x9bRq\x9chJK\x03hKNhLX\x03\x00\x00\x000-2q\x9du}q\x9e(h\x02J\xf2\xd0Z\x05h\x03J.X6\x00h\x04X\x08\x00\x00\x00completeq\x9fh\x06J\xfe.c\x03h\x07J\x01/c\x03h\x08Nh\tNh\n\x89h\x0b\x89h\x0cJ\xfe.c\x03h\rJ\x01/c\x03h\x0eh\x0fC\n\x07\xe1\x06\t\x0e,\x13\x00\x00\x00q\xa0h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xa1\x87q\xa2Rq\xa3}q\xa4(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xa5Rq\xa6h\x1ch\xa1ub\x86q\xa7Rq\xa8h\x1fh\x0fC\n\x07\xe1\x06\t\x0e,\x13\x00\x00\x00q\xa9h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xaa\x87q\xabRq\xac}q\xad(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xaeRq\xafh\x1ch\xaaub\x86q\xb0Rq\xb1h)h\x0fC\n\x07\xe1\x06\t\x10\x134\x00\x00\x00q\xb2h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xb3\x87q\xb4Rq\xb5}q\xb6(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xb7Rq\xb8h\x1ch\xb3ub\x86q\xb9Rq\xbah3X\x01\x00\x00\x00Dq\xbbh5\x89h6K\x01h7Nh8Nh9Nh:Nh;Nh<Nh=Nh>\x89h?Nh@h\x0fC\n\x07\xe1\x06\t\x10\x134\x00\x00\x00q\xbch\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xbd\x87q\xbeRq\xbf}q\xc0(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xc1Rq\xc2h\x1ch\xbdub\x86q\xc3Rq\xc4hJK\x04hKNhLX\x03\x00\x00\x009-8q\xc5u}q\xc6(h\x02J\xf3\xd0Z\x05h\x03J.X6\x00h\x04X\x08\x00\x00\x00completeq\xc7h\x06J\xfc.c\x03h\x07J\x00/c\x03h\x08J\xef\xd0Z\x05h\tJ\xf0\xd0Z\x05h\n\x89h\x0b\x89h\x0cJ\xfc.c\x03h\rJ\x00/c\x03h\x0eh\x0fC\n\x07\xe1\x06\t\x10\x123\x00\x00\x00q\xc8h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xc9\x87q\xcaRq\xcb}q\xcc(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xcdRq\xceh\x1ch\xc9ub\x86q\xcfRq\xd0h\x1fh\x0fC\n\x07\xe1\x06\t\x0e,\x13\x00\x00\x00q\xd1h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xd2\x87q\xd3Rq\xd4}q\xd5(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xd6Rq\xd7h\x1ch\xd2ub\x86q\xd8Rq\xd9h)h\x0fC\n\x07\xe1\x06\t\x10\x14\x0c\x00\x00\x00q\xdah\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xdb\x87q\xdcRq\xdd}q\xde(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xdfRq\xe0h\x1ch\xdbub\x86q\xe1Rq\xe2h3X\x01\x00\x00\x00Eq\xe3h5\x89h6K\x02h7Nh8Nh9Nh:Nh;Nh<Nh=Nh>\x89h?Nh@h\x0fC\n\x07\xe1\x06\t\x10\x14\x0c\x00\x00\x00q\xe4h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xe5\x87q\xe6Rq\xe7}q\xe8(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xe9Rq\xeah\x1ch\xe5ub\x86q\xebRq\xechJK\x05hKX\x11\x00\x00\x0089837807,89837808q\xedhLX\x03\x00\x00\x001-0q\xeeu}q\xef(h\x02J\xf4\xd0Z\x05h\x03J.X6\x00h\x04X\x08\x00\x00\x00completeq\xf0h\x06J\x02/c\x03h\x07J\xfe.c\x03h\x08J\xf1\xd0Z\x05h\tJ\xf2\xd0Z\x05h\n\x89h\x0b\x89h\x0cJ\xfe.c\x03h\rJ\x02/c\x03h\x0eh\x0fC\n\x07\xe1\x06\t\x10\x134\x00\x00\x00q\xf1h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xf2\x87q\xf3Rq\xf4}q\xf5(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xf6Rq\xf7h\x1ch\xf2ub\x86q\xf8Rq\xf9h\x1fh\x0fC\n\x07\xe1\x06\t\x0e,\x13\x00\x00\x00q\xfah\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xfb\x87q\xfcRq\xfd}q\xfe(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xffRr\x00\x01\x00\x00h\x1ch\xfbub\x86r\x01\x01\x00\x00Rr\x02\x01\x00\x00h)h\x0fC\n\x07\xe1\x06\t\x10\x14\x02\x00\x00\x00r\x03\x01\x00\x00h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00r\x04\x01\x00\x00\x87r\x05\x01\x00\x00Rr\x06\x01\x00\x00}r\x07\x01\x00\x00(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87r\x08\x01\x00\x00Rr\t\x01\x00\x00h\x1cj\x04\x01\x00\x00ub\x86r\n\x01\x00\x00Rr\x0b\x01\x00\x00h3X\x01\x00\x00\x00Fr\x0c\x01\x00\x00h5\x89h6K\x02h7Nh8Nh9Nh:Nh;Nh<Nh=Nh>\x89h?Nh@h\x0fC\n\x07\xe1\x06\t\x10\x14\x02\x00\x00\x00r\r\x01\x00\x00h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00r\x0e\x01\x00\x00\x87r\x0f\x01\x00\x00Rr\x10\x01\x00\x00}r\x11\x01\x00\x00(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87r\x12\x01\x00\x00Rr\x13\x01\x00\x00h\x1cj\x0e\x01\x00\x00ub\x86r\x14\x01\x00\x00Rr\x15\x01\x00\x00hJK\x06hKX\x11\x00\x00\x0089837809,89837810r\x16\x01\x00\x00hLX\x03\x00\x00\x003-4r\x17\x01\x00\x00u}r\x18\x01\x00\x00(h\x02J\xf5\xd0Z\x05h\x03J.X6\x00h\x04X\x08\x00\x00\x00completer\x19\x01\x00\x00h\x06J\xfc.c\x03h\x07J\xfe.c\x03h\x08J\xf3\xd0Z\x05h\tJ\xf4\xd0Z\x05h\n\x89h\x0b\x89h\x0cJ\xfe.c\x03h\rJ\xfc.c\x03h\x0eh\x0fC\n\x07\xe1\x06\t\x10\x14\x0c\x00\x00\x00r\x1a\x01\x00\x00h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00r\x1b\x01\x00\x00\x87r\x1c\x01\x00\x00Rr\x1d\x01\x00\x00}r\x1e\x01\x00\x00(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87r\x1f\x01\x00\x00Rr \x01\x00\x00h\x1cj\x1b\x01\x00\x00ub\x86r!\x01\x00\x00Rr"\x01\x00\x00h\x1fh\x0fC\n\x07\xe1\x06\t\x0e,\x13\x00\x00\x00r#\x01\x00\x00h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00r$\x01\x00\x00\x87r%\x01\x00\x00Rr&\x01\x00\x00}r\'\x01\x00\x00(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87r(\x01\x00\x00Rr)\x01\x00\x00h\x1cj$\x01\x00\x00ub\x86r*\x01\x00\x00Rr+\x01\x00\x00h)h\x0fC\n\x07\xe1\x06\t\x10\x14\x1d\x00\x00\x00r,\x01\x00\x00h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00r-\x01\x00\x00\x87r.\x01\x00\x00Rr/\x01\x00\x00}r0\x01\x00\x00(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87r1\x01\x00\x00Rr2\x01\x00\x00h\x1cj-\x01\x00\x00ub\x86r3\x01\x00\x00Rr4\x01\x00\x00h3X\x01\x00\x00\x00Gr5\x01\x00\x00h5\x89h6K\x03h7Nh8Nh9Nh:Nh;Nh<Nh=Nh>\x89h?Nh@h\x0fC\n\x07\xe1\x06\t\x10\x14\x1d\x00\x00\x00r6\x01\x00\x00h\x11J\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00r7\x01\x00\x00\x87r8\x01\x00\x00Rr9\x01\x00\x00}r:\x01\x00\x00(h\x16J\xfc\xff\xff\xffh\x17K\x00h\x18h\x19J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87r;\x01\x00\x00Rr<\x01\x00\x00h\x1cj7\x01\x00\x00ub\x86r=\x01\x00\x00Rr>\x01\x00\x00hJK\x07hKX\x11\x00\x00\x0089837811,89837812r?\x01\x00\x00hLX\x03\x00\x00\x001-3r@\x01\x00\x00ue.')
TEST_PARTICIPANTS_INDEX = pickle.loads(b'\x80\x03]q\x00(}q\x01(X\x02\x00\x00\x00idq\x02J\xfc.c\x03X\r\x00\x00\x00tournament-idq\x03J.X6\x00X\x04\x00\x00\x00nameq\x04X\x01\x00\x00\x00Aq\x05X\x04\x00\x00\x00seedq\x06K\x01X\x06\x00\x00\x00activeq\x07\x88X\n\x00\x00\x00created-atq\x08cdatetime\ndatetime\nq\tC\n\x07\xe1\x06\t\x0e+/\x00\x00\x00q\nciso8601.iso8601\nFixedOffset\nq\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\x0c\x87q\rRq\x0e}q\x0f(X\x1a\x00\x00\x00_FixedOffset__offset_hoursq\x10J\xfc\xff\xff\xffX\x1c\x00\x00\x00_FixedOffset__offset_minutesq\x11K\x00X\x14\x00\x00\x00_FixedOffset__offsetq\x12cdatetime\ntimedelta\nq\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\x14Rq\x15X\x12\x00\x00\x00_FixedOffset__nameq\x16h\x0cub\x86q\x17Rq\x18X\n\x00\x00\x00updated-atq\x19h\tC\n\x07\xe1\x06\t\x0e,\x0f\x00\x00\x00q\x1ah\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\x1b\x87q\x1cRq\x1d}q\x1e(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\x1fRq h\x16h\x1bub\x86q!Rq"X\x0c\x00\x00\x00invite-emailq#NX\n\x00\x00\x00final-rankq$K\x02X\x04\x00\x00\x00miscq%NX\x04\x00\x00\x00iconq&NX\x0f\x00\x00\x00on-waiting-listq\'\x89X\r\x00\x00\x00invitation-idq(NX\x08\x00\x00\x00group-idq)NX\r\x00\x00\x00checked-in-atq*NX\x12\x00\x00\x00challonge-usernameq+NX \x00\x00\x00challonge-email-address-verifiedq,NX\t\x00\x00\x00removableq-\x89X%\x00\x00\x00participatable-or-invitation-attachedq.\x89X\x0e\x00\x00\x00confirm-removeq/\x88X\x12\x00\x00\x00invitation-pendingq0\x89X*\x00\x00\x00display-name-with-invitation-email-addressq1h\x05X\n\x00\x00\x00email-hashq2NX\x08\x00\x00\x00usernameq3NX\x0c\x00\x00\x00display-nameq4h\x05X$\x00\x00\x00attached-participatable-portrait-urlq5NX\x0c\x00\x00\x00can-check-inq6\x89X\n\x00\x00\x00checked-inq7\x89X\r\x00\x00\x00reactivatableq8\x89X\r\x00\x00\x00check-in-openq9\x89X\x10\x00\x00\x00group-player-idsq:NX\x13\x00\x00\x00has-irrelevant-seedq;\x89u}q<(h\x02J\xfd.c\x03h\x03J.X6\x00h\x04X\x01\x00\x00\x00Bq=h\x06K\x02h\x07\x88h\x08h\tC\n\x07\xe1\x06\t\x0e+/\x00\x00\x00q>h\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q?\x87q@RqA}qB(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87qCRqDh\x16h?ub\x86qERqFh\x19h\tC\n\x07\xe1\x06\t\x0e+/\x00\x00\x00qGh\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00qH\x87qIRqJ}qK(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87qLRqMh\x16hHub\x86qNRqOh#Nh$K\x05h%Nh&Nh\'\x89h(Nh)Nh*Nh+Nh,Nh-\x89h.\x89h/\x88h0\x89h1h=h2Nh3Nh4h=h5Nh6\x89h7\x89h8\x89h9\x89h:Nh;\x89u}qP(h\x02J\xfe.c\x03h\x03J.X6\x00h\x04X\x01\x00\x00\x00CqQh\x06K\x03h\x07\x88h\x08h\tC\n\x07\xe1\x06\t\x0e+/\x00\x00\x00qRh\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00qS\x87qTRqU}qV(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87qWRqXh\x16hSub\x86qYRqZh\x19h\tC\n\x07\xe1\x06\t\x0e+/\x00\x00\x00q[h\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\\\x87q]Rq^}q_(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q`Rqah\x16h\\ub\x86qbRqch#Nh$K\x01h%Nh&Nh\'\x89h(Nh)Nh*Nh+Nh,Nh-\x89h.\x89h/\x88h0\x89h1hQh2Nh3Nh4hQh5Nh6\x89h7\x89h8\x89h9\x89h:Nh;\x89u}qd(h\x02J\xff.c\x03h\x03J.X6\x00h\x04X\x01\x00\x00\x00Dqeh\x06K\x04h\x07\x88h\x08h\tC\n\x07\xe1\x06\t\x0e+/\x00\x00\x00qfh\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00qg\x87qhRqi}qj(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87qkRqlh\x16hgub\x86qmRqnh\x19h\tC\n\x07\xe1\x06\t\x0e+/\x00\x00\x00qoh\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00qp\x87qqRqr}qs(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87qtRquh\x16hpub\x86qvRqwh#Nh$K\x05h%Nh&Nh\'\x89h(Nh)Nh*Nh+Nh,Nh-\x89h.\x89h/\x88h0\x89h1heh2Nh3Nh4heh5Nh6\x89h7\x89h8\x89h9\x89h:Nh;\x89u}qx(h\x02J\x00/c\x03h\x03J.X6\x00h\x04X\x01\x00\x00\x00Eqyh\x06K\x05h\x07\x88h\x08h\tC\n\x07\xe1\x06\t\x0e+/\x00\x00\x00qzh\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q{\x87q|Rq}}q~(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\x7fRq\x80h\x16h{ub\x86q\x81Rq\x82h\x19h\tC\n\x07\xe1\x06\t\x0e+/\x00\x00\x00q\x83h\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\x84\x87q\x85Rq\x86}q\x87(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\x88Rq\x89h\x16h\x84ub\x86q\x8aRq\x8bh#Nh$K\x03h%Nh&Nh\'\x89h(Nh)Nh*Nh+Nh,Nh-\x89h.\x89h/\x88h0\x89h1hyh2Nh3Nh4hyh5Nh6\x89h7\x89h8\x89h9\x89h:Nh;\x89u}q\x8c(h\x02J\x01/c\x03h\x03J.X6\x00h\x04X\x01\x00\x00\x00Fq\x8dh\x06K\x06h\x07\x88h\x08h\tC\n\x07\xe1\x06\t\x0e+/\x00\x00\x00q\x8eh\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\x8f\x87q\x90Rq\x91}q\x92(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\x93Rq\x94h\x16h\x8fub\x86q\x95Rq\x96h\x19h\tC\n\x07\xe1\x06\t\x0e+/\x00\x00\x00q\x97h\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\x98\x87q\x99Rq\x9a}q\x9b(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\x9cRq\x9dh\x16h\x98ub\x86q\x9eRq\x9fh#Nh$K\x05h%Nh&Nh\'\x89h(Nh)Nh*Nh+Nh,Nh-\x89h.\x89h/\x88h0\x89h1h\x8dh2Nh3Nh4h\x8dh5Nh6\x89h7\x89h8\x89h9\x89h:Nh;\x89u}q\xa0(h\x02J\x02/c\x03h\x03J.X6\x00h\x04X\x01\x00\x00\x00Gq\xa1h\x06K\x07h\x07\x88h\x08h\tC\n\x07\xe1\x06\t\x0e+/\x00\x00\x00q\xa2h\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xa3\x87q\xa4Rq\xa5}q\xa6(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xa7Rq\xa8h\x16h\xa3ub\x86q\xa9Rq\xaah\x19h\tC\n\x07\xe1\x06\t\x0e+/\x00\x00\x00q\xabh\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xac\x87q\xadRq\xae}q\xaf(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xb0Rq\xb1h\x16h\xacub\x86q\xb2Rq\xb3h#Nh$K\x03h%Nh&Nh\'\x89h(Nh)Nh*Nh+Nh,Nh-\x89h.\x89h/\x88h0\x89h1h\xa1h2Nh3Nh4h\xa1h5Nh6\x89h7\x89h8\x89h9\x89h:Nh;\x89u}q\xb4(h\x02J\x0e/c\x03h\x03J.X6\x00h\x04X\x01\x00\x00\x00Hq\xb5h\x06K\x08h\x07\x88h\x08h\tC\n\x07\xe1\x06\t\x0e+8\x00\x00\x00q\xb6h\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xb7\x87q\xb8Rq\xb9}q\xba(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xbbRq\xbch\x16h\xb7ub\x86q\xbdRq\xbeh\x19h\tC\n\x07\xe1\x06\t\x0e,\x0f\x00\x00\x00q\xbfh\x0bJ\xfc\xff\xff\xffK\x00X\x06\x00\x00\x00-04:00q\xc0\x87q\xc1Rq\xc2}q\xc3(h\x10J\xfc\xff\xff\xffh\x11K\x00h\x12h\x13J\xff\xff\xff\xffJ@\x19\x01\x00K\x00\x87q\xc4Rq\xc5h\x16h\xc0ub\x86q\xc6Rq\xc7h#Nh$K\x05h%Nh&Nh\'\x89h(Nh)Nh*Nh+Nh,Nh-\x89h.\x89h/\x88h0\x89h1h\xb5h2Nh3Nh4h\xb5h5Nh6\x89h7\x89h8\x89h9\x89h:Nh;\x89ue.') | 426.803571 | 10,690 | 0.770554 |
34e14659ac3348a14f3cb971dd1656c1b96e47ab | 4,917 | py | Python | MIDI Remote Scripts/pushbase/step_duplicator.py | aarkwright/ableton_devices | fe5df3bbd64ccbc136bba722ba1e131a02969798 | [
"MIT"
] | null | null | null | MIDI Remote Scripts/pushbase/step_duplicator.py | aarkwright/ableton_devices | fe5df3bbd64ccbc136bba722ba1e131a02969798 | [
"MIT"
] | null | null | null | MIDI Remote Scripts/pushbase/step_duplicator.py | aarkwright/ableton_devices | fe5df3bbd64ccbc136bba722ba1e131a02969798 | [
"MIT"
] | null | null | null | # uncompyle6 version 3.3.5
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)]
# Embedded file name: c:\Jenkins\live\output\win_64_static\Release\python-bundle\MIDI Remote Scripts\pushbase\step_duplicator.py
# Compiled at: 2018-11-30 15:48:12
from __future__ import absolute_import, print_function, unicode_literals
from functools import partial
from ableton.v2.base import liveobj_valid, nop
from ableton.v2.control_surface import Component
from ableton.v2.control_surface.control import ButtonControl
from .consts import MessageBoxText
from .message_box_component import Messenger
ALL_NOTES = -1
| 39.653226 | 216 | 0.690462 |
34e3c30f1eecc4a83cc074f6ae2e470a42d8d132 | 1,058 | py | Python | cride/users/models/exchanges.py | albertoaldanar/betmatcherAPI | c0590025efd79f4e489f9c9433b17554ea6ba23f | [
"MIT"
] | null | null | null | cride/users/models/exchanges.py | albertoaldanar/betmatcherAPI | c0590025efd79f4e489f9c9433b17554ea6ba23f | [
"MIT"
] | 7 | 2020-06-05T20:53:27.000Z | 2022-03-11T23:47:12.000Z | cride/users/models/exchanges.py | albertoaldanar/betmatcherAPI | c0590025efd79f4e489f9c9433b17554ea6ba23f | [
"MIT"
] | null | null | null | from django.db import models
#Utilities
from cride.utils.models import BetmatcherModel
| 28.594595 | 74 | 0.6862 |
34e4d3ae291ecf089e466ddec64c7d9c23c88213 | 1,540 | py | Python | Python/Examples/Macros/MoveAxis.py | halmusaibeli/RoboDK-API | e017aa26715bc8d0fcbbc05e57acc32f2d2d6174 | [
"MIT"
] | null | null | null | Python/Examples/Macros/MoveAxis.py | halmusaibeli/RoboDK-API | e017aa26715bc8d0fcbbc05e57acc32f2d2d6174 | [
"MIT"
] | null | null | null | Python/Examples/Macros/MoveAxis.py | halmusaibeli/RoboDK-API | e017aa26715bc8d0fcbbc05e57acc32f2d2d6174 | [
"MIT"
] | null | null | null | # This macro allows changing the position of an external axis by hand or within a program as a function call.
# Example of a function call (units are in mm or deg):
# MoveAxis(0)
# MoveAxis(100)
# https://robodk.com/doc/en/RoboDK-API.html
import sys # allows getting the passed argument parameters
from robodk.robodialogs import *
# Enter the name of the axis (leave empty to select the first mechanism/robot available
MECHANISM_NAME = ''
# Enter the default value:
DEFAULT_VALUE = 0
# Set to blocking to make the program wait until it the axis stopped moving
BLOCKING = True
# --------------- PROGRAM START -------------------------
VALUE = DEFAULT_VALUE
if len(sys.argv) < 2:
# Promt the user to enter a new value if the macro is just double clicked
print('This macro be called as MoveAxis(value)')
print('Number of arguments: ' + str(len(sys.argv)))
#raise Exception('Invalid parameters provided: ' + str(sys.argv))
entry = mbox('Move one axis. Enter the new value in mm or deg\n\nNote: this can be called as a program.\nExample: MoveAxis(VALUE)', entry=str(DEFAULT_VALUE))
if not entry:
#raise Exception('Operation cancelled by user')
quit()
VALUE = float(entry)
else:
# Take the argument as new joint value
VALUE = float(sys.argv[1])
# Use the RoboDK API:
from robodk.robolink import * # API to communicate with RoboDK
RDK = Robolink()
# Get the robot item:
axis = RDK.Item(MECHANISM_NAME, ITEM_TYPE_ROBOT)
# Move the robot/mechanism
axis.MoveJ([VALUE], BLOCKING)
| 32.765957 | 161 | 0.698701 |
34e56db9261caf77c7f05ca57c7245a93b1deefe | 11,035 | py | Python | tests/test_setup.py | rozuur/ptvsd | 046fd0f054b2eed91ec5df02e5f36151b71e36b1 | [
"MIT"
] | null | null | null | tests/test_setup.py | rozuur/ptvsd | 046fd0f054b2eed91ec5df02e5f36151b71e36b1 | [
"MIT"
] | null | null | null | tests/test_setup.py | rozuur/ptvsd | 046fd0f054b2eed91ec5df02e5f36151b71e36b1 | [
"MIT"
] | null | null | null | import os.path
import unittest
from setup import iter_vendored_files
VENDORED = {file.replace('/', os.path.sep) for file in [
'pydevd/pydev_run_in_console.py',
'pydevd/setup_cython.py',
'pydevd/pydev_app_engine_debug_startup.py',
'pydevd/pydevd_tracing.py',
'pydevd/pydev_pysrc.py',
'pydevd/pydevconsole.py',
'pydevd/pydevd.py',
'pydevd/pydev_coverage.py',
'pydevd/pydevd_file_utils.py',
'pydevd/pydevd_attach_to_process/attach_linux_x86.so',
'pydevd/pydevd_attach_to_process/attach_pydevd.py',
'pydevd/pydevd_attach_to_process/attach_amd64.dll',
'pydevd/pydevd_attach_to_process/_test_attach_to_process.py',
'pydevd/pydevd_attach_to_process/attach_linux_amd64.so',
'pydevd/pydevd_attach_to_process/attach_x86.dll',
'pydevd/pydevd_attach_to_process/_always_live_program.py',
'pydevd/pydevd_attach_to_process/attach_x86.dylib',
'pydevd/pydevd_attach_to_process/_check.py',
'pydevd/pydevd_attach_to_process/README.txt',
'pydevd/pydevd_attach_to_process/add_code_to_python_process.py',
'pydevd/pydevd_attach_to_process/attach_x86_64.dylib',
'pydevd/pydevd_attach_to_process/attach_script.py',
'pydevd/pydevd_attach_to_process/_test_attach_to_process_linux.py',
'pydevd/pydevd_attach_to_process/dll/attach.h',
'pydevd/pydevd_attach_to_process/dll/python.h',
'pydevd/pydevd_attach_to_process/dll/attach.cpp',
'pydevd/pydevd_attach_to_process/dll/stdafx.h',
'pydevd/pydevd_attach_to_process/dll/compile_dll.bat',
'pydevd/pydevd_attach_to_process/dll/stdafx.cpp',
'pydevd/pydevd_attach_to_process/dll/targetver.h',
'pydevd/pydevd_attach_to_process/winappdbg/module.py',
'pydevd/pydevd_attach_to_process/winappdbg/event.py',
'pydevd/pydevd_attach_to_process/winappdbg/process.py',
'pydevd/pydevd_attach_to_process/winappdbg/thread.py',
'pydevd/pydevd_attach_to_process/winappdbg/disasm.py',
'pydevd/pydevd_attach_to_process/winappdbg/textio.py',
'pydevd/pydevd_attach_to_process/winappdbg/sql.py',
'pydevd/pydevd_attach_to_process/winappdbg/util.py',
'pydevd/pydevd_attach_to_process/winappdbg/crash.py',
'pydevd/pydevd_attach_to_process/winappdbg/registry.py',
'pydevd/pydevd_attach_to_process/winappdbg/breakpoint.py',
'pydevd/pydevd_attach_to_process/winappdbg/search.py',
'pydevd/pydevd_attach_to_process/winappdbg/compat.py',
'pydevd/pydevd_attach_to_process/winappdbg/window.py',
'pydevd/pydevd_attach_to_process/winappdbg/interactive.py',
'pydevd/pydevd_attach_to_process/winappdbg/__init__.py',
'pydevd/pydevd_attach_to_process/winappdbg/system.py',
'pydevd/pydevd_attach_to_process/winappdbg/debug.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/shlwapi.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/kernel32.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/advapi32.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/__init__.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/psapi.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/defines.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/user32.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/dbghelp.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/version.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/peb_teb.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/context_amd64.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/shell32.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/ntdll.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/wtsapi32.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/context_i386.py',
'pydevd/pydevd_attach_to_process/winappdbg/win32/gdi32.py',
'pydevd/pydevd_attach_to_process/winappdbg/plugins/__init__.py',
'pydevd/pydevd_attach_to_process/winappdbg/plugins/do_symfix.py',
'pydevd/pydevd_attach_to_process/winappdbg/plugins/README',
'pydevd/pydevd_attach_to_process/winappdbg/plugins/do_exchain.py',
'pydevd/pydevd_attach_to_process/winappdbg/plugins/do_example.py',
'pydevd/pydevd_attach_to_process/winappdbg/plugins/do_exploitable.py',
'pydevd/pydevd_attach_to_process/linux/gdb_threads_settrace.py',
'pydevd/pydevd_attach_to_process/linux/compile_mac.sh',
'pydevd/pydevd_attach_to_process/linux/Makefile',
'pydevd/pydevd_attach_to_process/linux/lldb_prepare.py',
'pydevd/pydevd_attach_to_process/linux/compile_so.sh',
'pydevd/pydevd_attach_to_process/linux/python.h',
'pydevd/pydevd_attach_to_process/linux/attach_linux.c',
'pydevd/pydevd_attach_to_process/linux/lldb_threads_settrace.py',
'pydevd/_pydev_bundle/_pydev_imports_tipper.py',
'pydevd/_pydev_bundle/_pydev_getopt.py',
'pydevd/_pydev_bundle/pydev_umd.py',
'pydevd/_pydev_bundle/fix_getpass.py',
'pydevd/_pydev_bundle/pydev_is_thread_alive.py',
'pydevd/_pydev_bundle/pydev_ipython_console.py',
'pydevd/_pydev_bundle/_pydev_jy_imports_tipper.py',
'pydevd/_pydev_bundle/pydev_imports.py',
'pydevd/_pydev_bundle/pydev_override.py',
'pydevd/_pydev_bundle/pydev_monkey.py',
'pydevd/_pydev_bundle/pydev_localhost.py',
'pydevd/_pydev_bundle/pydev_log.py',
'pydevd/_pydev_bundle/pydev_ipython_console_011.py',
'pydevd/_pydev_bundle/_pydev_tipper_common.py',
'pydevd/_pydev_bundle/pydev_monkey_qt.py',
'pydevd/_pydev_bundle/_pydev_log.py',
'pydevd/_pydev_bundle/_pydev_filesystem_encoding.py',
'pydevd/_pydev_bundle/pydev_versioncheck.py',
'pydevd/_pydev_bundle/__init__.py',
'pydevd/_pydev_bundle/_pydev_completer.py',
'pydevd/_pydev_bundle/pydev_import_hook.py',
'pydevd/_pydev_bundle/pydev_console_utils.py',
'pydevd/_pydev_bundle/_pydev_calltip_util.py',
'pydevd/pydevd_plugins/jinja2_debug.py',
'pydevd/pydevd_plugins/django_debug.py',
'pydevd/pydevd_plugins/__init__.py',
'pydevd/pydevd_plugins/extensions/README.md',
'pydevd/pydevd_plugins/extensions/__init__.py',
'pydevd/pydevd_plugins/extensions/types/pydevd_plugin_numpy_types.py',
'pydevd/pydevd_plugins/extensions/types/__init__.py',
'pydevd/pydevd_plugins/extensions/types/pydevd_helpers.py',
'pydevd/pydevd_plugins/extensions/types/pydevd_plugins_django_form_str.py',
'pydevd/_pydev_runfiles/pydev_runfiles_coverage.py',
'pydevd/_pydev_runfiles/pydev_runfiles_nose.py',
'pydevd/_pydev_runfiles/pydev_runfiles_parallel.py',
'pydevd/_pydev_runfiles/pydev_runfiles_pytest2.py',
'pydevd/_pydev_runfiles/pydev_runfiles.py',
'pydevd/_pydev_runfiles/pydev_runfiles_parallel_client.py',
'pydevd/_pydev_runfiles/__init__.py',
'pydevd/_pydev_runfiles/pydev_runfiles_xml_rpc.py',
'pydevd/_pydev_runfiles/pydev_runfiles_unittest.py',
'pydevd/pydevd_concurrency_analyser/pydevd_concurrency_logger.py',
'pydevd/pydevd_concurrency_analyser/pydevd_thread_wrappers.py',
'pydevd/pydevd_concurrency_analyser/__init__.py',
'pydevd/_pydev_imps/_pydev_xmlrpclib.py',
'pydevd/_pydev_imps/_pydev_execfile.py',
'pydevd/_pydev_imps/_pydev_SimpleXMLRPCServer.py',
'pydevd/_pydev_imps/_pydev_saved_modules.py',
'pydevd/_pydev_imps/_pydev_sys_patch.py',
'pydevd/_pydev_imps/_pydev_inspect.py',
'pydevd/_pydev_imps/_pydev_SocketServer.py',
'pydevd/_pydev_imps/_pydev_BaseHTTPServer.py',
'pydevd/_pydev_imps/__init__.py',
'pydevd/_pydev_imps/_pydev_pkgutil_old.py',
'pydevd/_pydev_imps/_pydev_uuid_old.py',
'pydevd/_pydevd_frame_eval/pydevd_frame_eval_cython_wrapper.py',
'pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.c',
'pydevd/_pydevd_frame_eval/pydevd_modify_bytecode.py',
'pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.pyx',
'pydevd/_pydevd_frame_eval/__init__.py',
'pydevd/_pydevd_frame_eval/pydevd_frame_eval_main.py',
'pydevd/_pydevd_frame_eval/pydevd_frame_evaluator.pxd',
'pydevd/_pydevd_frame_eval/pydevd_frame_tracing.py',
'pydevd/pydev_ipython/inputhookpyglet.py',
'pydevd/pydev_ipython/inputhookgtk3.py',
'pydevd/pydev_ipython/inputhookqt5.py',
'pydevd/pydev_ipython/inputhookglut.py',
'pydevd/pydev_ipython/matplotlibtools.py',
'pydevd/pydev_ipython/inputhookqt4.py',
'pydevd/pydev_ipython/inputhookwx.py',
'pydevd/pydev_ipython/__init__.py',
'pydevd/pydev_ipython/qt_loaders.py',
'pydevd/pydev_ipython/inputhook.py',
'pydevd/pydev_ipython/README',
'pydevd/pydev_ipython/version.py',
'pydevd/pydev_ipython/qt_for_kernel.py',
'pydevd/pydev_ipython/inputhooktk.py',
'pydevd/pydev_ipython/qt.py',
'pydevd/pydev_ipython/inputhookgtk.py',
'pydevd/_pydevd_bundle/pydevd_vm_type.py',
'pydevd/_pydevd_bundle/pydevd_additional_thread_info_regular.py',
'pydevd/_pydevd_bundle/pydevd_reload.py',
'pydevd/_pydevd_bundle/pydevd_trace_dispatch_regular.py',
'pydevd/_pydevd_bundle/pydevd_cython.pyx',
'pydevd/_pydevd_bundle/pydevd_collect_try_except_info.py',
'pydevd/_pydevd_bundle/pydevd_extension_utils.py',
'pydevd/_pydevd_bundle/pydevd_stackless.py',
'pydevd/_pydevd_bundle/pydevd_constants.py',
'pydevd/_pydevd_bundle/pydevd_frame_utils.py',
'pydevd/_pydevd_bundle/pydevd_dont_trace_files.py',
'pydevd/_pydevd_bundle/pydevd_frame.py',
'pydevd/_pydevd_bundle/pydevd_xml.py',
'pydevd/_pydevd_bundle/pydevd_extension_api.py',
'pydevd/_pydevd_bundle/pydevd_comm.py',
'pydevd/_pydevd_bundle/pydevd_kill_all_pydevd_threads.py',
'pydevd/_pydevd_bundle/pydevd_traceproperty.py',
'pydevd/_pydevd_bundle/pydevd_command_line_handling.py',
'pydevd/_pydevd_bundle/pydevd_io.py',
'pydevd/_pydevd_bundle/pydevd_dont_trace.py',
'pydevd/_pydevd_bundle/pydevd_trace_dispatch.py',
'pydevd/_pydevd_bundle/pydevd_signature.py',
'pydevd/_pydevd_bundle/pydevd_import_class.py',
'pydevd/_pydevd_bundle/pydevd_custom_frames.py',
'pydevd/_pydevd_bundle/pydevd_additional_thread_info.py',
'pydevd/_pydevd_bundle/pydevd_exec.py',
'pydevd/_pydevd_bundle/pydevd_vars.py',
'pydevd/_pydevd_bundle/pydevd_exec2.py',
'pydevd/_pydevd_bundle/pydevd_cython_wrapper.py',
'pydevd/_pydevd_bundle/pydevd_plugin_utils.py',
'pydevd/_pydevd_bundle/pydevconsole_code_for_ironpython.py',
'pydevd/_pydevd_bundle/pydevd_process_net_command.py',
'pydevd/_pydevd_bundle/pydevd_resolver.py',
'pydevd/_pydevd_bundle/pydevd_utils.py',
'pydevd/_pydevd_bundle/pydevd_console.py',
'pydevd/_pydevd_bundle/pydevd_referrers.py',
'pydevd/_pydevd_bundle/pydevd_cython.c',
'pydevd/_pydevd_bundle/pydevd_breakpoints.py',
'pydevd/_pydevd_bundle/__init__.py',
'pydevd/_pydevd_bundle/pydevd_trace_api.py',
'pydevd/_pydevd_bundle/pydevd_save_locals.py',
'pydevd/pydev_sitecustomize/sitecustomize.py',
'pydevd/pydev_sitecustomize/__not_in_default_pythonpath.txt',
]}
| 50.852535 | 79 | 0.786226 |
34e5b5fd754168ef6338e900c37a7a2ea6696ba4 | 3,126 | py | Python | pgcsv/db.py | pudo/pgcsv | 9a6ae352da2ae3de5953b8b1f4c48dfcab403a3e | [
"MIT"
] | 66 | 2017-02-05T19:36:03.000Z | 2022-01-25T21:41:18.000Z | pgcsv/db.py | pudo/pgcsv | 9a6ae352da2ae3de5953b8b1f4c48dfcab403a3e | [
"MIT"
] | 4 | 2020-05-19T20:26:13.000Z | 2021-06-25T15:27:47.000Z | pgcsv/db.py | pudo/pgcsv | 9a6ae352da2ae3de5953b8b1f4c48dfcab403a3e | [
"MIT"
] | 6 | 2017-12-02T15:37:38.000Z | 2021-07-21T15:19:02.000Z | from psycopg2 import connect
from psycopg2.sql import SQL, Identifier, Literal, Composed
from collections import OrderedDict
from itertools import count
from pgcsv.util import normalize_column
| 39.075 | 71 | 0.519834 |
34e6daa9b5c20ae4ca92bdc6ec1b8667b677185b | 4,629 | py | Python | rate_coeff.py | emilyng/Chemistry-Solver | f4f21dd37898d35d669f9d0223674e251a4c58dd | [
"MIT"
] | null | null | null | rate_coeff.py | emilyng/Chemistry-Solver | f4f21dd37898d35d669f9d0223674e251a4c58dd | [
"MIT"
] | null | null | null | rate_coeff.py | emilyng/Chemistry-Solver | f4f21dd37898d35d669f9d0223674e251a4c58dd | [
"MIT"
] | null | null | null | ##Rate Coefficients
import numpy as np
| 27.885542 | 85 | 0.499244 |
34e6e2e24b84eeef879d6258960994f7f583e7ce | 2,525 | py | Python | control/thrust_vectoring.py | cuauv/software | 5ad4d52d603f81a7f254f365d9b0fe636d03a260 | [
"BSD-3-Clause"
] | 70 | 2015-11-16T18:04:01.000Z | 2022-03-05T09:04:02.000Z | control/thrust_vectoring.py | cuauv/software | 5ad4d52d603f81a7f254f365d9b0fe636d03a260 | [
"BSD-3-Clause"
] | 1 | 2016-08-03T05:13:19.000Z | 2016-08-03T06:19:39.000Z | control/thrust_vectoring.py | cuauv/software | 5ad4d52d603f81a7f254f365d9b0fe636d03a260 | [
"BSD-3-Clause"
] | 34 | 2015-12-15T17:29:23.000Z | 2021-11-18T14:15:12.000Z | import math
import numpy as np
FULL_RANGE = 1024
| 34.589041 | 79 | 0.670099 |
34e7cf6e1775685d6271aef6702b1730ac2e95bc | 1,956 | py | Python | tests/unit/test_bad_cluster.py | ylipacbio/pbtranscript | 6b4ef164f191ffd4201feb62b951d9eeac3315b6 | [
"BSD-3-Clause"
] | null | null | null | tests/unit/test_bad_cluster.py | ylipacbio/pbtranscript | 6b4ef164f191ffd4201feb62b951d9eeac3315b6 | [
"BSD-3-Clause"
] | null | null | null | tests/unit/test_bad_cluster.py | ylipacbio/pbtranscript | 6b4ef164f191ffd4201feb62b951d9eeac3315b6 | [
"BSD-3-Clause"
] | 1 | 2021-02-26T10:08:09.000Z | 2021-02-26T10:08:09.000Z |
# XXX verification for bug 30828 - runs ice_pbdagcon on a spurious cluster
# and checks that it discards the resulting all-N consensus sequence
import subprocess
import tempfile
import unittest
import os.path as op
from pbcore.io import FastaReader
CLUSTER_FA = """\
>m54007_151222_230824/47383194/334_64_CCS
CATTGAAGACGTCCACCTCAACGCTATGAACGTTAGTTGAGACAATGTTAAAGCAAACGACAACGTCATTGTGATCTACATACACAGTGGATGGTTAGCGTAAACATGGTGGAACGTACTTTGACTGCGCTGCAAGAAATGGTTGGGTCGATCGTAATGCTAGTCGTTACATCGGAACAAGCCAAAACAAAATCATTCGCTGGATTTAGACCTACTGCACGACGACGTCGACACAAGACATTCTTGAAAGGTAATTGACGTGGACGTTTC
>m54007_151222_230824/28640158/287_60_CCS
CAAACGACAACGTCATTGTGATCTACATACACAGTGGATGGTTAGGCGTAAACATGGTGGGAACGTACTTTGACTGCGCTGCAAGAAATGGGTTGGGTCGATCGTAATGCTAGTCGTTACATCGGAACAAGCCAAAAAACAAACATCATTCGCTGGATTTAGACTACTACTGCACGACCGACGTCGACACAAGACATTCTCTGAAAGGTAATTGACGTGGACGTTTC
>m54007_151222_230824/49611437/382_58_CCS
ACTGAACTACGGGTCAGCTTCCCCATTTGAAGTCATGTAGTGGTTGTCTACTTTTTCATTGAGACGTCCACCTCAACGCTATGAACGTTAGTTGAGACAATGTTAAAGCAAACGACAACGTCATTGTGATCTACATACACAGTGGATGGTTAGCGTAAACATGGTGGAACGTACTTTGACTGCGCTGCAAGAAATGGTGTGGGTCGATCGTAATGCTAGTCGTTACATCGGAACAAGCCAAAACAAAATCATTCGCTGGATTTAGACCTACTGCACGACGACGTCGACACAAGACATTCTTGAAAGGTAATTGACGTGGACGTT"""
if __name__ == "__main__":
unittest.main()
| 44.454545 | 327 | 0.812883 |
34ea6bc99bdf93d5fbca0d7c5dabe8656d17800e | 96 | py | Python | venv/lib/python3.8/site-packages/poetry/core/packages/constraints/union_constraint.py | Retraces/UkraineBot | 3d5d7f8aaa58fa0cb8b98733b8808e5dfbdb8b71 | [
"MIT"
] | 2 | 2022-03-13T01:58:52.000Z | 2022-03-31T06:07:54.000Z | venv/lib/python3.8/site-packages/poetry/core/packages/constraints/union_constraint.py | DesmoSearch/Desmobot | b70b45df3485351f471080deb5c785c4bc5c4beb | [
"MIT"
] | 19 | 2021-11-20T04:09:18.000Z | 2022-03-23T15:05:55.000Z | venv/lib/python3.8/site-packages/poetry/core/packages/constraints/union_constraint.py | DesmoSearch/Desmobot | b70b45df3485351f471080deb5c785c4bc5c4beb | [
"MIT"
] | null | null | null | /home/runner/.cache/pip/pool/a5/a1/10/06eab95524f667caa51362a09c577fd5f6d45980e5390034745c0a322f | 96 | 96 | 0.895833 |
34ebc2d0c5cd30f9146703ef59fd7175839c43d2 | 4,028 | py | Python | test/unit3/test_docstring.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 2,671 | 2015-01-03T08:23:25.000Z | 2022-03-31T06:15:48.000Z | test/unit3/test_docstring.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 972 | 2015-01-05T08:11:00.000Z | 2022-03-29T13:47:15.000Z | test/unit3/test_docstring.py | timmartin/skulpt | 2e3a3fbbaccc12baa29094a717ceec491a8a6750 | [
"MIT"
] | 845 | 2015-01-03T19:53:36.000Z | 2022-03-29T18:34:22.000Z | import unittest
def banana():
"Yellow"
return 42
def make_adder(n):
"Function adding N"
def add(x):
"Compute N + X"
return n + x
return add
if __name__ == '__main__':
unittest.main()
| 24.711656 | 82 | 0.638034 |
34ebcfd140d8b8342551373bb548dcc3e38235a3 | 11,609 | py | Python | mixer.py | ejhumphrey/mixer_bingo | d78174384e4476de70348d3e17a72d45ff04d960 | [
"0BSD"
] | null | null | null | mixer.py | ejhumphrey/mixer_bingo | d78174384e4476de70348d3e17a72d45ff04d960 | [
"0BSD"
] | null | null | null | mixer.py | ejhumphrey/mixer_bingo | d78174384e4476de70348d3e17a72d45ff04d960 | [
"0BSD"
] | null | null | null | from __future__ import print_function
import argparse
import json
import jsonschema
import logging
import numpy as np
import networkx as nx
import os
import pandas as pd
import random
import sys
logger = logging.getLogger(name=__file__)
__SCHEMA__ = _load_schema()
def validate(participant_data):
"""Check that a number of records conforms to the expected format.
Parameters
----------
participant_data : array_like of dicts
Collection of user records to validate.
Returns
-------
is_valid : bool
True if the provided data validates.
"""
is_valid = True
try:
jsonschema.validate(participant_data, __SCHEMA__)
except jsonschema.ValidationError as failed:
logger.debug("Schema Validation Failed: {}".format(failed))
is_valid = False
return is_valid
def tokenize(records):
"""Create a token mapping from objects to integers.
Parameters
----------
records : array_like of iterables.
Collection of nested arrays.
Returns
-------
enum_map : dict
Enumeration map of objects (any hashable) to tokens (int).
"""
unique_items = set(i for row in records for i in row)
unique_items = sorted(list(unique_items))
return dict([(k, n) for n, k in enumerate(unique_items)])
def items_to_bitmap(records, enum_map=None):
"""Turn a collection of sparse items into a binary bitmap.
Parameters
----------
records : iterable of iterables, len=n
Items to represent as a matrix.
enum_map : dict, or None, len=k
Token mapping items to ints; if None, one will be generated and
returned.
Returns
-------
bitmap : np.ndarray, shape=(n, k)
Active items.
enum_map : dict
Mapping of items to integers, if one is not given.
"""
return_mapping = False
if enum_map is None:
enum_map = tokenize(records)
return_mapping = True
bitmap = np.zeros([len(records), len(enum_map)], dtype=bool)
for idx, row in enumerate(records):
for i in row:
bitmap[idx, enum_map[i]] = True
return bitmap, enum_map if return_mapping else bitmap
def categorical_sample(pdf):
"""Randomly select a categorical index of a given PDF.
Parameters
----------
x
Returns
-------
y
"""
pdf = pdf / pdf.sum()
return int(np.random.multinomial(1, pdf).nonzero()[0])
WEIGHTING_FUNCTIONS = {
'l0': lambda x: float(np.sum(x) > 0),
'l1': lambda x: float(np.sum(x)),
'mean': lambda x: float(np.mean(x)),
'null': 0.0,
'euclidean': lambda x: np.sqrt(x),
'norm_euclidean': lambda x: np.sqrt(x) / 3.0,
'quadratic': lambda x: x,
'norm_quadratic': lambda x: x / 9.0
}
def build_graph(records, forced_edges=None, null_edges=None,
interest_func='l0', seniority_func='l0',
combination_func=np.sum):
"""writeme
Parameters
----------
data: pd.DataFrame
Loaded participant records
forced_edges: np.ndarray, or None
One-hot assignment matrix; no row or column can sum to more than one.
null_edges: np.ndarray, or None
Matches to set to zero.
interest_func: str
'l1', 'l0'
seniority_func: str
'l1', 'l0'
combination_func: function
Numpy functions, e.g. prod, sum, max.
Returns
-------
graph : networkx.Graph
Connected graph to be factored.
"""
if not isinstance(records, pd.DataFrame):
records = pd.DataFrame(records)
interest_bitmap, interest_enum = items_to_bitmap(records.interests)
# Coerce null / forced edges for datatype compliance.
null_edges = ([] if null_edges is None
else [tuple(v) for v in null_edges])
forced_edges = ([] if forced_edges is None
else [tuple(v) for v in forced_edges])
graph = nx.Graph()
for i, row_i in records.iterrows():
for j, row_j in records.iterrows():
# Skip self, shared affiliations, or same grouping
skip_conditions = [i == j,
(i, j) in null_edges,
(j, i) in null_edges,
row_i.affiliation == row_j.affiliation]
if any(skip_conditions):
continue
# Interest weighting
interest_weight = WEIGHTING_FUNCTIONS[interest_func](
interest_bitmap[i] * interest_bitmap[j])
# Seniority weighting
seniority_weight = WEIGHTING_FUNCTIONS[seniority_func](
(row_i.seniority - row_j.seniority) ** 2.0)
if (i, j) in forced_edges or (j, i) in forced_edges:
weights = [2.0 ** 32]
else:
weights = [interest_weight, seniority_weight]
graph.add_weighted_edges_from([(i, j, combination_func(weights))])
return graph
def harmonic_mean(values):
"""writeme
Parameters
----------
x
Returns
-------
y
"""
return np.power(np.prod(values), 1.0 / len(values))
def select_matches(records, k_matches=5, forced_edges=None, null_edges=None,
interest_func='l0', seniority_func='l0',
combination_func=np.sum, seed=None):
"""Pick affinity matches, and back-fill randomly if under-populated.
Parameters
----------
x
Returns
-------
y
"""
null_edges = ([] if null_edges is None
else [tuple(v) for v in null_edges])
forced_edges = ([] if forced_edges is None
else [tuple(v) for v in forced_edges])
matches = {i: set() for i in range(len(records))}
for k in range(k_matches):
graph = build_graph(
records, null_edges=null_edges, forced_edges=forced_edges,
seniority_func='quadratic', interest_func='mean',
combination_func=np.mean)
forced_edges = None
links = nx.max_weight_matching(graph)
for row, col in links.items():
null_edges += (row, col)
matches[row].add(col)
catch_count = 0
rng = np.random.RandomState(seed=seed)
for row in matches:
possible_matches = set(range(len(records)))
possible_matches = possible_matches.difference(matches[row])
while len(matches[row]) != k_matches:
col = rng.choice(np.asarray(possible_matches))
matches[row].add(col)
null_edges += [(row, col)]
catch_count += 1
logger.debug("backfilled %d" % catch_count)
return matches
def select_topic(row_a, row_b):
"""writeme
Parameters
----------
x
Returns
-------
y
"""
topics_a = parse_interests(row_a[7])
topics_b = parse_interests(row_b[7])
topics = list(set(topics_a).intersection(set(topics_b)))
if topics:
return topics[categorical_sample(np.ones(len(topics)))]
TEXT_FMTS = [
("Find someone from %s.", 'affiliation'),
("Find someone currently located in %s.", 'country'),
("Find someone who is an expert on %s", 'topics'),
("Find someone in academia at the %s level", 'education')]
TEXT = [
"Find someone who works in industry",
"Introduce someone to someone else",
"Help someone solve a square",
"Find someone who plays an instrument.",
"Find someone who has attended ISMIR for more than 5 years",
"Find someone for which this is their first ISMIR"]
def make_card(name, contents, outfile):
"""writeme
Parameters
----------
x
Returns
-------
y
"""
tex_lines = []
tex_lines.append(r'\documentclass[10pt, a4paper]{article}')
tex_lines.append(r'\usepackage{tikz}')
tex_lines.append(r'\usepackage{fullpage}')
tex_lines.append(r'\usetikzlibrary{positioning,matrix}')
tex_lines.append(r'\renewcommand*{\familydefault}{\sfdefault}')
tex_lines.append(r'\usepackage{array}')
tex_lines.append(r'\begin{document}')
tex_lines.append(r'\pagestyle{empty}')
tex_lines.append(r'\begin{center}')
tex_lines.append(r'\Huge ISMIR 2014 Mixer Bingo\\')
tex_lines.append(r"\bigskip \huge \emph{%s} \\" % name)
tex_lines.append(r'\normalsize')
tex_lines.append(r'')
tex_lines.append(r'\bigskip')
random.shuffle(contents)
c = contents[0:12] + [r'FREE'] + contents[12:24]
tex_lines.append(r'\begin{tikzpicture}')
tex_lines.append(r"""\tikzset{square matrix/.style={
matrix of nodes,
column sep=-\pgflinewidth, row sep=-\pgflinewidth,
nodes={draw,
text height=#1/2-2.5em,
text depth=#1/2+2.5em,
text width=#1,
align=center,
inner sep=0pt
},
},
square matrix/.default=3.2cm
}""")
tex_lines.append(r'\matrix [square matrix]')
tex_lines.append(r'(shi)')
tex_lines.append(r'{')
tex_lines.append(
r"%s & %s & %s & %s & %s\\" % (c[0], c[1], c[2], c[3], c[4]))
tex_lines.append(
r"%s & %s & %s & %s & %s\\" % (c[5], c[6], c[7], c[8], c[9]))
tex_lines.append(
r"%s & %s & %s & %s & %s\\" % (c[10], c[11], c[12], c[13], c[14]))
tex_lines.append(
r"%s & %s & %s & %s & %s\\" % (c[15], c[16], c[17], c[18], c[19]))
tex_lines.append(
r"%s & %s & %s & %s & %s\\" % (c[20], c[21], c[22], c[23], c[24]))
tex_lines.append(r'};')
tex_lines.append(r'\foreach \i in {1,2,3,4,5}')
tex_lines.append(
r'\draw[line width=2pt] (shi-1-\i.north east) -- (shi-5-\i.south east);')
tex_lines.append(
r'\foreach \i in {1,2,3,4,5}')
tex_lines.append(
r'\draw[line width=2pt] (shi-1-\i.north west) -- (shi-5-\i.south west);')
tex_lines.append(
r'\foreach \i in {1,2,3,4,5}')
tex_lines.append(
r'\draw[line width=2pt] (shi-\i-1.north west) -- (shi-\i-5.north east);')
tex_lines.append(
r'\foreach \i in {1,2,3,4,5}')
tex_lines.append(
r'\draw[line width=2pt] (shi-\i-1.south west) -- (shi-\i-5.south east);')
tex_lines.append(r'\end{tikzpicture}')
tex_lines.append('')
tex_lines.append(r'\pagebreak')
tex_lines.append('')
tex_lines.append(r'\end{center}')
tex_lines.append(r'\end{document}')
with open(outfile, 'w') as f:
for line in tex_lines:
f.write("%s\n" % line)
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('a',
help='writeme')
parser.add_argument('--b', type=str,
default='apple',
help='writeme')
parser.add_argument('--verbose', action='store_true',
help='Print progress to the console.')
args = parser.parse_args()
sys.exit(0)
| 27.839329 | 81 | 0.593591 |
34f18dca2b35de2acae03f31c1e789e6be8e839f | 756 | py | Python | mwthesaurus/model.py | PederHA/mwthesaurus | c58d9bdf82fce906c8a2c908b803b2a9db4bc0a2 | [
"MIT"
] | null | null | null | mwthesaurus/model.py | PederHA/mwthesaurus | c58d9bdf82fce906c8a2c908b803b2a9db4bc0a2 | [
"MIT"
] | null | null | null | mwthesaurus/model.py | PederHA/mwthesaurus | c58d9bdf82fce906c8a2c908b803b2a9db4bc0a2 | [
"MIT"
] | null | null | null | from dataclasses import dataclass, field
from typing import List
from itertools import chain
| 30.24 | 67 | 0.640212 |
34f1d3eabe979cf0b88b9e39d396c23d11f9013e | 9,487 | py | Python | bouncingball_cortix.py | seamuss1/BouncingBall | 6c4ff0838fa0366798efd8922c2632a8bfa5f15b | [
"MIT"
] | 1 | 2019-08-11T23:55:05.000Z | 2019-08-11T23:55:05.000Z | bouncingball_cortix.py | seamuss1/BouncingBall | 6c4ff0838fa0366798efd8922c2632a8bfa5f15b | [
"MIT"
] | null | null | null | bouncingball_cortix.py | seamuss1/BouncingBall | 6c4ff0838fa0366798efd8922c2632a8bfa5f15b | [
"MIT"
] | null | null | null | import os, time, datetime, threading, random
import numpy as np
import matplotlib.pyplot as plt
import sys
from cortix.src.module import Module
from cortix.src.port import Port
from cortix.src.cortix_main import Cortix
import time
from bb_plot import Plot
import shapely.geometry as geo
import shapely.ops
from shapely import affinity
#Example driver script
if __name__ == '__main__':
cortix = Cortix(use_mpi=False)
mod_list = []
shapes = ['triangle', 'squares', 'diamond']
while True:
print('Choose a shape: 1) Triangle, 2) Square, or 3) Diamond\n')
shape = input('>>>')
shape = shape.lower()
if shape == 'triangle' or shape =='1':
shape = geo.Polygon([(0, 0), (0, 60), (30, 30)])
break
if shape == 'square' or shape =='2':
shape = geo.box(-30,0,30,50)
break
if shape == 'triangle' or shape =='3':
shape = geo.box(-30,0,30,50)
shape = affinity.rotate(shape,45)
break
print('Input not recognized, try again')
while True:
print('Choose the number of Bouncing Balls\n')
balls = input('>>>')
try:
balls = int(balls)
if balls > 1000:
print('Wow good luck')
elif balls > 0:
break
else:
print('Choose a better number')
except:
print('Entry invalid')
while True:
print('How many seconds is the simulation?\n')
secs = input('>>>')
try:
secs = int(secs)
if secs > 50000:
print('Wow good luck')
elif secs > 0:
break
else:
print('Choose a better number')
except:
print('Entry invalid')
plot = Plot(shape=shape, length=balls)
cortix.add_module(plot)
for i in range(balls):
time.sleep(0.01)
app = BouncingBall(shape,runtime=secs)
mod_list.append(app)
cortix.add_module(app)
for c,i in enumerate(mod_list):
i.connect('plot-send{}'.format(c),plot.get_port('plot-receive{}'.format(c)))
for j in mod_list:
if i == j:
continue
name = '{}{}'.format(i.timestamp,j.timestamp)
name2 = '{}{}'.format(j.timestamp,i.timestamp)
j.connect(name, i.get_port(name2))
cortix.draw_network('network_graph.png')
cortix.run()
print('bye')
| 39.529167 | 144 | 0.54211 |
34f2d98b52c7839e3432965351129274c2ecd039 | 23,904 | py | Python | pgimp/GimpFileCollectionTest.py | netogallo/pgimp | bb86254983e1673d702e1fa2ed207166fd15ec65 | [
"MIT"
] | 5 | 2018-10-29T10:09:37.000Z | 2020-12-28T04:47:32.000Z | pgimp/GimpFileCollectionTest.py | netogallo/pgimp | bb86254983e1673d702e1fa2ed207166fd15ec65 | [
"MIT"
] | 1 | 2020-10-21T18:35:44.000Z | 2021-06-17T06:27:26.000Z | pgimp/GimpFileCollectionTest.py | netogallo/pgimp | bb86254983e1673d702e1fa2ed207166fd15ec65 | [
"MIT"
] | 4 | 2019-09-20T05:14:39.000Z | 2021-04-05T01:55:47.000Z | # Copyright 2018 Mathias Burger <mathias.burger@gmail.com>
#
# SPDX-License-Identifier: MIT
import os
import shutil
import textwrap
from tempfile import TemporaryDirectory
import numpy as np
import pytest
from pgimp.GimpFile import GimpFile, GimpFileType
from pgimp.GimpFileCollection import GimpFileCollection, NonExistingPathComponentException, \
GimpMissingRequiredParameterException, MaskForegroundColor
from pgimp.util import file
from pgimp.util.TempFile import TempFile
from pgimp.util.string import escape_single_quotes
| 42.084507 | 125 | 0.650602 |
34f2f00e1352060e6764c5a58765eca101cee86d | 2,542 | py | Python | lstm.py | ryubidragonfire/text-emo | a03a9aa0d2e055277fc63a70822816853e5a35c0 | [
"MIT"
] | null | null | null | lstm.py | ryubidragonfire/text-emo | a03a9aa0d2e055277fc63a70822816853e5a35c0 | [
"MIT"
] | null | null | null | lstm.py | ryubidragonfire/text-emo | a03a9aa0d2e055277fc63a70822816853e5a35c0 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 29 13:07:10 2016
@author: chyam
purpose: A vanila lstm model for text classification.
"""
from __future__ import print_function
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.layers import LSTM
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cross_validation import train_test_split
import pandas as pd
from datetime import datetime
import preputils as pu
def lstm(X_train, y_train, X_test, y_test, timesteps, batch_size, nb_epoch, nb_classes):
""" Building a lstm model."""
print('Starting LSTM ...')
print(str(datetime.now()))
feature_len = X_train.shape; print(feature_len[1])
model = Sequential()
#model.add(Embedding(max_features, 256, input_length=maxlen))
model.add(LSTM(input_dim=feature_len[1], output_dim=128, activation='sigmoid', inner_activation='hard_sigmoid'))
model.add(Dropout(0.5))
model.add(Dense(nb_classes))
model.add(Activation('sigmoid'))
model.compile(loss='sparse_categorical_crossentropy', optimizer='rmsprop', metrics=['accuracy'])
model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch)
score = model.evaluate(X_test, y_test, batch_size=batch_size)
print('Test score:', score[0])
print('Test accuracy:', score[1])
print('LSTM finished ...')
print(str(datetime.now()))
return
if __name__ == '__main__':
main() | 35.802817 | 152 | 0.712825 |
34f37412bfc46db2a069f8207380b8ab7bc124d7 | 207 | py | Python | day_1/fibonacci.py | Ishaan-99-cyber/ml-workshop-wac-1 | 186d4b6544c7e55cea052312934e455a51d1698a | [
"MIT"
] | 6 | 2020-12-24T07:10:58.000Z | 2021-04-11T09:19:18.000Z | day_1/fibonacci.py | Ishaan-99-cyber/ml-workshop-wac-1 | 186d4b6544c7e55cea052312934e455a51d1698a | [
"MIT"
] | null | null | null | day_1/fibonacci.py | Ishaan-99-cyber/ml-workshop-wac-1 | 186d4b6544c7e55cea052312934e455a51d1698a | [
"MIT"
] | 6 | 2020-12-24T09:42:25.000Z | 2021-01-26T01:34:38.000Z | # 1 1 2 3 5 8 13 21 ....
# f(n) = f(n - 1) + f(n - 2)
# f(0) = f(1) = 1
print(fibonacci(5))
| 17.25 | 46 | 0.468599 |
34f37aac957cd2dcc7bd8c099147d678a15c4634 | 160 | py | Python | pythran/tests/user_defined_import/simple_case_main.py | davidbrochart/pythran | 24b6c8650fe99791a4091cbdc2c24686e86aa67c | [
"BSD-3-Clause"
] | 1,647 | 2015-01-13T01:45:38.000Z | 2022-03-28T01:23:41.000Z | pythran/tests/user_defined_import/simple_case_main.py | davidbrochart/pythran | 24b6c8650fe99791a4091cbdc2c24686e86aa67c | [
"BSD-3-Clause"
] | 1,116 | 2015-01-01T09:52:05.000Z | 2022-03-18T21:06:40.000Z | pythran/tests/user_defined_import/simple_case_main.py | davidbrochart/pythran | 24b6c8650fe99791a4091cbdc2c24686e86aa67c | [
"BSD-3-Clause"
] | 180 | 2015-02-12T02:47:28.000Z | 2022-03-14T10:28:18.000Z | #pythran export entry()
#runas entry()
import simple_case_import
| 16 | 41 | 0.7375 |
34f48be78d73f96e6ef88433990d92e5dd1a350b | 7,584 | py | Python | python/models/model_factory.py | rwightman/pytorch-cdiscount | 95901bd77888f7480f282e4b1541c0fc1e021bf9 | [
"Apache-2.0"
] | 1 | 2022-03-09T09:40:43.000Z | 2022-03-09T09:40:43.000Z | python/models/model_factory.py | rwightman/pytorch-cdiscount | 95901bd77888f7480f282e4b1541c0fc1e021bf9 | [
"Apache-2.0"
] | null | null | null | python/models/model_factory.py | rwightman/pytorch-cdiscount | 95901bd77888f7480f282e4b1541c0fc1e021bf9 | [
"Apache-2.0"
] | null | null | null | import torchvision.models
from .resnext101_32x4d import resnext101_32x4d
from .inception_v4 import inception_v4
from .inception_resnet_v2 import inception_resnet_v2
from .wrn50_2 import wrn50_2
from .my_densenet import densenet161, densenet121, densenet169, densenet201
from .my_resnet import resnet18, resnet34, resnet50, resnet101, resnet152
from .fbresnet200 import fbresnet200
from .dpn import dpn68, dpn68b, dpn92, dpn98, dpn131, dpn107
#from .transformed_model import TransformedModel
from .load_checkpoint import load_checkpoint
model_config_dict = {
'resnet18': {
'model_name': 'resnet18', 'num_classes': 1000, 'input_size': 224, 'normalizer': 'torchvision',
'checkpoint_file': 'resnet18-5c106cde.pth', 'drop_first_class': False},
'resnet34': {
'model_name': 'resnet34', 'num_classes': 1000, 'input_size': 224, 'normalizer': 'torchvision',
'checkpoint_file': 'resnet34-333f7ec4.pth', 'drop_first_class': False},
'resnet50': {
'model_name': 'resnet50', 'num_classes': 1000, 'input_size': 224, 'normalizer': 'torchvision',
'checkpoint_file': 'resnet50-19c8e357.pth', 'drop_first_class': False},
'resnet101': {
'model_name': 'resnet101', 'num_classes': 1000, 'input_size': 224, 'normalizer': 'torchvision',
'checkpoint_file': 'resnet101-5d3b4d8f.pth', 'drop_first_class': False},
'resnet152': {
'model_name': 'resnet152', 'num_classes': 1000, 'input_size': 224, 'normalizer': 'torchvision',
'checkpoint_file': 'resnet152-b121ed2d.pth', 'drop_first_class': False},
'densenet121': {
'model_name': 'densenet121', 'num_classes': 1000, 'input_size': 224, 'normalizer': 'torchvision',
'checkpoint_file': 'densenet121-241335ed.pth', 'drop_first_class': False},
'densenet169': {
'model_name': 'densenet169', 'num_classes': 1000, 'input_size': 224, 'normalizer': 'torchvision',
'checkpoint_file': 'densenet169-6f0f7f60.pth', 'drop_first_class': False},
'densenet201': {
'model_name': 'densenet201', 'num_classes': 1000, 'input_size': 224, 'normalizer': 'torchvision',
'checkpoint_file': 'densenet201-4c113574.pth', 'drop_first_class': False},
'densenet161': {
'model_name': 'densenet161', 'num_classes': 1000, 'input_size': 224, 'normalizer': 'torchvision',
'checkpoint_file': 'densenet161-17b70270.pth', 'drop_first_class': False},
'dpn107': {
'model_name': 'dpn107', 'num_classes': 1000, 'input_size': 299, 'normalizer': 'dualpathnet',
'checkpoint_file': 'dpn107_extra-fc014e8ec.pth', 'drop_first_class': False},
'dpn92_extra': {
'model_name': 'dpn92', 'num_classes': 1000, 'input_size': 299, 'normalizer': 'dualpathnet',
'checkpoint_file': 'dpn92_extra-1f58102b.pth', 'drop_first_class': False},
'dpn92': {
'model_name': 'dpn92', 'num_classes': 1000, 'input_size': 299, 'normalizer': 'dualpathnet',
'checkpoint_file': 'dpn92-7d0f7156.pth', 'drop_first_class': False},
'dpn68': {
'model_name': 'dpn68', 'num_classes': 1000, 'input_size': 299, 'normalizer': 'dualpathnet',
'checkpoint_file': 'dpn68-abcc47ae.pth', 'drop_first_class': False},
'dpn68b': {
'model_name': 'dpn68b', 'num_classes': 1000, 'input_size': 299, 'normalizer': 'dualpathnet',
'checkpoint_file': 'dpn68_extra.pth', 'drop_first_class': False},
'dpn68b_extra': {
'model_name': 'dpn68b', 'num_classes': 1000, 'input_size': 299, 'normalizer': 'dualpathnet',
'checkpoint_file': 'dpn68_extra.pth', 'drop_first_class': False},
'inception_resnet_v2': {
'model_name': 'inception_resnet_v2', 'num_classes': 1001, 'input_size': 299, 'normalizer': 'le',
'checkpoint_file': 'inceptionresnetv2-d579a627.pth', 'drop_first_class': True},
}
| 47.10559 | 105 | 0.681566 |
34f4d60dbd3b87a88dce9e6ef7fc8bd1f475fd71 | 585 | py | Python | add_+x.py | racytech/rpctests | 886d97b9e16fd030586d0fca6945d8f7a277ae27 | [
"Apache-2.0"
] | null | null | null | add_+x.py | racytech/rpctests | 886d97b9e16fd030586d0fca6945d8f7a277ae27 | [
"Apache-2.0"
] | null | null | null | add_+x.py | racytech/rpctests | 886d97b9e16fd030586d0fca6945d8f7a277ae27 | [
"Apache-2.0"
] | 1 | 2021-09-03T17:14:55.000Z | 2021-09-03T17:14:55.000Z | #!/usr/bin/env python3
"""
Add +x to every .sh file
"""
# import argparse
import os
import subprocess
go_recursive(".") | 20.172414 | 60 | 0.560684 |
34f5a27bc2eb816c9dabb375d6159c8eb8e17312 | 25,985 | py | Python | texas.py | isaact23/texas | 1ac70b00f0acf2f196aca87476d7bac97418afba | [
"MIT"
] | null | null | null | texas.py | isaact23/texas | 1ac70b00f0acf2f196aca87476d7bac97418afba | [
"MIT"
] | null | null | null | texas.py | isaact23/texas | 1ac70b00f0acf2f196aca87476d7bac97418afba | [
"MIT"
] | null | null | null | # TEXAS HOLD'EM (Program by Isaac Thompson)
import random, itertools, copy, sys
import os
from playsound import playsound
import pyttsx3
# Set to true to enable betting.
do_bets = False
RANKS = ['2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A']
SUITS = ['C', 'D', 'H', 'S']
SORT_RANKS = {'2': 0, '3': 1, '4': 2, '5': 3, '6': 4, '7': 5, '8': 6, '9': 7, 'T': 8, 'J': 9, 'Q': 10, 'K': 11, 'A': 12}
SORT_SUITS = {'C': 0, 'D': 1, 'H': 2, 'S': 3}
RANK_NAMES = {'2': 'Two', '3': 'Three', '4': 'Four', '5': 'Five', '6': 'Six', '7': 'Seven', '8': 'Eight', '9': 'Nine', 'T': 'Ten',
'J': 'Jack', 'Q': 'Queen', 'K': 'King', 'A': 'Ace'}
SUIT_NAMES = {'C': 'Clubs', 'D': 'Diamonds', 'H': 'Hearts', 'S': 'Spades'}
DEAL_IN = ["Deal me in.",
"What are you waiting for? Give me two cards.",
"You're the dealer. Go ahead and deal.",
"Give me some cards please."]
FLOP = ["Time for the flop.",
"Put down the first three cards"]
PLAYER_SPEECH_1 = ["Not bad.",
"That's more than half.",
"The odds are in your favor.",
"You have an acknowledgable chance, my friend.",
"Just you wait. This will all change."]
PLAYER_SPEECH_2 = ["That's pretty good.",
"How sad.",
"Don't worry, the odds will change shortly.",
"You hear that? It's the winds of change.",
"I have to say I am not happy with you."]
PLAYER_SPEECH_3 = ["I might as well fold.",
"This is rather unfortunate.",
"Dang.",
"No. This can't be happening. No!",
"Welp. This is happening."]
PLAYER_WIN = ["You won this time around.",
"You win. What a shame.",
"You won. For the first time. For the last time.",
"Welp, I've been destroyed.",
"Good game.",
"Let's play again so I can righteously win."]
CPU_SPEECH_1 = ["Looks good for me.",
"That's a good thing.",
"Hopefully it stays that way.",
"Flip a coin and it'll land on my side.",
"Heh."]
CPU_SPEECH_2 = ["Prepare to lose.",
"The odds are in my favor.",
"Ha ha ha ha.",
"I will be beating you shortly.",
"I will trump you!"]
CPU_SPEECH_3 = ["You sir are doomed.",
"You might as well fold",
"Just give up. As far as you know I've got pocket aces",
"Prepare yourself mentally to be obliterated",
"This is the end for you!",
"Ha! You can't win!",
"You humans will never beat me!"]
CPU_WIN = ["You lose. Would you like to play again?",
"You have been righteously destroyed.",
"Good golly. Looks like humans are being phased out.",
"Rest in peace.",
"I win. Let's play again so I can win again.",
"Victory goes to me. What a surprise.",
"Get wrecked.",
"You've been destroyed by a computer. How do you feel?",
"Wow, what a loser. You should have been luckier."]
NEURAL_SPEECH = ["Well, this is going to be a boring round.",
"The outlook is not great for either of us",
"Let's both fold on three. One, two, three. Just kidding, I never fold.",
"I cannot express my infinite exhilaration through my sarcastic robot voice.",
"Yawn."]
DRAW = ["We tied. What are the odds?",
"Tie game. How embarassing for both of us."]
# Set up audio engine
audio_engine = pyttsx3.init()
audio_engine.setProperty('rate', 210)
# Synthesize text as speech
# Convert a card identity to a name (like 3H to Three of Hearts)
# Report the calculated game odds to the player.
# Includes statements of astronomical wit.
# A class that runs the game.
if __name__ == "__main__":
ALG = PredictionAlgorithm()
say("Let's play Texas Hold'Em.")
while True:
ALG.play()
| 40.792779 | 151 | 0.516452 |
34f5d659040a322d337330d8a9d7b5449d63b66f | 443 | py | Python | no. of occurences of substring.py | devAmoghS/Python-Programs | 5b8a67a2a41e0e4a844ae052b59fc22fdcdbdbf9 | [
"MIT"
] | 1 | 2019-09-18T14:06:50.000Z | 2019-09-18T14:06:50.000Z | no. of occurences of substring.py | devAmoghS/Python-Programs | 5b8a67a2a41e0e4a844ae052b59fc22fdcdbdbf9 | [
"MIT"
] | null | null | null | no. of occurences of substring.py | devAmoghS/Python-Programs | 5b8a67a2a41e0e4a844ae052b59fc22fdcdbdbf9 | [
"MIT"
] | null | null | null | """
s="preeni"
ss="e"
"""
s=input("enter the string:")
ss=input("enter the substring:")
j=0
for i in range(len(s)):
m=s.find(ss)
#the first occurence of ss
if(j==0):
print("m=%d"%m)
if(m== -1 and j==0):
print("no such substring is available")
break
if(m== -1):
break
else :
j=j+1
s=s[m+1:]
# print(s)
print("no. of occurences is %s"%j)
| 17.038462 | 48 | 0.465011 |
34f78347f261274809e3a7533c6bc409939bf9b0 | 1,039 | py | Python | leetcode/code/maximumProduct.py | exchris/Pythonlearn | 174f38a86cf1c85d6fc099005aab3568e7549cd0 | [
"MIT"
] | null | null | null | leetcode/code/maximumProduct.py | exchris/Pythonlearn | 174f38a86cf1c85d6fc099005aab3568e7549cd0 | [
"MIT"
] | 1 | 2018-11-27T09:58:54.000Z | 2018-11-27T09:58:54.000Z | leetcode/code/maximumProduct.py | exchris/pythonlearn | 174f38a86cf1c85d6fc099005aab3568e7549cd0 | [
"MIT"
] | null | null | null | #!/bin/usr/python
# -*- coding:utf-8 -*-
# 628.
s = Solution()
num = s.maximumProduct([-4, -3, -2, -1, 60])
print(num)
| 25.341463 | 53 | 0.405197 |
34f87e0983bc87b776a41bf8fa6bd6191f64154d | 437 | py | Python | exemplo_47_inspect.py | alef123vinicius/Estudo_python | 30b121d611f94eb5df9fbb41ef7279546143221b | [
"Apache-2.0"
] | null | null | null | exemplo_47_inspect.py | alef123vinicius/Estudo_python | 30b121d611f94eb5df9fbb41ef7279546143221b | [
"Apache-2.0"
] | null | null | null | exemplo_47_inspect.py | alef123vinicius/Estudo_python | 30b121d611f94eb5df9fbb41ef7279546143221b | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 16 15:35:53 2021
@author: alef
"""
import os.path
# modulo de instropeco amigvel
import inspect
print('Objeto: ', inspect.getmodule(os.path))
print('Classe?', inspect.isclass(str))
# Lista todas as funes que existem em os.path
print('Membros: ')
for name, struct in inspect.getmembers(os.path):
if inspect.isfunction(struct):
print(name) | 17.48 | 48 | 0.681922 |
34f90454724956c5a7e90a92e40de7bf13365c40 | 20,610 | py | Python | src/hr_system/hr_system.py | pablomarcel/HR-System | 25edf82d0f4f37ededfb6c6b713a5d7c455ff67e | [
"MIT"
] | null | null | null | src/hr_system/hr_system.py | pablomarcel/HR-System | 25edf82d0f4f37ededfb6c6b713a5d7c455ff67e | [
"MIT"
] | null | null | null | src/hr_system/hr_system.py | pablomarcel/HR-System | 25edf82d0f4f37ededfb6c6b713a5d7c455ff67e | [
"MIT"
] | null | null | null | import sys
import pyfiglet
import pandas as pd
import numpy as np
from tabulate import tabulate
import dateutil
import datetime
import re
result = pyfiglet.figlet_format("h r s y s t e m", font="slant")
strStatus = ""
# Main Body of Script ------------------------------------------------------ #
if __name__ == "__main__":
while True:
# reminder for annual review can be a separate class
print(result)
print("Menu of Options")
print(IO.get_menu(1))
print(IO.get_menu(2))
print(IO.get_menu(3))
print(IO.get_menu(4))
print(IO.get_menu(5))
print(IO.get_menu(6))
print(IO.get_menu(7))
IO.activate_reminders(IO.get_employee_db())
# menu printed
strChoice = IO.input_menu_choice() # Get menu option
s = UserSelection()
s.switch(
strChoice
) # Calls the UserSelection class to handle the tasks in the menu
IO.input_press_to_continue(strStatus)
continue # to show the menu
| 29.783237 | 120 | 0.539835 |
34fa480bc9c2232054eb51335128e85dbc56e507 | 169 | py | Python | mskit/metric/__init__.py | gureann/MSKit | 8b360d38288100476740ad808e11b6c1b454dc2c | [
"MIT"
] | null | null | null | mskit/metric/__init__.py | gureann/MSKit | 8b360d38288100476740ad808e11b6c1b454dc2c | [
"MIT"
] | null | null | null | mskit/metric/__init__.py | gureann/MSKit | 8b360d38288100476740ad808e11b6c1b454dc2c | [
"MIT"
] | null | null | null | from . import similarity
from .distance import frechet_dist
from .similarity import pcc, sa
from . import robust
from .robust import iqr, cv, fwhm, count_missing_values
| 28.166667 | 55 | 0.804734 |
34fae8de500f0fefa1f47e343071d4f10241d272 | 229 | py | Python | __main__.py | Luke-zhang-04/powercord-plugin-emojify | 8713f048fb6da160cfdc7d2e7e7aa925eeaaf79e | [
"MIT"
] | null | null | null | __main__.py | Luke-zhang-04/powercord-plugin-emojify | 8713f048fb6da160cfdc7d2e7e7aa925eeaaf79e | [
"MIT"
] | null | null | null | __main__.py | Luke-zhang-04/powercord-plugin-emojify | 8713f048fb6da160cfdc7d2e7e7aa925eeaaf79e | [
"MIT"
] | null | null | null | import scraper.scraper as scraper
import scraper.parser as parser
import sys
from dotenv import load_dotenv
load_dotenv()
if __name__ == "__main__":
if "--noScrape" not in sys.argv:
scraper.main()
parser.main()
| 19.083333 | 36 | 0.716157 |
34fdc3e2fc15cdbce1665add1d016bcc03924a78 | 1,928 | py | Python | monitor/redisplay_monitor.py | perone/redisplay | 32a8902fafec1af6ecfb12b57f8412dc7018940d | [
"MIT"
] | 20 | 2015-01-14T22:52:27.000Z | 2018-02-20T20:34:22.000Z | monitor/redisplay_monitor.py | perone/redisplay | 32a8902fafec1af6ecfb12b57f8412dc7018940d | [
"MIT"
] | null | null | null | monitor/redisplay_monitor.py | perone/redisplay | 32a8902fafec1af6ecfb12b57f8412dc7018940d | [
"MIT"
] | null | null | null | from __future__ import division
import time
import json
from collections import deque
import serial
import redis
import numpy as np
if __name__ == '__main__':
run_main() | 25.706667 | 70 | 0.618776 |
34fe561195c6b90ab544a5eb2c6644d2c927879f | 433 | py | Python | maniacal-moths/newsly/aggregator/models.py | Kushagra-0801/summer-code-jam-2020 | aae9a678b0b30f20ab3cc6cf2b0606ee1f762ca0 | [
"MIT"
] | null | null | null | maniacal-moths/newsly/aggregator/models.py | Kushagra-0801/summer-code-jam-2020 | aae9a678b0b30f20ab3cc6cf2b0606ee1f762ca0 | [
"MIT"
] | null | null | null | maniacal-moths/newsly/aggregator/models.py | Kushagra-0801/summer-code-jam-2020 | aae9a678b0b30f20ab3cc6cf2b0606ee1f762ca0 | [
"MIT"
] | 1 | 2020-08-04T05:44:34.000Z | 2020-08-04T05:44:34.000Z | from django.db import models
from django.utils import timezone | 30.928571 | 64 | 0.704388 |
34ff02f32b21e2a010eed7ca24f81bd53b637b63 | 73 | py | Python | syft_tensorflow/serde/__init__.py | shubham3121/PySyft-TensorFlow | a8a6e47f206e324469dbeb995dc7117c09438ba0 | [
"Apache-2.0"
] | 39 | 2019-10-02T13:48:03.000Z | 2022-01-22T21:18:43.000Z | syft_tensorflow/serde/__init__.py | shubham3121/PySyft-TensorFlow | a8a6e47f206e324469dbeb995dc7117c09438ba0 | [
"Apache-2.0"
] | 19 | 2019-10-10T22:04:47.000Z | 2020-12-15T18:00:34.000Z | syft_tensorflow/serde/__init__.py | shubham3121/PySyft-TensorFlow | a8a6e47f206e324469dbeb995dc7117c09438ba0 | [
"Apache-2.0"
] | 12 | 2019-10-24T15:11:27.000Z | 2022-03-25T09:03:52.000Z | from syft_tensorflow.serde.serde import MAP_TF_SIMPLIFIERS_AND_DETAILERS
| 36.5 | 72 | 0.917808 |
550139e4cbbe8d6698266d6e274ba52d8ab1332c | 549 | py | Python | challenges/03_analysis/A_re.py | deniederhut/workshop_pyintensive | f8f494081c6daabeae0724aa058c2b80fe42878b | [
"BSD-2-Clause"
] | 1 | 2016-10-04T00:04:56.000Z | 2016-10-04T00:04:56.000Z | challenges/03_analysis/A_re.py | deniederhut/workshop_pyintensive | f8f494081c6daabeae0724aa058c2b80fe42878b | [
"BSD-2-Clause"
] | 8 | 2015-12-26T05:49:39.000Z | 2016-05-26T00:10:57.000Z | challenges/03_analysis/A_re.py | deniederhut/workshop_pyintensive | f8f494081c6daabeae0724aa058c2b80fe42878b | [
"BSD-2-Clause"
] | null | null | null | #!/bin/env python
# In this challenge, we are going to use regular expressions to manipulate
# text data
import re
# 1. Compile a regular expression that matches URLs
P_URL = re.compile(r'http://dlab\.berkeley\.edu', flags=re.I)
# 2. Using that pattern, write a function that pulls all of the URLs out of a document and returns them as a list
| 26.142857 | 113 | 0.71949 |
5501abe3bf73d0c0ea6df544abcad09c5f1dc8eb | 8,706 | py | Python | src/pipeline/featureranking.py | heindorf/wsdmcup17-wdvd-classification | 7c75447370b0645276e1f918ed1215a3e8a6c62e | [
"MIT"
] | 2 | 2018-03-21T13:21:43.000Z | 2018-06-13T21:58:51.000Z | src/pipeline/featureranking.py | wsdm-cup-2017/wsdmcup17-wdvd-classification | 7c75447370b0645276e1f918ed1215a3e8a6c62e | [
"MIT"
] | null | null | null | src/pipeline/featureranking.py | wsdm-cup-2017/wsdmcup17-wdvd-classification | 7c75447370b0645276e1f918ed1215a3e8a6c62e | [
"MIT"
] | 2 | 2018-03-21T14:07:32.000Z | 2020-02-24T10:40:52.000Z | # -----------------------------------------------------------------------------
# WSDM Cup 2017 Classification and Evaluation
#
# Copyright (c) 2017 Stefan Heindorf, Martin Potthast, Gregor Engels, Benno Stein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# -----------------------------------------------------------------------------
import itertools
import logging
import pandas as pd
from sklearn import ensemble
from sklearn.externals.joblib import Parallel, delayed
import config
from src import evaluationutils
_logger = logging.getLogger()
########################################################################
# Feature Ranking
########################################################################
def _compute_metrics_for_single_features(training, validation):
"""Return a Pandas data frame with metrics for every single feature."""
arguments = []
for feature in validation.get_features():
# each feature name is a tuple itself and
# here we take the last element of this tuple
training2 = training.select_feature(feature[-1])
validation2 = validation.select_feature(feature[-1])
argument = (training2, validation2, feature, )
arguments.append(argument)
result_list = Parallel(n_jobs=config.FEATURE_RANKING_N_JOBS,
backend='multiprocessing')(
delayed(_compute_feature_metrics_star)(x) for x in arguments)
result = pd.concat(result_list, axis=0)
return result
# This method is called by multiple processes
# This method is called by multiple processes
def _output_sorted_by_auc_pr(time_label, system_name, metrics):
"""Output the metrics sorted by area under precision-recall curve."""
_logger.debug("output_sorted_by_auc_pr...")
metrics.sort_values([('ALL', 'PR')], ascending=False, inplace=True)
metrics.to_csv(config.OUTPUT_PREFIX + "_" + time_label + "_" +
system_name + "_feature_ranking.csv")
latex = metrics.loc[:, evaluationutils.COLUMNS]
# latex.reset_index(drop=True, inplace=True)
latex.to_latex(config.OUTPUT_PREFIX + "_" + time_label + "_" +
system_name + "_feature_ranking.tex", float_format='{:.3f}'.format)
n_features = min(9, len(metrics) - 1)
selection = metrics.iloc[0:n_features] \
.loc[:, [('ALL', 'Feature'), ('ALL', 'PR')]]
_logger.info("Top 10 for all content\n" +
(selection.to_string(float_format='{:.4f}'.format)))
_logger.debug("output_sorted_by_auc_pr... done.")
def _output_sorted_by_group(
time_label, system_name, metrics, group_names, subgroup_names):
"""Output the metrics sorted by group and by PR-AUC within a group."""
_logger.debug('_output_sorted_by_group...')
sort_columns = ['_Group', '_Subgroup', '_Order', '_Feature']
ascending_columns = [True, True, False, True]
metrics['_Group'] = metrics.index.get_level_values('Group')
metrics['_Subgroup'] = metrics.index.get_level_values('Subgroup')
metrics['_Feature'] = metrics.index.get_level_values('Feature')
subgroup_names = ['ALL'] + subgroup_names
# Define the order of groups and subgroups
metrics['_Group'] = metrics['_Group'].astype('category').cat.set_categories(
group_names, ordered=True)
metrics['_Subgroup'] = metrics['_Subgroup'].astype('category').cat.set_categories(
subgroup_names, ordered=True)
# Sort the features by AUC_PR and make sure the subgroup is always shown
# before the single features
metrics['_Order'] = metrics[('ALL', 'PR')]
# without this line, the following line causes a PerformanceWarning
metrics.sort_index(inplace=True)
metrics.loc[(metrics['_Feature'] == 'ALL'), '_Order'] = 1.0
metrics.sort_values(by=sort_columns,
ascending=ascending_columns, inplace=True)
metrics = metrics.drop(sort_columns, axis=1)
metrics.to_csv(config.OUTPUT_PREFIX + "_" + time_label + "_" +
system_name + "_feature_groups.csv")
latex_names = metrics.apply(_compute_latex_name, axis=1)
metrics.set_index(latex_names, inplace=True)
metrics = evaluationutils.remove_columns(metrics, evaluationutils.CURVES)
metrics = evaluationutils.remove_columns(metrics, evaluationutils.STATISTICS)
evaluationutils.print_metrics_to_latex(
metrics, config.OUTPUT_PREFIX + "_" + time_label + "_" +
system_name + "_feature_groups.tex")
_logger.debug('_output_sorted_by_group... done.')
| 39.93578 | 91 | 0.68045 |
550309304b59f46612eb7c9d7614edf6b323939f | 25,470 | py | Python | libjmp.py | RenolY2/obj2bjmp | de5ea2acf4493bec4c1b918b38099685fd9b864e | [
"MIT"
] | null | null | null | libjmp.py | RenolY2/obj2bjmp | de5ea2acf4493bec4c1b918b38099685fd9b864e | [
"MIT"
] | null | null | null | libjmp.py | RenolY2/obj2bjmp | de5ea2acf4493bec4c1b918b38099685fd9b864e | [
"MIT"
] | null | null | null | from struct import unpack, pack
from math import ceil, inf, acos, degrees
from vectors import Vector3, Triangle, Vector2, Matrix3x3
from re import match
UPVECTOR = Vector3(0.0, 1.0, 0.0)
FWVECTOR = Vector3(1.0, 0.0, 0.0)
SIDEVECTOR = Vector3(0.0, 0.0, 1.0)
class BJMPTriangle(object):
def fill_vertices(self, vertices: list):
try:
v1_index = vertices.index(self.triangle.origin)
except ValueError:
v1_index = len(vertices)
vertices.append(self.triangle.origin)
try:
v2_index = vertices.index(self.triangle.p2)
except ValueError:
v2_index = len(vertices)
vertices.append(self.triangle.p2)
try:
v3_index = vertices.index(self.triangle.p3)
except ValueError:
v3_index = len(vertices)
vertices.append(self.triangle.p3)
self._p1_index = v1_index
self._p2_index = v2_index
self._p3_index = v3_index
def write(self, f):
write_uint16(f, self._p1_index)
write_uint16(f, self._p2_index)
write_uint16(f, self._p3_index)
write_vector3(f, self.normal)
write_float(f, self.d)
write_vector3(f, self.binormal)
write_vector3(f, self.tangent)
write_float(f, self.p1.x)
write_float(f, self.p1.z)
write_vector3(f, self.edge_normal1)
write_float(f, self.edge_normal1_d)
write_float(f, self.p2.x)
write_float(f, self.p2.z)
write_vector3(f, self.edge_normal2)
write_float(f, self.edge_normal2_d)
write_float(f, self.p3.x)
write_float(f, self.p3.z)
write_vector3(f, self.edge_normal3)
write_float(f, self.edge_normal3_d)
write_uint16(f, self.coll_data)
class Group(object):
class CollisionGroups(object):
def write(self, f):
self.bbox.write(f)
write_uint32(f, self.grid_x)
write_uint32(f, self.grid_y)
write_uint32(f, self.grid_z)
write_vector3(f, self.cell_dimensions)
write_vector3(f, self.cell_inverse)
write_uint32(f, len(self.groups))
indices = []
for group in self.groups:
group.add_indices(indices)
group.write(f)
indices = []
for group in self.groups:
indices.extend(group.tri_indices)
write_uint32(f, len(indices))
for index in indices:
write_uint16(f, index)
class BJMP(object):
def write(self, f):
write_uint32(f, 0x013304E6)
self.bbox_inner.write(f)
self.bbox_outer.write(f)
vertices = []
for triangle in self.triangles:
triangle.fill_vertices(vertices)
write_uint16(f, len(vertices))
for vertex in vertices:
write_vector3(f, vertex)
write_uint32(f, len(self.triangles))
for triangle in self.triangles:
triangle.write(f)
self.collision_groups.write(f)
if __name__ == "__main__":
import sys
in_name = sys.argv[1]
if in_name.endswith(".obj"):
out_name = in_name + ".bjmp"
with open(in_name, "r") as f:
bjmp = BJMP.from_obj(f)
with open(out_name, "wb") as f:
bjmp.write(f)
elif in_name.endswith(".bjmp"):
out_name = in_name+".obj"
with open(in_name, "rb") as f:
bjmp = BJMP.from_file(f)
with open(out_name, "w") as f:
f.write("# .OBJ generated from Pikmin 2 by Yoshi2's obj2grid.py\n\n")
f.write("# VERTICES BELOW\n\n")
vertex_counter = 0
faces = []
for btriangle in bjmp.triangles:
tri = btriangle.triangle
p1, p2, p3 = tri.origin, tri.p2, tri.p3
f.write("v {} {} {}\n".format(p1.x, p1.y, p1.z))
f.write("v {} {} {}\n".format(p2.x, p2.y, p2.z))
f.write("v {} {} {}\n".format(p3.x, p3.y, p3.z))
#f.write("vt {} {}\n".format(btriangle.p1.x, btriangle.p1.z))
#f.write("vt {} {}\n".format(btriangle.p2.x, btriangle.p2.z))
#f.write("vt {} {}\n".format(btriangle.p3.x, btriangle.p3.z))
faces.append((vertex_counter+1, vertex_counter+2, vertex_counter+3, btriangle.coll_data))
vertex_counter += 3
last_coll = None
for i1, i2, i3, coll in faces:
if coll != last_coll:
f.write("usemtl collision_type0x{:04X}\n".format(coll))
f.write("f {0} {2} {1}\n".format(i1, i2, i3))
print("done") | 32.322335 | 117 | 0.517314 |
5504298a3a2d8c197f31284679e78d49ef6eed72 | 585 | py | Python | kattis/integerlists.py | div5252/competitive-programming | 111902dff75e79e65213c95055ffb0bb15b76e94 | [
"WTFPL"
] | 506 | 2018-08-22T10:30:38.000Z | 2022-03-31T10:01:49.000Z | kattis/integerlists.py | diegordzr/competitive-programming | 1443fb4bd1c92c2acff64ba2828abb21b067e6e0 | [
"WTFPL"
] | 13 | 2019-08-07T18:31:18.000Z | 2020-12-15T21:54:41.000Z | kattis/integerlists.py | diegordzr/competitive-programming | 1443fb4bd1c92c2acff64ba2828abb21b067e6e0 | [
"WTFPL"
] | 234 | 2018-08-06T17:11:41.000Z | 2022-03-26T10:56:42.000Z | #!/usr/bin/env python3
# https://open.kattis.com/problems/integerlists
for _ in range(int(input())):
p = input()
n = int(input())
i, j = 0, n
xs = input()[1:-1].split(',')
front = True
for c in p:
if c == 'R':
front = not front
elif i == j:
i += 1
break
elif front:
i += 1
else:
j -= 1
if i > j:
print('error')
else:
if front:
print('[' + ','.join(xs[i:j]) + ']')
else:
print('[' + ','.join(xs[i:j][::-1]) + ']')
| 22.5 | 54 | 0.384615 |
55046b3036b22157a72d92e77888dc355a149d40 | 3,177 | py | Python | main/tests/test_middleware.py | uktrade/return-to-office | d4c53c734611413c9f8a7624e52dc35910c5ff57 | [
"MIT"
] | 1 | 2020-10-25T18:16:47.000Z | 2020-10-25T18:16:47.000Z | main/tests/test_middleware.py | uktrade/return-to-office | d4c53c734611413c9f8a7624e52dc35910c5ff57 | [
"MIT"
] | 1 | 2020-10-27T07:11:26.000Z | 2020-10-27T07:11:26.000Z | main/tests/test_middleware.py | uktrade/return-to-office | d4c53c734611413c9f8a7624e52dc35910c5ff57 | [
"MIT"
] | null | null | null | import pytest
from django.http import HttpResponse
from django.urls import reverse
from main.middleware import IpRestrictionMiddleware
| 34.912088 | 98 | 0.657224 |
5505c2fad9d4eaf68b407e24b865a1b9411e4836 | 2,418 | py | Python | modelproj/topic.py | cesell/modelproj | 313f89784a19842c866fa2563b326e5d044a2301 | [
"MIT"
] | null | null | null | modelproj/topic.py | cesell/modelproj | 313f89784a19842c866fa2563b326e5d044a2301 | [
"MIT"
] | null | null | null | modelproj/topic.py | cesell/modelproj | 313f89784a19842c866fa2563b326e5d044a2301 | [
"MIT"
] | null | null | null | import json
import re
from urllib.request import urlopen
'''
The use of objects has various benefits.
1. Better control of context
2. State that can be evaluated
3. Data can be created and then processing can be added
4. Clean interface
'''
def main():
from argparse import ArgumentParser
prs = ArgumentParser(description='summarize topics from Wikipedia')
prs.add_argument('-t', '--topic', help='the target topic', required='True')
args = prs.parse_args()
print(TopicSummarizer(args.topic).process().get_results(as_text=True))
return
if __name__ == '__main__':
main()
| 30.607595 | 124 | 0.63689 |
550824fc3e2f47ccef32bd1ac78448a3f415ba0f | 4,154 | py | Python | wanderingpole/classifyingtweets/train_wandering_old.py | ssdorsey/wandering-pole | 606ad8f1979354e01dea1acf01107b88b3b9e91b | [
"MIT"
] | null | null | null | wanderingpole/classifyingtweets/train_wandering_old.py | ssdorsey/wandering-pole | 606ad8f1979354e01dea1acf01107b88b3b9e91b | [
"MIT"
] | null | null | null | wanderingpole/classifyingtweets/train_wandering_old.py | ssdorsey/wandering-pole | 606ad8f1979354e01dea1acf01107b88b3b9e91b | [
"MIT"
] | null | null | null | import pandas as pd
import numpy as np
import json
from simpletransformers.classification import ClassificationModel, ClassificationArgs
import sklearn
from sklearn.model_selection import train_test_split
import torch
import re
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import os
from tqdm import tqdm
np.random.seed(2)
# import the data
# tweets = pd.read_csv('data/postIR_final.csv')
# os.chdir('..')
tweets = pd.read_csv('D:/Dropbox/Twitter/training_data/training_final.csv', encoding='latin1')
# restrict to tweets with coding
tweets = tweets[tweets['uncivil_final'].isin([0,1])]
# subset to just text and labels, fix columns names
tweets = tweets.loc[:, ['text', 'uncivil_final']]
tweets.columns = ['text', 'labels']
# import other batch
mike = pd.read_excel(r'D:\Dropbox\wandering-pole\wanderingpole\data\new_pull_Michael.xls')
mike = mike[['full_text', 'uncivil']]
mike = mike.rename(columns={'full_text': 'text', 'uncivil': 'labels'})
# extra
mike_extra = pd.read_csv(r'D:\Dropbox\wandering-pole\wanderingpole\data\michael_extra.csv')
mike_extra = mike_extra.rename(columns={'full_text': 'text', 'uncivil': 'labels'})
# pull a bunch of old 0's
old_model = pd.read_csv("D:/Dropbox/Twitter/allMCtweets.csv", encoding='latin1')
old_0 = old_model[old_model['polarizing']==0].sample(7432, random_state=619)
old_0 = old_0[['text']]
old_0['labels'] = 0
# combine the new data
tweets = pd.concat([tweets, mike, mike_extra, old_0])
# drop incomplete data
tweets = tweets[tweets['labels'].isin([0,1])]
# drop duplicates
tweets = tweets.drop_duplicates(subset=['text'])
# delete links
# TODO: convert emoticons
re_url = r"(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?]))"
tweets['text'] = tweets['text'].replace(re_url, '', regex=True)
# remove retweet header
re_retweet = r"RT\s@\w+:"
tweets['text'] = tweets['text'].replace(re_retweet, '', regex=True)
# double-check for weird excel handling of ampersand
re_amp = r'&'
tweets['text'] = tweets['text'].replace(re_amp, '', regex=True)
# split train/test
# tweets.loc[: , 'split'] = np.random.choice(['train','validate','test'], len(tweets), p=[.85, .15])
# train = tweets.loc[tweets.split=='train']
# validate = tweets.loc[tweets.split=='validate']
# test = tweets.loc[tweets.split=='test']
tweets.loc[: , 'split'] = np.random.choice(['train','test'], len(tweets), p=[.85, .15])
train = tweets.loc[tweets.split=='train']
test = tweets.loc[tweets.split=='test']
# build / train
# weights
counts = train['labels'].value_counts().sort_index()
weights = [(1-(ii/len(train)))*10 for ii in counts]
model_args = ClassificationArgs()
# model_args.use_early_stopping = True
# model_args.early_stopping_delta = 0.01
# model_args.early_stopping_metric = "mcc"
# model_args.early_stopping_metric_minimize = False
# model_args.early_stopping_patience = 5
# model_args.evaluate_during_training_verbose = True
# model_args.evaluate_during_training_steps = 1000
model_args.output_dir = r'Model_berttweet/'
model_args.cache_dir = r'Model_berttweet/'
model_args.overwrite_output_dir = True
model_args.training_batch_size = 1024
model_args.eval_batch_size = 1024
model_args.num_train_epochs = 5
model = ClassificationModel(
'bertweet'
, 'vinai/bertweet-base'
, num_labels=len(tweets['labels'].unique())
# , weight=weights # DO help
, weight=[.8,10]
, use_cuda=True
, args=model_args
)
model.train_model(train)
# Evaluate the model
# model = ClassificationModel('bertweet'
# , 'Model_berttweet/'
# , num_labels=2
# , args={'eval_batch_size':512})
result, model_outputs, wrong_predictions = model.eval_model(test)
y_t = list(test.labels)
y_hat = [np.argmax(a) for a in model_outputs]
print(sklearn.metrics.classification_report(y_true=y_t, y_pred=y_hat))
sklearn.metrics.confusion_matrix(y_true=y_t, y_pred=y_hat)
# put out the results
test.loc[:, 'predicted'] = y_hat
| 32.708661 | 194 | 0.684401 |
5508e6dcf9a3120fc2d2a1fa35c2fb918cef92fb | 3,339 | py | Python | Source/common.py | joaohenggeler/twitch-chat-highlights | 826cda239de2e5185266a04c12a8909ae5f98a3b | [
"MIT"
] | null | null | null | Source/common.py | joaohenggeler/twitch-chat-highlights | 826cda239de2e5185266a04c12a8909ae5f98a3b | [
"MIT"
] | null | null | null | Source/common.py | joaohenggeler/twitch-chat-highlights | 826cda239de2e5185266a04c12a8909ae5f98a3b | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
"""
A module that defines any general purpose functions used by all scripts, including loading configuration files,
connecting to the database, and handling Twitch's timestamp formats.
"""
import json
import sqlite3
from datetime import datetime
from typing import Tuple, Union
####################################################################################################
####################################################################################################
def split_twitch_duration(duration: str) -> Tuple[int, int, int, int]:
# Duration format: 00h00m00s or 00m00s
duration = duration.replace('h', ':').replace('m', ':').replace('s', '')
tokens = duration.split(':', 2)
hours = int(tokens[-3]) if len(tokens) >= 3 else 0
minutes = int(tokens[-2]) if len(tokens) >= 2 else 0
seconds = int(tokens[-1]) if len(tokens) >= 1 else 0
total_seconds = hours * 3600 + minutes * 60 + seconds
return hours, minutes, seconds, total_seconds
def convert_twitch_timestamp_to_datetime(timestamp: str) -> datetime:
# Datetime format: YYYY-MM-DDThh:mm:ss.sssZ
# Where the following precisions where observed:
# - YYYY-MM-DDThh:mm:ss.sssssssssZ
# - YYYY-MM-DDThh:mm:ss.ssZ
# - YYYY-MM-DDThh:mm:ss.sZ
# - YYYY-MM-DDThh:mm:ssZ
# Truncate anything past the microsecond precision.
if '.' in timestamp:
microseconds: Union[str, int]
beginning, microseconds = timestamp.rsplit('.', 1)
microseconds, _ = microseconds.rsplit('Z', 1)
timestamp = beginning + '.' + microseconds[:6].ljust(6, '0') + 'Z'
timestamp = timestamp.replace('Z', '+00:00')
return datetime.fromisoformat(timestamp) | 30.081081 | 112 | 0.632824 |
550ab4d7e165fcec5a4c9ed00a1fc8a3d4f624ba | 986 | py | Python | unicodetest.py | conradstorz/SpeedTrivia | e222831223c704f5bb169d4c2d475c9e2a8c4c08 | [
"Apache-2.0"
] | null | null | null | unicodetest.py | conradstorz/SpeedTrivia | e222831223c704f5bb169d4c2d475c9e2a8c4c08 | [
"Apache-2.0"
] | 1 | 2021-04-26T22:47:19.000Z | 2021-04-26T22:47:19.000Z | unicodetest.py | conradstorz/SpeedTrivia | e222831223c704f5bb169d4c2d475c9e2a8c4c08 | [
"Apache-2.0"
] | null | null | null | from unidecode import unidecode
from unicodedata import name
import ftfy
for i in range(33, 65535):
if i > 0xEFFFF:
continue # Characters in Private Use Area and above are ignored
if 0xD800 <= i <= 0xDFFF:
continue
h = hex(i)
u = chr(i)
f = ftfy.fix_text(u, normalization="NFKC")
a = unidecode(u)
if a != "[?]" and len(u) != 0 and len(a) != 0 and len(f) != 0:
new_char = ""
if u != f:
for c in list(f):
new_char += "{}, ".format(ord(c))
new_char = new_char[:-2]
else:
new_char = "Same"
try:
txt = name(u).lower()
# print(txt)
if 'mark' in txt:
print(
f"dec={i} hex={h} unicode_chr={u} ftfy_chr(s)={f} ftfy_dec={new_char}\n",
f"ascii_chr={a} uni_len={len(u)} ascii_len={len(a)} unicode_name={name(u)}"
)
except ValueError:
pass
| 30.8125 | 95 | 0.485801 |
550bcb1222329d8b28b7654dc8f797c3fc71d7e1 | 4,363 | py | Python | codes/mosaic.py | KurmasanaWT/community | 5fc9e7da5b3e8df2bc9f85580a070de8c868a656 | [
"MIT"
] | null | null | null | codes/mosaic.py | KurmasanaWT/community | 5fc9e7da5b3e8df2bc9f85580a070de8c868a656 | [
"MIT"
] | null | null | null | codes/mosaic.py | KurmasanaWT/community | 5fc9e7da5b3e8df2bc9f85580a070de8c868a656 | [
"MIT"
] | null | null | null | import dash_bootstrap_components as dbc
from dash import html
from app import app
layout = dbc.Container(
children=[
dbc.Card([
#dbc.CardHeader("EURONEWS (Unio Europia)"),
dbc.CardBody([html.Iframe(className="ytvid", width="420", height="315", src="https://www.youtube.com/embed/sPgqEHsONK8?&autoplay=1&mute=1", allow="fullscreen")]),
], className="cardSize-vid"),
dbc.Card([
#dbc.CardHeader("SKY NEWS (Reino Unido)"),
dbc.CardBody([html.Iframe(className="ytvid", width="420", height="315", src="https://www.youtube.com/embed/9Auq9mYxFEE?&autoplay=1&mute=1", allow="fullscreen")]),
], className="cardSize-vid"),
dbc.Card([
#dbc.CardHeader("FRANCE 24 (Frana)"),
dbc.CardBody([html.Iframe(className="ytvid", width="420", height="315", src="https://www.youtube.com/embed/u9foWyMSATM?&autoplay=1&mute=1", allow="fullscreen")]),
], className="cardSize-vid"),
dbc.Card([
#dbc.CardHeader("DEUTSCH WELLE (Alemanha)"),
dbc.CardBody([html.Iframe(className="ytvid", width="420", height="315", src="https://www.youtube.com/embed/m01az_TdpQI?&autoplay=1&mute=1", allow="fullscreen")]),
], className="cardSize-vid"),
dbc.Card([
#dbc.CardHeader("RT (Rssia)"),
dbc.CardBody([html.Iframe(className="ytvid", width="420", height="315", src="https://odysee.com/$/embed/RTlivestream/8c06ebe369b6ecf6ad383e4a32bfca34c0168d79?r=RfLjh5uDhbZHt8SDkQFdZyKTmCbSCpWH&autoplay=1&mute=1", allow="fullscreen")]),
], className="cardSize-vid"),
dbc.Card([
#dbc.CardHeader("TRT WORLD (Turquia)"),
dbc.CardBody([html.Iframe(className="ytvid", width="420", height="315", src="https://www.youtube.com/embed/CV5Fooi8YJA?&autoplay=1&mute=1", allow="fullscreen")]),
], className="cardSize-vid"),
dbc.Card([
#dbc.CardHeader("AL JAZEERA (Catar)"),
dbc.CardBody([html.Iframe(className="ytvid", width="420", height="315", src="https://www.youtube.com/embed/F-POY4Q0QSI?&autoplay=1&mute=1", allow="fullscreen")]),
], className="cardSize-vid"),
dbc.Card([
#dbc.CardHeader("NDTV (India)"),
dbc.CardBody([html.Iframe(className="ytvid", width="420", height="315", src="https://www.youtube.com/embed/WB-y7_ymPJ4?&autoplay=1&mute=1", allow="fullscreen")]),
], className="cardSize-vid"),
dbc.Card([
#dbc.CardHeader("CGTN EUROPE (China)"),
dbc.CardBody([html.Iframe(className="ytvid", width="420", height="315", src="https://www.youtube.com/embed/FGabkYr-Sfs?&autoplay=1&mute=1", allow="fullscreen")]),
], className="cardSize-vid"),
dbc.Card([
#dbc.CardHeader("ANN NEWS (Japo)"),
dbc.CardBody([html.Iframe(className="ytvid", width="420", height="315", src="https://www.youtube.com/embed/coYw-eVU0Ks?&autoplay=1&mute=1", allow="fullscreen")]),
], className="cardSize-vid"),
dbc.Card([
#dbc.CardHeader("NEWS 12 NEW YORK (Estados Unidos)"),
dbc.CardBody([html.Iframe(className="ytvid", width="420", height="315", src="https://www.youtube.com/embed/RmmRlztXETI?&autoplay=1&mute=1", allow="fullscreen")]),
], className="cardSize-vid"),
dbc.Card([
#dbc.CardHeader("WEBCAM UCRNIA (Ao Vivo)"),
dbc.CardBody([html.Iframe(className="ytvid", width="420", height="315", src="https://www.youtube.com/embed/3hiyVq44pK8?&autoplay=1&mute=1", allow="fullscreen")]),
], className="cardSize-vid"),
html.Div(dbc.Badge(children=[
html.Span("* Todos os vdeos so transmitidos pelo "),
html.A(href='http://www.youtube.com', target='new', children='YouTube'),
html.Span(" exceto o canal RT, transmitido pelo "),
html.A(href='http://www.odysee.com', target='new', children='Odysee'),
html.Span(" .")
], className="badge-link",
))
], fluid=True
)
'''
RT RUSSIA
https://rumble.com/embed/vtp5hp/?pub=4&autoplay=2
https://odysee.com/$/embed/RTlivestream/8c06ebe369b6ecf6ad383e4a32bfca34c0168d79?r=RfLjh5uDhbZHt8SDkQFdZyKTmCbSCpWH
''' | 49.579545 | 247 | 0.608755 |
550c04ca9a44d927c37f244ee230dced2cf832ce | 4,387 | py | Python | app/weibo/views.py | guoweikuang/weibo_project | 38cb2a6d72a16f2f8c1714e83564c833f8e4af0c | [
"Apache-2.0"
] | 4 | 2019-03-25T08:47:22.000Z | 2021-03-16T02:39:29.000Z | app/weibo/views.py | guoweikuang/weibo_project | 38cb2a6d72a16f2f8c1714e83564c833f8e4af0c | [
"Apache-2.0"
] | 1 | 2020-01-06T03:37:46.000Z | 2020-01-06T03:37:46.000Z | app/weibo/views.py | guoweikuang/weibo_project | 38cb2a6d72a16f2f8c1714e83564c833f8e4af0c | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
~~~~~~~~~~~~~~~~~~~~~~
main module
#author guoweikuang
"""
from flask import render_template
from flask import redirect
from flask import url_for
from flask import request
from flask_login import login_required
from pyecharts import Bar
from pyecharts.utils import json_dumps
#from pyecharts import json_dumps
import json
from . import weibo
from .forms import CrawlForm
from .forms import AnalyzeForm
from app import run_async_crawl
from app import run_build_vsm
from ..utils import filter_data
from ..utils import run_k_means
from ..utils import classify_k_cluster
from ..utils import get_mysql_content
from ..utils import get_mysql_opinion
from ..utils import run_old_all_process
from ..utils import get_max_hot_keyword_chart
from ..utils import list_top_hot_topic
from ..utils import get_hot_text_from_category
from ..utils import bar_chart
REMOTE_HOST = "https://pyecharts.github.io/assets/js"
| 29.843537 | 96 | 0.641213 |
550c5f11985d3fc31fb9561d9cb991332777ee6d | 2,598 | py | Python | source/extras/Mesa/src/mesa/glapi/gl_offsets.py | binaryblob01/zfree86 | e80ea992d87501b8e3e2d7c07a414591c2e11c70 | [
"Xnet",
"X11"
] | 1 | 2021-09-08T21:13:25.000Z | 2021-09-08T21:13:25.000Z | source/extras/Mesa/src/mesa/glapi/gl_offsets.py | binaryblob01/zfree86 | e80ea992d87501b8e3e2d7c07a414591c2e11c70 | [
"Xnet",
"X11"
] | null | null | null | source/extras/Mesa/src/mesa/glapi/gl_offsets.py | binaryblob01/zfree86 | e80ea992d87501b8e3e2d7c07a414591c2e11c70 | [
"Xnet",
"X11"
] | 1 | 2021-01-22T00:19:47.000Z | 2021-01-22T00:19:47.000Z | #!/usr/bin/env python
# (C) Copyright IBM Corporation 2004
# All Rights Reserved.
#
# 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
# on the rights to use, copy, modify, merge, publish, distribute, sub
# license, and/or sell copies of the Software, and to permit persons to whom
# the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# Authors:
# Ian Romanick <idr@us.ibm.com>
#
# $XFree86: xc/extras/Mesa/src/mesa/glapi/gl_offsets.py,v 1.2 2006/05/16 15:34:46 tsi Exp $
from xml.sax import saxutils
from xml.sax import make_parser
from xml.sax.handler import feature_namespaces
import gl_XML
import license
import sys, getopt
if __name__ == '__main__':
file_name = "gl_API.xml"
try:
(args, trail) = getopt.getopt(sys.argv[1:], "f:")
except Exception,e:
show_usage()
for (arg,val) in args:
if arg == "-f":
file_name = val
dh = PrintGlOffsets()
parser = make_parser()
parser.setFeature(feature_namespaces, 0)
parser.setContentHandler(dh)
f = open(file_name)
dh.printHeader()
parser.parse(f)
dh.printFooter()
| 29.191011 | 91 | 0.736336 |
550d6f4bd6f869c618dd2e2fd54a7578116878b5 | 1,728 | py | Python | exercises/rational-numbers/rational_numbers.py | southpush/python | 048191583ed2cf668c6180d851d100f277a74101 | [
"MIT"
] | null | null | null | exercises/rational-numbers/rational_numbers.py | southpush/python | 048191583ed2cf668c6180d851d100f277a74101 | [
"MIT"
] | null | null | null | exercises/rational-numbers/rational_numbers.py | southpush/python | 048191583ed2cf668c6180d851d100f277a74101 | [
"MIT"
] | null | null | null | from __future__ import division
| 32.603774 | 136 | 0.567708 |
550d81bb5bc1c79a79d6bdfe74dcdeb0caf47b8e | 6,269 | py | Python | webui/forms/dag.py | blawson/dataforj | 2b666f303b628ceced425e2bdb7f93ae2ccc2a73 | [
"Apache-2.0"
] | 1 | 2021-04-30T02:15:33.000Z | 2021-04-30T02:15:33.000Z | webui/forms/dag.py | blawson/dataforj | 2b666f303b628ceced425e2bdb7f93ae2ccc2a73 | [
"Apache-2.0"
] | null | null | null | webui/forms/dag.py | blawson/dataforj | 2b666f303b628ceced425e2bdb7f93ae2ccc2a73 | [
"Apache-2.0"
] | 1 | 2021-04-30T03:27:20.000Z | 2021-04-30T03:27:20.000Z | from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions
from webui.dataforj import get_flow
def create_dependson_tuple(flow):
depends_on_list=[step.name for step in flow._steps.values() if step.dagre_type != 'Sink']
return tuple((name, name) for name in depends_on_list)
| 40.445161 | 128 | 0.667092 |
550fca2bdb3d0148522e4c33f7841bfbb8e59b80 | 3,109 | py | Python | remote-access/remote_connect.py | sag-tgo/thin-edge.io_examples | 7da43f330b640d48c2b0f3be2594ff85fe5c9dfe | [
"Apache-2.0"
] | 3 | 2021-06-07T19:11:23.000Z | 2022-02-03T16:20:27.000Z | remote-access/remote_connect.py | sag-tgo/thin-edge.io_examples | 7da43f330b640d48c2b0f3be2594ff85fe5c9dfe | [
"Apache-2.0"
] | 5 | 2021-11-04T09:44:36.000Z | 2022-03-30T22:19:11.000Z | remote-access/remote_connect.py | sag-tgo/thin-edge.io_examples | 7da43f330b640d48c2b0f3be2594ff85fe5c9dfe | [
"Apache-2.0"
] | 11 | 2021-06-16T14:04:01.000Z | 2022-03-17T08:29:54.000Z | import logging
from c8ydp.device_proxy import DeviceProxy, WebSocketFailureException
from threading import Thread
import threading
from c8yMQTT import C8yMQTT
import concurrent.futures
import os
logging.basicConfig(level=logging.INFO,format='%(asctime)s %(name)s %(message)s')
logger = logging.getLogger(__name__)
stream = os.popen('sudo tedge config get c8y.url')
url=stream.read().strip()
logger.info('Got tenant URL: '+ url)
c8y = C8yMQTT('remote_connect','localhost',1883,'c8y/s/ds,c8y/s/e,c8y/s/dt,c8y/s/dat')
connected = c8y.connect(on_message)
logger.info('Connection Result:' + str(connected))
if connected != 0:
logger.error('Connection not possible: ' + str(connected))
exit()
c8y.publish("c8y/s/us", "114,c8y_RemoteAccessConnect")
| 38.382716 | 145 | 0.620135 |
550fdb4e80b863ed65bbb7d6dee920e010a04788 | 1,397 | py | Python | Homework 1/question_solutions/question_3_convergence.py | rukmal/FE-621-Homework | 9c7cef7931b58aed54867acd8e8cf1928bc6d2dd | [
"MIT"
] | 4 | 2020-04-29T04:34:50.000Z | 2021-11-11T07:49:08.000Z | Homework 1/question_solutions/question_3_convergence.py | rukmal/FE-621-Homework | 9c7cef7931b58aed54867acd8e8cf1928bc6d2dd | [
"MIT"
] | null | null | null | Homework 1/question_solutions/question_3_convergence.py | rukmal/FE-621-Homework | 9c7cef7931b58aed54867acd8e8cf1928bc6d2dd | [
"MIT"
] | 1 | 2020-04-23T07:32:44.000Z | 2020-04-23T07:32:44.000Z | from context import fe621
import numpy as np
import pandas as pd
def convergenceSegmentLimit():
"""Function to compute the number of segments required for convergence of
various quadrature methods.
"""
# Objective function
# Setting target tolerance level for termination
epsilon = 1e-3
# Using Trapezoidal rule
trapezoidal_result = fe621.numerical_integration.convergenceApproximation(
f=f,
rule=fe621.numerical_integration.trapezoidalRule,
epsilon=epsilon
)
# Using Simpson's rule
simpsons_result = fe621.numerical_integration.convergenceApproximation(
f=f,
rule=fe621.numerical_integration.simpsonsRule,
epsilon=epsilon
)
# Building DataFrame of results for output
results = pd.DataFrame(np.abs(np.array([trapezoidal_result,
simpsons_result])))
# Setting row and column names
results.columns = ['Estimated Area', 'Segments']
results.index = ['Trapezoidal Rule', 'Simpson\'s Rule']
# Saving to CSV
results.to_csv('Homework 1/bin/numerical_integration/convergence.csv',
header=True, index=True, float_format='%.8e')
if __name__ == '__main__':
# Part 3 - Convergence Analysis
convergenceSegmentLimit()
| 28.510204 | 78 | 0.662133 |
5510dc6e8363a437e31e7e5a4bf4b7a901eabff1 | 459 | py | Python | cliva_fl/utils/__init__.py | DataManagementLab/thesis-fl_client-side_validation | 0f6a35d08966133e6a8c13a110b9307d91f2d9cb | [
"MIT"
] | null | null | null | cliva_fl/utils/__init__.py | DataManagementLab/thesis-fl_client-side_validation | 0f6a35d08966133e6a8c13a110b9307d91f2d9cb | [
"MIT"
] | null | null | null | cliva_fl/utils/__init__.py | DataManagementLab/thesis-fl_client-side_validation | 0f6a35d08966133e6a8c13a110b9307d91f2d9cb | [
"MIT"
] | null | null | null | from .utils import vc, load_config, tensors_close, tensors_close_sum, rand_true, freivalds_rounds, submul_ratio
from .partial_class import partial_class
from .validation_set import ValidationSet
from .validation_buffer import ValidationBuffer
from .register_hooks import register_activation_hooks, register_gradient_hooks
from .model_poisoning import gradient_noise
from .logger import Logger
from .plotter import Plotter
from .time_tracker import TimeTracker | 51 | 111 | 0.873638 |
5513ebc4d50ae6eaae27a3d7a14bbfdad406c427 | 712 | py | Python | brainframe/api/stubs/__init__.py | aotuai/brainframe_python | 8397f2fd7a4402716c65d402417995b4862eeb7a | [
"BSD-3-Clause"
] | 4 | 2020-05-20T01:06:10.000Z | 2020-09-12T14:23:05.000Z | brainframe/api/stubs/__init__.py | aotuai/brainframe-python | 8397f2fd7a4402716c65d402417995b4862eeb7a | [
"BSD-3-Clause"
] | 8 | 2021-04-22T00:02:45.000Z | 2022-02-01T08:08:07.000Z | brainframe/api/stubs/__init__.py | aotuai/brainframe-python | 8397f2fd7a4402716c65d402417995b4862eeb7a | [
"BSD-3-Clause"
] | 2 | 2021-02-18T07:28:27.000Z | 2021-10-08T03:22:10.000Z | from .alerts import AlertStubMixin
from .analysis import AnalysisStubMixin
from .identities import IdentityStubMixin
from .capsules import CapsuleStubMixin
from .streams import StreamStubMixin
from .zone_statuses import ZoneStatusStubMixin
from .zones import ZoneStubMixin
from .storage import StorageStubMixin
from .alarms import ZoneAlarmStubMixin
from .process_image import ProcessImageStubMixIn
from .encodings import EncodingStubMixIn
from .premises import PremisesStubMixin
from .users import UserStubMixin
from .licenses import LicenseStubMixIn
from .cloud_tokens import CloudTokensStubMixin
from .cloud_users import CloudUsersStubMixIn
from .oauth2 import OAuth2StubMixIn
from .base_stub import BaseStub
| 37.473684 | 48 | 0.873596 |
5515891d5f1f8f61ee9eb8bdb9f6ccda922b50fc | 118 | py | Python | shgo/__init__.py | rkern/shgo | 03315284025e705f64bf84f3f9ba36026f6a7236 | [
"MIT"
] | null | null | null | shgo/__init__.py | rkern/shgo | 03315284025e705f64bf84f3f9ba36026f6a7236 | [
"MIT"
] | null | null | null | shgo/__init__.py | rkern/shgo | 03315284025e705f64bf84f3f9ba36026f6a7236 | [
"MIT"
] | null | null | null | from shgo.shgo_m.triangulation import *
from ._shgo import shgo
__all__ = [s for s in dir() if not s.startswith('_')] | 29.5 | 53 | 0.728814 |
55169c728f2c5da43dc85a640e3450e734567aeb | 20,482 | py | Python | opusfilter/filters.py | BrightXiaoHan/OpusFilter | 804c82a46837fc57ca69934314622043248f6042 | [
"MIT"
] | null | null | null | opusfilter/filters.py | BrightXiaoHan/OpusFilter | 804c82a46837fc57ca69934314622043248f6042 | [
"MIT"
] | null | null | null | opusfilter/filters.py | BrightXiaoHan/OpusFilter | 804c82a46837fc57ca69934314622043248f6042 | [
"MIT"
] | null | null | null | """Corpus filtering"""
import difflib
import itertools
import logging
import math
import os
import string
from typing import Iterator, List, Tuple
import rapidfuzz
import regex
from langid.langid import LanguageIdentifier, model
import pycld2
from bs4 import BeautifulSoup as bs
import fasttext
from . import FilterABC, ConfigurationError
from .util import check_args_compability
from .lm import CrossEntropyFilter, CrossEntropyDifferenceFilter, LMClassifierFilter # pylint: disable=W0611 # noqa: F401
from .word_alignment import WordAlignFilter # pylint: disable=W0611 # noqa: F401
from .embeddings import SentenceEmbeddingFilter # pylint: disable=W0611 # noqa: F401
logger = logging.getLogger(__name__)
def get_repetitions(self, segment):
"""Return the number of repetitions and the repeated string
Returns the number of repetitions and the repeated string for
the first match of at least self.threshold number of
repetitions. The segment may contain longer repetitions than
the one returned. If there no matched repetitions, zero and
None are returned.
"""
match = self._regexp.search(segment)
if match:
full = match.group(0)
repeated = match.group(1)
return full.count(repeated) - 1, repeated
return 0, None
def score(self, pairs):
for pair in pairs:
yield [self.get_repetitions(sent)[0] for sent in pair]
| 36.640429 | 122 | 0.621424 |
55180aff035712fdcf712454876146f0f9f3d598 | 180 | py | Python | Python_2/FOR e IN/programa -- Soma dos Pares.py | NicolasGandolfi/Exercicios-Python | 935fe3577c149192f9e29568e9798e970a620131 | [
"MIT"
] | null | null | null | Python_2/FOR e IN/programa -- Soma dos Pares.py | NicolasGandolfi/Exercicios-Python | 935fe3577c149192f9e29568e9798e970a620131 | [
"MIT"
] | null | null | null | Python_2/FOR e IN/programa -- Soma dos Pares.py | NicolasGandolfi/Exercicios-Python | 935fe3577c149192f9e29568e9798e970a620131 | [
"MIT"
] | null | null | null | s=0
c=0
for n in range(6):
num=int(input('digite o {} nmero:'.format(n+1)))
if num%2==0:
s+=num
c+=1
print('a soma dos {} nmeros pares {}'.format(c,s)) | 22.5 | 54 | 0.533333 |
551845565ec5d90acf0eee28224a4ae202f9477d | 3,736 | py | Python | backend/FlaskAPI/mf_get_table_data.py | steruel/CovalentMFFPrototype | 275ade0fa0a2ce3c80ed3aaac3a861dd0e273622 | [
"MIT"
] | null | null | null | backend/FlaskAPI/mf_get_table_data.py | steruel/CovalentMFFPrototype | 275ade0fa0a2ce3c80ed3aaac3a861dd0e273622 | [
"MIT"
] | null | null | null | backend/FlaskAPI/mf_get_table_data.py | steruel/CovalentMFFPrototype | 275ade0fa0a2ce3c80ed3aaac3a861dd0e273622 | [
"MIT"
] | null | null | null |
# coding: utf-8
# In[1]:
##Includes
from flask import request, url_for
from flask_api import FlaskAPI, status, exceptions
from flask_cors import CORS, cross_origin
from flask import Blueprint, render_template, abort
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import pickle
import json
import sqlite3
mf_get_table_data = Blueprint('mf_get_table_data', __name__)
CORS(mf_get_table_data)
CORS(mf_get_table_data,resources={r"/mf_get_table_data/*/": {"origins": "*"}})
#cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
######flask_api
##########
##Pass header=0 if first line in text file contains header
#http://localhost:5000/mf_get_table_data/gettabledatafromsqlite/?dbname=mf&tablename=dataset&limit=20
#http://localhost:5000/mf_get_table_data/gettabledatafromsqlite/?dbname=mf&tablename=dataset&limit=
#http://localhost:5000/mf_get_table_data/join_modelmetadata_dataset/
##?folder=bank_direct_marketing&file=bank-additional-full.csv
#http://localhost:5000/mf_get_table_data/gettabledatafromcsv?folder=bank_direct_marketing&file=bank-additional-full.csv
##?file=bank-additional-full.csv
#http://localhost:5000/mf_get_table_data/gettabledatafromcsv1?file=bank-additional-full.csv
#process()
#
| 27.072464 | 159 | 0.738758 |
55192286c083738515eab7ff51801fcee926be51 | 2,119 | py | Python | dkr-py310/docker-student-portal-310/course_files/begin_advanced/py_numpy_1.py | pbarton666/virtual_classroom | a9d0dc2eb16ebc4d2fd451c3a3e6f96e37c87675 | [
"MIT"
] | null | null | null | dkr-py310/docker-student-portal-310/course_files/begin_advanced/py_numpy_1.py | pbarton666/virtual_classroom | a9d0dc2eb16ebc4d2fd451c3a3e6f96e37c87675 | [
"MIT"
] | null | null | null | dkr-py310/docker-student-portal-310/course_files/begin_advanced/py_numpy_1.py | pbarton666/virtual_classroom | a9d0dc2eb16ebc4d2fd451c3a3e6f96e37c87675 | [
"MIT"
] | null | null | null | #py_numpy_1.py
"""a snake-charming application"""
from PIL import Image
import numpy as np
import os
idir =os.getcwd()
iname= 'im3.png'# 'white_snake.PNG'
saveas='new_snake.PNG'
#sets up an array for pixel processing
white=np.array([255,255,255,0]) #r, g, b, a
transparent = np.array([0, 0, 0, 0])
background = white
#open the image and convert it
raw_image = Image.open(iname)
converted_image = raw_image.convert('RGBA')
raw_image.close()
h, w = converted_image.size
converted_histo=converted_image.histogram()
converted_colors=converted_image.getcolors(w*h)
#dump the data into a numpy array and split the channels "bands"
data = np.array(converted_image) # h * w * 4 array (rgba)
r, g, b, a = data.T
#this sets the masking condition and replaces the background color
replace = (r == background[0]) & (b == background[1]) & (g == background[2])
data[replace.T] = (0,0,0,0)
#generate a new image, grab some stats, and save it.
new_image = Image.fromarray(data, 'RGBA')
h, w = new_image.size
new_histo=new_image.histogram()
new_colors=new_image.getcolors(w*h) #a list of tuples [count (rgba), ...]
new_image.save(saveas)
recovered_image = Image.open(saveas)
h, w = recovered_image.size
recovered_histo=recovered_image.histogram()
recovered_colors=recovered_image.getcolors(w*h) #a list of tuples [count (rgba), ...]
#strategy: make a list of color bins we expect to find. These will have pixel ranges
# that are human-friendly e.g., 'brownish', 'gold'. Each spec within the bin can be
# additively applied to a mask - functionally reducing the color palette.
reduced_image = recovered_image.convert('P', palette=Image.ADAPTIVE, colors=10)
reduc1 = reduced_image = recovered_image.convert('P', palette=Image.ADAPTIVE, colors=10)
reduc2 = reduc1.convert('RGB') #turns it to rgb
#save the image in a couple formats
reduc_fn = 'scratch.BMP'
reduc2.save(reduc_fn)
reduced_histo=reduced_image.histogram()
reduced_colors=reduced_image.getcolors(w*h) #a list of tuples [count (rgba), ...]
reduced_image.save(saveas+'reduced.BMP')
#now show them
recovered_image.show()
reduced_image.show()
recovered_image.close() | 32.6 | 88 | 0.747994 |
5519d50b257da54e3b0054563d77f75181fccdb3 | 2,958 | py | Python | zfg2parser.py | valoeghese/ZoesteriaConf | 10c3239acde2b4568bb48d1d71b3798ecff0afc3 | [
"MIT"
] | 1 | 2020-09-02T19:24:22.000Z | 2020-09-02T19:24:22.000Z | zfg2parser.py | valoeghese/ZoesteriaConf | 10c3239acde2b4568bb48d1d71b3798ecff0afc3 | [
"MIT"
] | 7 | 2020-08-08T01:57:29.000Z | 2021-05-08T08:50:19.000Z | zfg2parser.py | valoeghese/ZoesteriaConf | 10c3239acde2b4568bb48d1d71b3798ecff0afc3 | [
"MIT"
] | 1 | 2021-04-29T14:25:21.000Z | 2021-04-29T14:25:21.000Z |
index = -1
# compound "container" entries
# list entries
# data value entries
# comments
fileData = ""
with open(input(), 'r') as file:
fileData = file.read()
fileSize = len(fileData)
if (fileSize == 0):
print("File is empty!")
else:
fileContent = parseContainer(Container(), fileData, fileSize)
| 29.58 | 85 | 0.499324 |
551b09ca0d43e7df528a517a764809a6c7946e75 | 3,017 | py | Python | syndicate/connection/secrets_manager_connection.py | Dmytro-Skorniakov/aws-syndicate | 81363334886c53969f1f0a0c0ac0168318204990 | [
"Apache-2.0"
] | null | null | null | syndicate/connection/secrets_manager_connection.py | Dmytro-Skorniakov/aws-syndicate | 81363334886c53969f1f0a0c0ac0168318204990 | [
"Apache-2.0"
] | null | null | null | syndicate/connection/secrets_manager_connection.py | Dmytro-Skorniakov/aws-syndicate | 81363334886c53969f1f0a0c0ac0168318204990 | [
"Apache-2.0"
] | null | null | null | """
Copyright 2018 EPAM Systems, 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 to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from boto3 import client
from syndicate.commons.log_helper import get_logger
from syndicate.connection.helper import apply_methods_decorator, retry
_LOG = get_logger('syndicate.connection.secrets_manager_connection')
| 39.181818 | 101 | 0.670202 |
551b46a9abb3f55dfb647a884266cebfd6c4db08 | 3,324 | py | Python | Simple GAN/networks.py | Srujan35007/My-GANs | 7953c859169134a0a84ac3cd674f629af9942465 | [
"MIT"
] | null | null | null | Simple GAN/networks.py | Srujan35007/My-GANs | 7953c859169134a0a84ac3cd674f629af9942465 | [
"MIT"
] | null | null | null | Simple GAN/networks.py | Srujan35007/My-GANs | 7953c859169134a0a84ac3cd674f629af9942465 | [
"MIT"
] | null | null | null | import time
b = time.time()
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchsummary import summary
from math import log2, exp
a = time.time()
print('Imports complete in %.3f seconds' % (a-b))
print('\nGenerator Summary\n')
gen = Generator(max_resolution=512,max_channels=512,min_channels=8)
a = torch.empty(128).normal_(0,0.35).view(-1,128)
(summary(gen, (1,128)))
print('\nDiscriminator Summary\n')
disc = Discriminator(max_channels=512,max_resolution=512)
a = torch.empty(10,3,512,512).normal_(0,0.35)
(summary(disc, (1,3,512,512))) | 39.571429 | 105 | 0.663357 |
551c341bfebf085d7288ee08b3180f837e7122dd | 2,607 | py | Python | ui/Rhino/RV2/dev/__temp/RV2init_console_cmd.py | tkmmark/compas-RV2 | bc18f4dada9c1e31a0f7df4ef981934c6d2b05b3 | [
"MIT"
] | null | null | null | ui/Rhino/RV2/dev/__temp/RV2init_console_cmd.py | tkmmark/compas-RV2 | bc18f4dada9c1e31a0f7df4ef981934c6d2b05b3 | [
"MIT"
] | null | null | null | ui/Rhino/RV2/dev/__temp/RV2init_console_cmd.py | tkmmark/compas-RV2 | bc18f4dada9c1e31a0f7df4ef981934c6d2b05b3 | [
"MIT"
] | null | null | null | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import scriptcontext as sc
try:
import compas # noqa: F401
import compas_rhino # noqa: F401
import compas_ags # noqa: F401
import compas_tna # noqa: F401
import compas_cloud # noqa: F401
except ImportError:
# do something here to fix the problem
raise
else:
from compas_cloud import Proxy
from compas_rv2.rhino import BrowserForm
from compas_rv2.scene import Scene
__commandname__ = "RV2init"
# ==============================================================================
# Main
# ==============================================================================
if __name__ == '__main__':
RunCommand(True)
| 24.59434 | 80 | 0.542769 |
551c6b36cc572d6424d1e8e35b4d86a47b2d8f93 | 3,783 | py | Python | utils/count_supported.py | delcypher/smt-coral-wrapper | e7024efd83ba2da87fb178917f49a6b430b9c01c | [
"MIT"
] | 1 | 2018-05-04T03:51:58.000Z | 2018-05-04T03:51:58.000Z | utils/count_supported.py | delcypher/smt2coral | e7024efd83ba2da87fb178917f49a6b430b9c01c | [
"MIT"
] | null | null | null | utils/count_supported.py | delcypher/smt2coral | e7024efd83ba2da87fb178917f49a6b430b9c01c | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# vim: set sw=4 ts=4 softtabstop=4 expandtab:
"""
Read invocation info file for smt-runner
and report which benchmarks are supported
by the CoralPrinter.
"""
# HACK: put smt2coral in search path
import os
import sys
_repo_root = os.path.dirname(os.path.dirname(__file__))
sys.path.insert(0, _repo_root)
from smt2coral import Converter
from smt2coral import DriverUtil
from smt2coral import Util
import argparse
import logging
import yaml
_logger = logging.getLogger(__name__)
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
| 32.612069 | 78 | 0.662437 |
551f2a4107231a13573c3c3b43e182531e15c00c | 18,810 | py | Python | atoman/filtering/filterer.py | chrisdjscott/Atoman | e87ac31bbdcf53bb8f3efdfb109787d604890394 | [
"MIT"
] | 9 | 2015-11-23T12:13:34.000Z | 2021-11-18T05:23:35.000Z | atoman/filtering/filterer.py | chrisdjscott/Atoman | e87ac31bbdcf53bb8f3efdfb109787d604890394 | [
"MIT"
] | 1 | 2017-07-17T20:27:50.000Z | 2017-07-23T05:27:15.000Z | atoman/filtering/filterer.py | chrisdjscott/Atoman | e87ac31bbdcf53bb8f3efdfb109787d604890394 | [
"MIT"
] | 4 | 2015-11-23T12:13:37.000Z | 2017-05-03T08:24:19.000Z |
"""
The filterer object.
@author: Chris Scott
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import copy
import time
import logging
import numpy as np
import six
from six.moves import zip
from .filters import _filtering as filtering_c
from ..system.atoms import elements
from . import voronoi
from .filters import base
from . import filters
from . import atomStructure
from ..rendering import _rendering
| 42.080537 | 119 | 0.563477 |
551fb4d66e7bdb8b9da3ce7860f15d493f500f54 | 475 | py | Python | Entree_in/rou.py | dipkhandait/Entree_in | 5cc03555b1e8022262dffa0a0a459637fa9f49c7 | [
"MIT"
] | null | null | null | Entree_in/rou.py | dipkhandait/Entree_in | 5cc03555b1e8022262dffa0a0a459637fa9f49c7 | [
"MIT"
] | null | null | null | Entree_in/rou.py | dipkhandait/Entree_in | 5cc03555b1e8022262dffa0a0a459637fa9f49c7 | [
"MIT"
] | null | null | null | import sqlite3
connection = sqlite3.connect("Project.db")
cursor = connection.cursor()
S_user = cursor.execute(f"SELECT * FROM Current_login WHERE No = '{1}'")
record = S_user.fetchone()
user = record[0]
print(user)
try:
Spl_user = cursor.execute(f"SELECT * FROM Col_Pref_list where Username = '{user}'")
recordpl = Spl_user.fetchone()
userpl = recordpl[0]
print(userpl)
print("SUCCESSFULL")
except Exception as e:
print("Unsuccessful")
print(e) | 26.388889 | 87 | 0.696842 |
5520df1b613fa85e6ad8dd2ba56eeb9d62e2e7df | 2,766 | py | Python | tests/cases/yield_test.py | MiguelMarcelino/py2many | 9b040b2a157e265df9c053eaf3e5cd644d3e30d0 | [
"MIT"
] | 2 | 2022-02-02T11:37:53.000Z | 2022-03-30T18:19:06.000Z | tests/cases/yield_test.py | MiguelMarcelino/py2many | 9b040b2a157e265df9c053eaf3e5cd644d3e30d0 | [
"MIT"
] | 25 | 2022-02-28T21:19:11.000Z | 2022-03-23T21:26:20.000Z | tests/cases/yield_test.py | MiguelMarcelino/py2many | 9b040b2a157e265df9c053eaf3e5cd644d3e30d0 | [
"MIT"
] | null | null | null |
class TestClass:
if __name__ == "__main__":
# Calling functions normally (Supported)
arr1 = []
for i in generator_func():
arr1.append(i)
assert arr1 == [1, 5, 10]
# -----------------------
arr2 = []
for i in generator_func_loop():
arr2.append(i)
assert arr2 == [0, 1, 2]
# -----------------------
arr3 = []
for i in generator_func_loop_using_var():
arr3.append(i)
assert arr3 == [0, 1, 2]
# -----------------------
# Testing with class scope
arr4 = []
testClass1: TestClass = TestClass()
for i in testClass1.generator_func():
arr4.append(i)
assert arr4 == [123, 5, 10]
# -----------------------
# Testing nested loop
arr5 = []
for i in generator_func_nested_loop():
arr5.append(i)
assert arr5 == [(0,0), (0,1), (1,0), (1,1)]
# -----------------------
arr6 = []
# Create file before executing
for res in file_reader("C:/Users/Miguel Marcelino/Desktop/test.txt"):
arr6.append(res)
assert arr6 == ['test\n', 'test\n', 'test']
# -----------------------
arr7 = []
res = fib()
for i in range(0,6):
arr7.append(res.__next__())
assert arr7 == [0,1,1,2,3,5]
# -----------------------
for i in testgen():
print(i)
# -----------------------------------
# Calling functions using loop (unsupported in PyJL)
# testClass2: TestClass = TestClass()
# funcs = [generator_func, generator_func_loop, generator_func_loop_using_var, testClass2.generator_func,
# generator_func_nested_loop]
# arrL = []
# for func in funcs:
# for i in func():
# arrL.append(i)
# assert arrL == [1, 5, 10, 0, 1, 2, 0, 1, 2, 123, 5, 10, (0,0), (0,1), (1,0), (1,1)] | 22.487805 | 109 | 0.5141 |
5521cf44b0712c36f70ad0bbd932c50c521247f6 | 1,252 | py | Python | apps/api/quipper/main.py | phillamb168/system-design | d074409211521c930a2b355cac102caef827d627 | [
"Apache-2.0"
] | 3 | 2021-11-12T11:00:35.000Z | 2022-02-16T10:33:53.000Z | apps/api/quipper/main.py | phillamb168/system-design | d074409211521c930a2b355cac102caef827d627 | [
"Apache-2.0"
] | null | null | null | apps/api/quipper/main.py | phillamb168/system-design | d074409211521c930a2b355cac102caef827d627 | [
"Apache-2.0"
] | 8 | 2021-08-04T18:47:18.000Z | 2022-03-15T10:14:32.000Z | from fastapi import (
Depends,
FastAPI,
)
from fastapi.middleware.cors import CORSMiddleware
from sqlalchemy.orm import Session
from quipper import (
models,
schemas,
services,
)
from quipper.database import (
SessionLocal,
engine,
)
# Create the tables
models.Base.metadata.create_all(bind=engine)
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-with-yield
| 21.220339 | 76 | 0.664537 |
5522df8e11c9c1d695b6fd19a76f81ba0655ccc5 | 3,611 | py | Python | data_structures/adjacency_list_graph.py | avg-2049-joe/py-algo-ds | 4f9c3c086e134ee23fcc0ee3b981e81f40e860cd | [
"MIT"
] | null | null | null | data_structures/adjacency_list_graph.py | avg-2049-joe/py-algo-ds | 4f9c3c086e134ee23fcc0ee3b981e81f40e860cd | [
"MIT"
] | null | null | null | data_structures/adjacency_list_graph.py | avg-2049-joe/py-algo-ds | 4f9c3c086e134ee23fcc0ee3b981e81f40e860cd | [
"MIT"
] | null | null | null | """Adjacency list is a graph representation using array or a hash map"""
from collections import deque
def create_graph():
"""Create and insert vertices and paths"""
graph = AdjacencyListGraph()
graph.insert_vertex(0)
graph.insert_vertex(1)
graph.insert_vertex(2)
graph.insert_vertex(3)
graph.insert_edge(0, 1)
graph.insert_edge(1, 2)
graph.insert_edge(1, 3)
graph.insert_edge(2, 3)
return graph
def test_adjacency_list_graph():
"""Simple test for the graph implementation"""
graph = create_graph()
print(graph)
def test_dfs():
"""Depth first search a path"""
graph = create_graph()
print(graph.depth_first_search_path(0, 3))
def test_bfs():
"""Breadth first search a path"""
graph = create_graph()
print(graph.breadth_first_search(0, 3))
if __name__ == '__main__':
test_adjacency_list_graph()
test_dfs()
test_bfs()
| 27.356061 | 79 | 0.623927 |
5523fbe79d2ce42233aa94670f1b7a5b2c7819fa | 4,515 | py | Python | monroe-netalyzr/files/runme2.py | ana-cc/dockerstuffs | 98131138731dd3c7a18e4e1a3b6975e3778502f9 | [
"BSD-2-Clause"
] | 1 | 2020-09-10T19:15:09.000Z | 2020-09-10T19:15:09.000Z | monroe-netalyzr/files/runme2.py | ana-cc/dockerstuffs | 98131138731dd3c7a18e4e1a3b6975e3778502f9 | [
"BSD-2-Clause"
] | null | null | null | monroe-netalyzr/files/runme2.py | ana-cc/dockerstuffs | 98131138731dd3c7a18e4e1a3b6975e3778502f9 | [
"BSD-2-Clause"
] | null | null | null | #!/usr/bin/python
import json
import subprocess
import logging
from pyroute2 import IPDB
import sys
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("runme")
if __name__ == "__main__":
sys.exit(main())
| 32.021277 | 127 | 0.50897 |
9b28efc68a829abe66b1f36c000e5c38c0f766de | 9,725 | py | Python | teptools/summarise.py | nelsyeung/teptools | 90a8cde2793e509b30c6fca0c3f64320855cf7c6 | [
"MIT"
] | null | null | null | teptools/summarise.py | nelsyeung/teptools | 90a8cde2793e509b30c6fca0c3f64320855cf7c6 | [
"MIT"
] | null | null | null | teptools/summarise.py | nelsyeung/teptools | 90a8cde2793e509b30c6fca0c3f64320855cf7c6 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys
import os
import argparse
import subprocess
import textwrap
import helpers
def parser(default_args, args):
"""Return parsed command line arguments."""
parser = argparse.ArgumentParser(
description=(
'Extracts the results of the NGWF CG optimisation steps from an\n'
'output file (which may still be running) and output them in a\n'
'format as if you were running with output_detail=BRIEF or\n'
'looking at the calculation summary.'),
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument(
'outfiles', metavar='outfile', type=str, nargs='*',
help='ONETEP output files to be summarised\n'
'If none is specified then all out files (*.out)\n'
'in the current directory will be read')
parser.add_argument(
'-vd', '--vimdiff', action='store_true',
help='Open multiple outputs in vimdiff')
parser.add_argument(
'--no-vimdiff', action='store_false', dest='vimdiff',
help='Prevent opening multiple outputs in vimdiff')
parser.add_argument(
'-o', '--output', action='store_true',
help='Write each output into its own file')
parser.add_argument(
'--no-output', action='store_false', dest='output',
help='Prevent writing each output into its own file')
if args is None: # pragma: no cover
if default_args == ['']:
default_args = []
args = default_args
args.extend(sys.argv[1:])
return parser.parse_args(args)
def print_side_view(summaries, col_width):
"""Print two summaries side-by-side."""
wrapper = textwrap.TextWrapper(width=col_width)
indices = [0, 0]
locks = [False, False]
unlocks = [False, False]
sync_lines = ['| i|']
completed = False
while indices[0] < len(summaries[0]) or indices[1] < len(summaries[1]):
outputs = ['--', '--'] # Dashes for empty lines to avoid confusions
if completed:
unlocks = [True, True]
for j in range(2):
if (unlocks[j] or not locks[j]) and indices[j] < len(summaries[j]):
if (not unlocks[j] and
any(line in summaries[j][indices[j]]
for line in sync_lines)):
locks[j] = True
else:
wrapped = wrapper.wrap(summaries[j][indices[j]])
outputs[j] = wrapped[0]
locks[j] = False
unlocks[j] = False
indices[j] += 1
if len(wrapped) > 1:
summaries[j].insert(indices[j], wrapped[1])
if indices[j] == len(summaries[j]):
completed = True
if locks[0] and locks[1]:
unlocks = [True, True]
if not locks[0] or not locks[1]:
print(('{:<' + str(col_width) + '}' +
'{:' + str(col_width) + '}').format(
outputs[0], outputs[1]))
if __name__ == '__main__': # pragma: no cover
main()
| 34.003497 | 79 | 0.55671 |
9b292f152e109d6afd9ce99c12e29518dfc1f37f | 3,202 | py | Python | catfeeder_stepper.py | novalis111/catfeeder | 4597bb24b4d159b9a79ef18e808ccab15391c659 | [
"MIT"
] | null | null | null | catfeeder_stepper.py | novalis111/catfeeder | 4597bb24b4d159b9a79ef18e808ccab15391c659 | [
"MIT"
] | null | null | null | catfeeder_stepper.py | novalis111/catfeeder | 4597bb24b4d159b9a79ef18e808ccab15391c659 | [
"MIT"
] | null | null | null | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Import required libraries
import time
import random
import datetime
import RPi.GPIO as GPIO
# Use BCM GPIO references instead of physical pin numbers
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# 1 step = 1/4 of full
'''
limit = 5
cur_rot = 'r'
while limit > 0:
steps = random.randint(0, 4)
pace = random.randint(0, 5)
if cur_rot == 'r':
cur_rot = 'l'
else:
cur_rot = 'r'
rotate(steps, cur_rot, pace)
limit -= 1
'''
lastpress = 0
lastfeed = 0
while True:
input_state = GPIO.input(18)
if not input_state:
# Button pressed
press_ago = time.time() - lastpress
lastfeed_ago = time.time() - lastfeed
if press_ago > 10800 or lastfeed_ago > 10800:
# Full load -> 5 full rounds = 5*4 steps
print("Full feed")
rotate(20)
lastpress = time.time()
lastfeed = time.time()
elif press_ago > 300:
# 5 minutes ago, only one round
print("Medium feed")
rotate(4)
lastpress = time.time()
elif press_ago > 60:
# 1 minute ago, only tiny move
print("Tiny feed")
rotate(1)
lastpress = time.time()
else:
print("No Feed yet")
print("Last Feed was " + str(round(lastfeed_ago / 60, 1)) + " minutes ago")
print("Next full Feed is in " + str(round((10800 - lastfeed_ago) / 60, 1)) + " minutes")
time.sleep(5)
GPIO.cleanup()
| 25.212598 | 100 | 0.538101 |
9b2ae5c5d7a422f9f2eda94d4feb8800f0416e6f | 604 | py | Python | SpoTwillio/search.py | Natfan/funlittlethings | 80d5378b45b5c0ead725942ee50403bd057514a6 | [
"MIT"
] | 1 | 2017-12-03T15:08:42.000Z | 2017-12-03T15:08:42.000Z | SpoTwillio/search.py | Natfan/funlittlethings | 80d5378b45b5c0ead725942ee50403bd057514a6 | [
"MIT"
] | 2 | 2017-09-25T12:43:41.000Z | 2021-05-07T14:29:27.000Z | SpoTwillio/search.py | Natfan/funlittlethings | 80d5378b45b5c0ead725942ee50403bd057514a6 | [
"MIT"
] | 1 | 2017-09-04T19:37:42.000Z | 2017-09-04T19:37:42.000Z | import spotipy
import argparse
sp = spotipy.Spotify()
parser = argparse.ArgumentParser()
parser.add_argument("term", help="The artist that you want to search for")
parser.add_argument("-c", "--count", help="The amount of results that you want, capped at 20", type=int)
args = parser.parse_args()
if args.count:
if args.count > 20:
print("enter a count lower than or equal to 20")
else:
spoprint()
else:
spoprint()
| 27.454545 | 104 | 0.662252 |
9b2b7e3184a648dffa11f8e71194a20d3c591394 | 13,484 | py | Python | denverapi/bdtp.py | xcodz-dot/denver | 4142594756ceb7edb23d77cf7549f8d770185def | [
"MIT"
] | 4 | 2020-09-26T08:48:53.000Z | 2020-12-02T21:50:28.000Z | denverapi/bdtp.py | xcodz-dot/denver | 4142594756ceb7edb23d77cf7549f8d770185def | [
"MIT"
] | 22 | 2020-09-26T08:12:13.000Z | 2020-12-03T04:01:13.000Z | denverapi/bdtp.py | xcodz-dot/denver-api | 4142594756ceb7edb23d77cf7549f8d770185def | [
"MIT"
] | 3 | 2020-09-26T17:25:14.000Z | 2020-12-02T21:47:18.000Z | """
##Big Data Transfer Protocol
###What does it do
This protocol sends big data on a address (IPv4,port)
without worrying about pipe errors.
"""
__author__ = "Xcodz"
__version__ = "2021.2.24"
import abc
import socket
import time
import typing
from . import thread_control
default_buffer_size = 100000
def new_send_data_host(data: bytes, addr: tuple = None, buffer_size=None):
"""
Make a new `DataSenderHost` with provided arguments. It's better to not supply `addr` if you
are going to use the object on existing connection. It is also not recommended to change
`buffer_size` because this argument is supposed to be same at both the sender and receiver.
You can then use the `send` method of the returned object to send the provided data.
Example:
```python
from denverapi import bdtp
import socket
# Without existing connection
my_sender = bdtp.new_send_data_host(b"Some Data", ("127.0.0.1", 7575))
my_sender.send()
# With existing connection
my_server = socket.socket()
my_server.bind(("127.0.0.1", 1234))
my_server.listen(5)
my_connection, address = my_server.accept()
my_sender = bdtp.new_send_data_host(b"Some Data")
my_sender.send(my_connection)
# With changed buffer size
my_sender = bdtp.new_send_data_host(b"Some Data", ("127.0.0.1", 12345), 3)
my_sender.send()
```
"""
sender_object = DataSenderHost()
sender_object.data = data
sender_object.address = addr
if buffer_size is not None:
sender_object.buffer_size = buffer_size
return sender_object
def new_send_data_port(data: bytes, addr: tuple = None, buffer_size=None):
"""
Make a new `DataSenderPort` with provided arguments. It's better to not supply `addr` if you
are going to use the object on existing connection. It is also not recommended to change
`buffer_size` because this argument is supposed to be same at both the sender and receiver.
You can then use the `send` method of the returned object to send the provided data.
Example:
```python
from denverapi import bdtp
import socket
# Without existing connection
my_sender = bdtp.new_send_data_port(b"Some Data", ("127.0.0.1", 7575))
my_sender.send()
# With existing connection
my_connection = socket.socket()
my_connection.connect(("127.0.0.1", 1234))
my_sender = bdtp.new_send_data_port(b"Some Data")
my_sender.send(my_connection)
# With changed buffer size
my_sender = bdtp.new_send_data_host(b"Some Data", ("127.0.0.1", 12345), 3)
my_sender.send()
```
"""
sender_object = DataSenderPort()
sender_object.data = data
sender_object.address = addr
if buffer_size is not None:
sender_object.buffer_size = buffer_size
return sender_object
def new_receive_data_host(addr: tuple = None, buffer_size=None):
"""
Make a new `DataReceiverHost` object to receive data sent by sender. It is not recommended to
supply `addr` if you are going to use it with existing connection. It is highly discouraged to use
`buffer_size` argument as it is supposed to be kept same at both sender and receiver.
You can use the returned object's `recv` method to start receiving data. Once receiving is complete.
data will be stored in object's `data` attribute as bytes.
```python
from denverapi import bdtp
import socket
# Without existing connection
my_receiver = bdtp.new_receive_data_host(("127.0.0.1", 7575))
my_receiver.recv()
# With existing connection
my_connection = socket.socket()
my_connection.connect(("127.0.0.1", 1234))
my_receiver = bdtp.new_receive_data_host()
my_receiver.recv(my_connection)
# With changed buffer size
my_receiver = bdtp.new_receive_data_host(("127.0.0.1", 12345), 3)
my_receiver.recv()
```
"""
sender_object = DataReceiverHost()
sender_object.address = addr
if buffer_size is not None:
sender_object.buffer_size = buffer_size
return sender_object
def new_receive_data_port(addr: tuple, buffer_size=None):
"""
Make a new `DataReceiverHost` object to receive data sent by sender. It is not recommended to
supply `addr` if you are going to use it with existing connection. It is highly discouraged to use
`buffer_size` argument as it is supposed to be kept same at both sender and receiver.
You can use the returned object's `recv` method to start receiving data. Once receiving is complete.
data will be stored in object's `data` attribute as bytes.
```python
from denverapi import bdtp
import socket
# Without existing connection
my_receiver = bdtp.new_receive_data_port(("127.0.0.1", 7575))
my_receiver.recv()
# With existing connection
my_connection = socket.socket()
my_connection.connect(("127.0.0.1", 1234))
my_receiver = bdtp.new_receive_data_port()
my_receiver.recv(my_connection)
# With changed buffer size
my_receiver = bdtp.new_receive_data_port(("127.0.0.1", 12345), 3)
my_receiver.recv()
```
"""
sender_object = DataReceiverPort()
sender_object.address = addr
if buffer_size is not None:
sender_object.buffer_size = buffer_size
return sender_object
def attach_speed_logger(data_object) -> typing.List[int]:
"""
Attaches a speed logger that captures the speed of transfer for either receiver object
or sender object. Returns a list that gets updated as the speed transfer continues.
To get the average speed use `average_speed_log`.
Example:
```python
from denverapi import bdtp
sender = bdtp.new_receive_data_port(b"Hello World"*10000, ("localhost", 8000))
speed_log = bdtp.attach_speed_logger(sender)
sender.send()
speed = bdtp.average_speed_log(speed_log)
```
"""
spl = []
(spr if isinstance(data_object, _BaseReceiver) else sps)(spl, data_object)
return spl
def launch(data_object, connected_socket=None):
"""
Just a simple function that starts a sender or receiver object. It is here because it looks good when using this.
"""
if isinstance(data_object, _BaseSender):
data_object.send(connected_socket)
else:
data_object.recv(connected_socket)
def average_speed_log(spl: list) -> int:
"""
Finds average speed of the connection.
It strips out 0 from the end and starting of `spl` and then finds the average and returns it
"""
while spl[0] == 0:
spl.pop(0)
while spl[-1] == 0:
spl.pop()
return (sum(spl) / len(spl)) * 100
def main():
"""
Nothing more than a test
"""
print("Reading Data")
datats = open(input("File > "), "r+b").read()
print("Read Data")
print("Making Classes")
sc = new_send_data_port(datats, ("127.0.0.1", 4623))
rc = new_receive_data_host(("127.0.0.1", 4623))
spl = attach_speed_logger(rc)
from threading import Thread
Thread(target=launch, args=(sc,)).start()
rc.recv()
print(len(spl))
print(
f"Data Send:\n\tlen: {len(sc.data)}\nData Received:\n\tlen: {len(rc.data)}\n\tis_equal: {rc.data == sc.data}"
)
print(f"Average Speed: {average_speed_log(spl)} bytes per second")
if __name__ == "__main__":
main()
| 30.575964 | 117 | 0.637867 |
9b2b9f0e1320f2cd7097a2cc090fb00dcd38d4c6 | 1,431 | py | Python | wstest/handler/current_effect_status_handler_test.py | PedalController/PedalPiREST | aa9418d44f2f5dbec604753a03bf8a74057c627c | [
"Apache-2.0"
] | null | null | null | wstest/handler/current_effect_status_handler_test.py | PedalController/PedalPiREST | aa9418d44f2f5dbec604753a03bf8a74057c627c | [
"Apache-2.0"
] | 42 | 2016-07-04T11:17:54.000Z | 2018-03-18T18:36:09.000Z | wstest/handler/current_effect_status_handler_test.py | PedalController/PedalPiREST | aa9418d44f2f5dbec604753a03bf8a74057c627c | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 SrMouraSilva
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from wstest.handler.handler_test import Test
| 35.775 | 119 | 0.735849 |
9b2edfe2e18a8a45ebbb7dd7d27ff5218861d483 | 1,203 | py | Python | src/sample-scripts/solved_problems/Examples test_compare/make_prop.py | hpgl/hpgl | 72d8c4113c242295de740513093f5779c94ba84a | [
"BSD-3-Clause"
] | 70 | 2015-01-21T12:24:50.000Z | 2022-03-16T02:10:45.000Z | src/sample-scripts/solved_problems/Examples test_compare/make_prop.py | hpgl/hpgl | 72d8c4113c242295de740513093f5779c94ba84a | [
"BSD-3-Clause"
] | 8 | 2015-04-22T13:14:30.000Z | 2021-11-23T12:16:32.000Z | src/sample-scripts/solved_problems/Examples test_compare/make_prop.py | hpgl/hpgl | 72d8c4113c242295de740513093f5779c94ba84a | [
"BSD-3-Clause"
] | 18 | 2015-02-15T18:04:31.000Z | 2021-01-16T08:54:32.000Z | from geo import *
from geo.routines import *
from matplotlib import *
from sys import *
from pylab import *
import os
import time
import pylab
size = (166, 141, 20)
print "loading image..."
data_3D = load_ind_property("BIG_SOFT_DATA_160_141_20.INC", -99, [0,1], size)
data = data_3D[0][:,:,0]
mask = data_3D[1][:,:,0]
figure()
pylab.imshow(data[:,:], vmin = 0, vmax = 2)
pylab.savefig("hard_data")
#initial_data = copy(data)
# test with 98% of harddata
#n = 0.995
# for i in xrange(size[0]):
# for j in xrange(size[1]):
# value = numpy.random.uniform()
# if (value < n):
# mask[i,j] = 0
# data[i,j] = -99
# initial_data[i,j] = -99
# for i in xrange(size[0]):
# for j in xrange(size[1]):
# if (mask[i,j] <> 0):
# if (initial_data[i,j] <> -99):
# initial_data[i,j] = float32(numpy.random.normal(4.0, 1.0))
# for i in xrange(size[0]):
# for j in xrange(size[1]):
# if (initial_data[i,j] <> -99):
# initial_data[i,j] = abs(initial_data[i,j,0]) / initial_data.max()
prop = (data, mask, 2)
write_property(prop, "IND_data.INC", "Ind_data", -99)
# write_property((initial_data, mask), "CONT_data.INC", "Cont_data", -99)
| 24.06 | 78 | 0.60266 |
9b34dab60e953e0b05289a4632892770d19cd60e | 533 | py | Python | ex039/exercicio039.py | ArthurAlesi/Python-Exercicios-CursoEmVideo | ed0f0086ddbc0092df9d16ec2d8fdbabcb480cdd | [
"MIT"
] | null | null | null | ex039/exercicio039.py | ArthurAlesi/Python-Exercicios-CursoEmVideo | ed0f0086ddbc0092df9d16ec2d8fdbabcb480cdd | [
"MIT"
] | null | null | null | ex039/exercicio039.py | ArthurAlesi/Python-Exercicios-CursoEmVideo | ed0f0086ddbc0092df9d16ec2d8fdbabcb480cdd | [
"MIT"
] | null | null | null | # faa um programa q leia o ano de nascimento de um jovem e informe de
# acordo com sua idade se ele ainda vai se alistar ao servio miliar,
# se a hora de se alistar ou se ja passsou do tempo do alistamento
from datetime import date
hoje = date.today().year
print(hoje)
nascimento = int(input("Diga o ano que voce nasceu"))
idade = hoje - nascimento
if idade == 18:
print("Esta na hora de voce se alistar")
elif idade < 18:
print("Voce ainda vai ter q se alistar")
else:
print("Ja passou da hora de voce se alistar")
| 33.3125 | 70 | 0.72045 |
9b374ff2739d4dbdac37bc7c8c986c366e319b95 | 1,250 | py | Python | dmsl-runner/main.py | GloomyGhost-MosquitoSeal/DmslRunner | b541c27f9a9857012b465e153b5de827a8db4b29 | [
"Apache-2.0"
] | null | null | null | dmsl-runner/main.py | GloomyGhost-MosquitoSeal/DmslRunner | b541c27f9a9857012b465e153b5de827a8db4b29 | [
"Apache-2.0"
] | null | null | null | dmsl-runner/main.py | GloomyGhost-MosquitoSeal/DmslRunner | b541c27f9a9857012b465e153b5de827a8db4b29 | [
"Apache-2.0"
] | null | null | null | import os
import sys
import json
import time
import base64
import subprocess
DEBUG = 0
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Arg Error")
else:
instr = sys.argv[1]
sta1 = json_paser(instr)
sta2 = dmsl_runner(sta1)
print(sta2) | 22.321429 | 79 | 0.5576 |
9b37765b1ebe35daf9d92813e7199c416682ab3a | 1,313 | py | Python | modules/investigate/investigate.py | geekpy03/pgn-tactics-generator | a0509ec412b7163526aba3d29220b87d9cf7f688 | [
"MIT"
] | 68 | 2018-09-09T17:55:30.000Z | 2022-03-28T17:04:43.000Z | modules/investigate/investigate.py | geekpy03/pgn-tactics-generator | a0509ec412b7163526aba3d29220b87d9cf7f688 | [
"MIT"
] | 31 | 2018-09-07T19:32:27.000Z | 2022-01-25T13:25:29.000Z | modules/investigate/investigate.py | geekpy03/pgn-tactics-generator | a0509ec412b7163526aba3d29220b87d9cf7f688 | [
"MIT"
] | 20 | 2019-03-11T09:52:14.000Z | 2022-02-23T05:37:31.000Z | import chess
from chess import Board
from chess.engine import Score
def investigate(a: Score, b: Score, board: Board):
"""
determine if the difference between position A and B
is worth investigating for a puzzle.
"""
a_cp, a_mate = a.score(), a.mate()
b_cp, b_mate = b.score(), b.mate()
if a_cp is not None and b_cp is not None:
if (((-110 < a_cp < 850 and 200 < b_cp < 850)
or (-850 < a_cp < 110 and -200 > b_cp > -850))
and material_value(board) > 3
and material_count(board) > 6):
return True
elif a_cp is not None and b_mate is not None and material_value(board) > 3:
if (a_cp < 110 and sign(b_mate) == -1) or (a_cp > -110 and sign(b_mate) == 1):
# from an even position, walking int a checkmate
return True
elif a_mate is not None and b_mate is not None:
if sign(a_mate) == sign(b_mate): # actually means that they're opposite
return True
return False
| 32.02439 | 92 | 0.599391 |
9b37f557e5299f598ed6cf66a7877c41c10b6ac2 | 3,212 | py | Python | src/endtype_controller/__init__.py | CadworkMontreal/CwAPI3D | 5a2c15ad9f334d6dbfa55d59b6a855ac5667f289 | [
"MIT"
] | null | null | null | src/endtype_controller/__init__.py | CadworkMontreal/CwAPI3D | 5a2c15ad9f334d6dbfa55d59b6a855ac5667f289 | [
"MIT"
] | null | null | null | src/endtype_controller/__init__.py | CadworkMontreal/CwAPI3D | 5a2c15ad9f334d6dbfa55d59b6a855ac5667f289 | [
"MIT"
] | null | null | null | from typing import List
def create_new_endtype(endtype_name: str, endtype_id: int, folder_name: str) -> int:
"""Create a new endtype
Args:
endtype_name (str): name
endtype_id (int): endtype id
folder_name (str): folder name
Returns:
int: endtype id
"""
def get_endtype_id(name: str) -> int:
"""Gets the endtypeID by endtypename
Args:
name (str): endtype name
Returns:
int: endtype id
"""
def get_endtype_id_end(element_id: int) -> int:
"""Gets the endtypeID of the end face
Args:
arg0 (int): elmement ID
Returns:
int: endtype id
"""
def get_endtype_id_facet(element: int, face_number: int) -> int:
"""Gets the endtypeID of the face with a number
Args:
element (int): element ID
face_number (int): face number
Returns:
int: endtype id
"""
def get_endtype_id_start(element: int) -> int:
"""Gets the endtypeID of the start face
Args:
element (int): element ID
Returns:
int: endtype id
"""
def get_endtype_name(endtype_id: int) -> str:
"""Get endtype name
Args:
endtype_id (int): endtype ID
Returns:
str: endtype name
"""
def get_endtype_name_end(element: int) -> str:
"""Get endtype name end
Args:
endtype_id (int): endtype ID
Returns:
str: endtype name
"""
def get_endtype_name_facet(element: int, face_number: int) -> str:
"""Gets the endtypename of the face with a number
Args:
element (int): element ID
face_number (int): face number
Returns:
str: endtype name facet
"""
def get_endtype_name_start(element: int) -> str:
"""Gets the endtypename of the start face
Args:
element (int): element ID
Returns:
str: endtype name start
"""
def set_endtype_id_end(element: int, endtype_id: int) -> None:
"""Sets the endtype to end face by endtypeID
Args:
element (int): element ID
endtype_id (int): endtype ID
"""
def set_endtype_id_facet(element: int, endtype_id: int, face_number: int) -> None:
"""Sets the endtype to a face by endtypeID
Args:
element (int): element ID
endtype_id (int): endtype ID
face_number (int): face number
"""
def set_endtype_id_start(element: int, endtype_id: int) -> None:
"""Sets the endtype to start face by endtypeID
Args:
element (int): element ID
endtype_id (int): endtype ID
"""
def set_endtype_name_end(element: int, face_number: str) -> None:
"""Sets the endtype to end face by endtypename
Args:
element (int): element ID
face_number (str): face number
"""
def set_endtype_name_facet(element: int, name: str, face_number: int) -> None:
"""Sets the endtype to a face by endtypename
Args:
element (int): element ID
name (str): name
face_number (int): face number
"""
def set_endtype_name_start(element: int, face_number: str) -> None:
"""Sets the endtype to start face by endtypename
Args:
element (int): element ID
face_number (str): face number
""" | 23.970149 | 84 | 0.615816 |
9b38e1564807028d56e7217b8ffcc8fe5b8fefc8 | 399 | py | Python | Task2G.py | JoeBarney1/floodlevelmonitor131 | 98d93ca3d5bf6d1f2f105529d2f758450f791188 | [
"MIT"
] | 1 | 2022-01-23T19:30:19.000Z | 2022-01-23T19:30:19.000Z | Task2G.py | JoeBarney1/floodlevelmonitor131 | 98d93ca3d5bf6d1f2f105529d2f758450f791188 | [
"MIT"
] | null | null | null | Task2G.py | JoeBarney1/floodlevelmonitor131 | 98d93ca3d5bf6d1f2f105529d2f758450f791188 | [
"MIT"
] | null | null | null | from floodsystem.flood import highest_risk
from floodsystem.stationdata import build_station_list
def run():
"""Requirements for Task 2G"""
stations= build_station_list()
for s in highest_risk(stations,dt=3,N=10,y=3):
print(s)
#works with whole list but takes v. long time
if __name__ == "__main__":
print("*** Task 2G: CUED Part IA Flood Warning System ***")
run() | 30.692308 | 63 | 0.691729 |