table name that matches the starting characters of the CSV file name.
484402
private TableDefinition determineTableFromFileName(String fileName) {
        ApplicationDefinition appDef = m_session.getAppDef();
        for (String tableName : m_tableNameList) {
            if (fileName.regionMatches(true, 0, tableName, 0, tableName.length())) {
                return appDef.getTableDef(tableName);
            }
        }
        return null;
    }
1300985
def getshapestring(self, startrow=1, nrow=-1, rowincr=1):
        """"""
        return self._table.getcolshapestring(self._column,
                                             startrow, nrow, rowincr)
507679
def readTableFromDelimited(f, separator="\t"):
    
    rowNames = []
    columnNames = []
    matrix = []

    first = True
    for line in f.readlines():
        line = line.rstrip()
        if len(line) == 0:
            continue

        row = line.split(separator)
        if first:
            columnNames = row[1:]
            first = False
        else:
            rowNames.append(row[0])
            matrix.append([float(c) for c in row[1:]])

    return Table(rowNames, columnNames, matrix)
1332965
def _valid_table_name(self, table):
        
        if table is None or not len(table.strip()):
            raise ValueError("Invalid table name: %r" % table)
        return table.strip()
397186
def cols_str(columns):
    """"""
    cols = ""
    for c in columns:
        cols = cols + wrap(c) + ', '
    return cols[:-2]
703459
public String getRowsWithColumnsAndColumnsNamesAsString() {
		StringBuffer sb = new StringBuffer();
		String lvColumnNames = getColumnNames();
		if (lvColumnNames.trim().length() > 0) {
			sb.append(lvColumnNames);
			sb.append(CsvParser.CRLF);
		}
		sb.append(getRowsWithColumnsAsString());
		return sb.toString();
	}
588505
def table_repr(columns, rows, data, padding=2):
    """"""
    padding = ' ' * padding
    column_lengths = [len(column) for column in columns]
    for row in rows:
        for i, column in enumerate(columns):
            item = str(data[row][column])
            column_lengths[i] = max(len(item), column_lengths[i])
    max_row_length = max(len(row) for row in rows) if len(rows) else 0
    table_row = ' ' * max_row_length
    for i, column in enumerate(columns):
        table_row += padding + column.rjust(column_lengths[i])
    table_rows = [table_row]
    for row in rows:
        table_row = row.rjust(max_row_length)
        for i, column in enumerate(columns):
            item = str(data[row][column])
            table_row += padding + item.rjust(column_lengths[i])
        table_rows.append(table_row)
    return '\n'.join(table_rows)
809399
def table_name(self):
        """"""
        if not self.class_name:
            raise ValueError
        else:
            tbl_name = ModelCompiler.convert_case(self.class_name)
        last_letter = tbl_name[-1]
        if last_letter in ("y",):
            return "{}ies".format(tbl_name[:-1])
        elif last_letter in ("s",):
            return "{}es".format(tbl_name)
        else:
            return "{}s".format(tbl_name)
836548
def _character_matches(name1, name2):
    
    if name1[0] == "*":
        for i in range(len(name2) + 1):
            yield 1, i
    if name2[0] == "*":
        for i in range(len(name1) + 1):
            yield i, 1
    if name1[0] == name2[0]:
        yield 1, 1
240630
def beginningPage(R):
    """"""
    p = R['PG']
    if p.startswith('suppl '):
        p = p[6:]
    return p.split(' ')[0].split('-')[0].replace(';', '')
1038638
private String patternCond(String columnName, String tableName) {
    if (tableName == null) {
      return "(1 = 1)";
    }
    String predicate =
        (tableName.indexOf('%') == -1 && tableName.indexOf('_') == -1) ? "=" : "LIKE";
    return "(" + columnName + " " + predicate + " '" + Utils.escapeString(tableName, true) + "')";
  }
373857
def normalize_column_name(name):
    """"""
    if not isinstance(name, six.string_types):
        raise ValueError('%r is not a valid column name.' % name)

    # limit to 63 characters
    name = name.strip()[:63]
    # column names can be 63 *bytes* max in postgresql
    if isinstance(name, six.text_type):
        while len(name.encode('utf-8')) >= 64:
            name = name[:len(name) - 1]

    if not len(name) or '.' in name or '-' in name:
        raise ValueError('%r is not a valid column name.' % name)
    return name
74354
public static String findEditTable(String tables) {
        if (!TextUtils.isEmpty(tables)) {
            // find the first word terminated by either a space or a comma
            int spacepos = tables.indexOf(' ');
            int commapos = tables.indexOf(',');

            if (spacepos > 0 && (spacepos < commapos || commapos < 0)) {
                return tables.substring(0, spacepos);
            } else if (commapos > 0 && (commapos < spacepos || spacepos < 0) ) {
                return tables.substring(0, commapos);
            }
            return tables;
        } else {
            throw new IllegalStateException("Invalid tables");
        }
    }
219985
def name(self):
    """"""
    row_index = getattr(self.path_spec, 'row_index', None)
    if row_index is not None:
      return 'OFFSET {0:d}'.format(row_index)

    row_condition = getattr(self.path_spec, 'row_condition', None)
    if row_condition is not None:
      if len(row_condition) > 2 and isinstance(
          row_condition[2], py2to3.STRING_TYPES):
        return 'WHERE {0:s} {1:s} \'{2:s}\''.format(*row_condition)
      return 'WHERE {0:s} {1:s} {2!s}'.format(*row_condition)

    # Directory name is full name of column: <table>.<column>
    table_name = getattr(self.path_spec, 'table_name', None)
    column_name = getattr(self.path_spec, 'column_name', None)
    if table_name and column_name:
      return '{0:s}.{1:s}'.format(table_name, column_name)

    return ''
308992
def _valid_table_name(self, table_name):
        
        if table_name is None or not len(table_name.strip()):
            raise ValueError("Invalid table name: %r" % table_name)
        return table_name.strip()
1086310
def parse_table_name(self, table):
        
        if "." in table:
            schema, table = table.split(".")
        else:
            schema = None
        return (schema, table)
745809
def get_csv_header(fname, sep=','):
    
    with open(fname, encoding='utf-8-sig') as f:
        return next(f).split(sep)